6

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:

  1. Run a snippet ~10 times.
  2. Note the times on each except the first are about the same.
  3. Choose one of the middle-ground non-first logs to paste here.
4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.