Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

How do you write query for around 500.000 records

Posted on by Microsoft Employee

Hi, 

I have a task to write query to create records then link to its parent and make my query work real time.

On my recent project, i created a console application to accomplish that. This console application is run every 5 mnt using windows scheduler. 

Based on description above, i need your suggestion for:

1. Write query with best performance when working with a lot of records

The number of records i work before is totally different then now. Now, the total parent records are around 500.000 records  while my previouse project just around 5000 records.

When the child records want to link with it's parent, i need to search parent records by it's guid.  The problem is i have to find one records Among 500,000 records. I worry about my code performance while working with those huge amount of records. 

2. The way to make the application run real-time

By using windows sheduler, i can make it run every 5 mnt. But is there a way to make the console application run real time. I think about creating a custom plugin which trigger to run on create event. From inside this plugin, i call those console application. Is that possible ?

*This post is locked for comments

  • Suggested answer
    M.T. Eikelenboom Profile Picture
    M.T. Eikelenboom 5,241 on at
    RE: How do you write query for around 500.000 records

    1 -> It's best to understand how indexes work in SQL server (here's an explanation: www.simple-talk.com/.../sql-server-index-basics) If you are getting are record by it's guid, that's will not impact performance, as this is the primary key of the entity.

    2 --> You might want to look into change tracking. Maybe that's a better solution. msdn.microsoft.com/.../dn932130.aspx

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

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans