Parallelism - MarkMpn/Sql4Cds GitHub Wiki
When you run INSERT
, UPDATE
or DELETE
statements, SQL 4 CDS executes one request for each record that will be affected.
If a single query affects multiple records, SQL 4 CDS will generate a batch of requests and can execute them in parallel for
greater efficiency.
In order for SQL 4 CDS to use parallel processing, your connection to the target Dynamics instance must be authenticated using an OAuth method. This is now required for all online instances but tends not to be for on premise instances.
When using parallelism, a number of worker threads are created and the list of requests are spread across them. The number of worker threads is controlled in the Settings page. Each thread can also submit requests in batches to further improve performance - the size of each batch is also controlled on the Settings page. These settings default to using the number of threads recommended by the server, with each thread submitting requests in batches of up to 100 records. On premise instances do not provide a recommended number of threads, so SQL 4 CDS will run with a single thread by default. You will need to configure the number of threads manually in the Settings page if you want to use parallelism on an on premise instance.
As well as changing the values on the Settings page, you can also control the number of worker threads for an individual query using the MaxDOP query hint
You can see the impact of using parallelism and batching in my blog.
In addition, any parallel operations for 100 or more records will automatically disable the affinity cookie to spread the work over multiple servers.