Optimizations - gravbox/Gravitybox.Datastore GitHub Wiki

There are numerous optimization to enhance performance. Much of the functionality of the system is based on running multiple SQL queries and performing data transformations. This is both disk and CPU intensive. The disk access is mitigated by various caching mechanisms. All query executions are cached but pieces of queries are cached as well. If parts of a query are relevant to other unique queries, these pieces are cached and re-used. This is very relevant for paging. There is data that is shared between pages of a query that do not affect the actual records returned. Queries that may be return disparate sets of data may still share a SQL query plan.

Multiple SQL queries are run concurrently to take advantage of the SQL Server’s multithreading and internal data caching functionality. Post processing data transformations and aggregations are multithreaded to take advantage of multiple CPUs.