When I query string columns on custom metadata objects, I get decent performance. However, if I query a column that points to a FieldDefinition, my query became much slower.
Is this a known system bug? Is there a patch on the horizon?
It makes these relationships really unusable.
Here are profiling logs on a sandbox. (I'll just include the SOQL profiling.):
Querying a String takes 19ms.
for (My_Metadata__mdt m: [SELECT Id, String__c FROM My_Metadata__mdt]) {
System.debug(m.id);
}
AnonymousBlock: line 1, column 1: [SELECT Id, String__c FROM My_Metadata__mdt]: executed 273 times in 19 ms
Query a FieldDefinition takes about half a second!
for (My_Metadata__mdt m: [SELECT Id, Field__c FROM My_Metadata__mdt]) {
System.debug(m.id);
}
AnonymousBlock: line 1, column 1: [SELECT Id, Field__c FROM My_Metadata__mdt]: executed 273 times in 511 ms
Profiling Procedure:
- Run a snippet ~10 times.
- Note the times on each except the first are about the same.
- Choose one of the middle-ground non-first logs to paste here.