It is my understanding that custom metadata types are more efficient than record based configuration because you do not have to hit the database to retrieve their information. Is this correct? Are there other performance advantages to using custom metadata types as opposed to record based configuration?

  • 5
    To me, the best advantage is not related to performance but the fact that records can be deployed from sandbox to prod and also records are copied to sandbox when its created. Commented Jan 8, 2020 at 17:11
  • You do actually have to query custom metadata type instances if you want to use the data in Apex code.
    – Phil W
    Commented Jan 8, 2020 at 17:27
  • 1
    I am familiar with querying custom metadata in code like: SELECT x, y FROM OBJECT__MDT This does not count against the SOQL query limit per the salesforce documentation as long as it does not have a long text area. Do you know if that transaction actually goes to the database or does it go to the metadata API? Commented Jan 8, 2020 at 17:35

1 Answer 1


There are performance gains with custom metadata as custom metadata is cached after first read.

From the salesforce docs

Custom metadata records are cached at the type level after the first read request. Caching enhances performance on subsequent requests. Requests that are in flight when metadata is updated don’t get the most recent metadata.

Also the other advantages include below

  1. Ability to associate relation between objects (Using Entity relationships)
  2. Ability to protect secret using protected custom metadata
  3. Easy deployment as a metadata between sandboxes and production and ability to package them for ISV apps
  4. SOQL executed does not count against the 100 SOQL limit we have per execution

Note: Object entity and field definition fields are slow to load when used in custom metadata types and their records in SQOL. Check here (How to improve performance when querying CustomMetadata's FieldDefinition fields)

  • 4
    It is worth mentioning that object entity and field definition fields are horrendously slow to load when used in custom metadata types and their records. Take a look at salesforce.stackexchange.com/questions/232561/… for details.
    – Phil W
    Commented Jan 8, 2020 at 17:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .