web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

contacts API query is very slow

(1) ShareShare
ReportReport
Posted on by 7
Hi,
Our production app is calling the Dynamics API to query for contacts, but we are noticing it is very slow, taking around 13-15 seconds to respond. We are querying for contacts that match an email address or name.
 
Here is a sample query:
https://{subdomain}.crm.dynamics.com/api/data/v9.2/contacts?$top=25&$filter=(contains(fullname,'test')%20or%20contains(emailaddress1,'test'))%20and%20(Microsoft.Dynamics.CRM.NotIn(PropertyName='statecode',PropertyValues=['0','1']))&$select=fullname,firstname,lastname,emailaddress1&$expand=owninguser($select=fullname,windowsliveid)
 
I've tried reducing limit from 25, but that doesn't seem to make a difference. Is there anything else we can do to optimize the query? What is the expected latency of this API?
Categories:
I have the same question (0)
  • Suggested answer
    PerezAguiar Profile Picture
    Microsoft Employee on at
    Hey!
     
    I think you should reach to Microsoft Support to get some assistance on this.  But before that:  Typically, the "contains" operation consumes a lot of time/Resources as this must perform substring searches.  I would ask you to:
    - make the first search without the "Contains" string part, and only with the Statecode search.
    - then, the other way around:  only with ONE contains (for example, the FullName) and removing the StatusCode part
     
    The idea is to verify which of those 3 operations (FullName, Email or StatusCode) is taking more time to complete.  Once this is identified, then, probably reaching Microsoft to understand if there's any action that can be taken to improve.
     
    Regards,
  • AR-07012221-0 Profile Picture
    7 on at
    Thanks for the reply. From what I've found:
     
    - full query: 13-14 seconds
    - only status code check: 2-3 seconds
    - only email check: 8-9 seconds
    - only full name check: 16-18 seconds

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
iampranjal Profile Picture

iampranjal 67

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 37 Super User 2025 Season 2

#3
Pallavi Phade Profile Picture

Pallavi Phade 24

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans