Skip to content

EF Core Optimization

Jeff Greene edited this page Aug 24, 2020 · 1 revision

MARS

MARS stands for Multiple Active Result Set. In large queries that have several legs, each joined to the same driving table the number of returned rows grows exponentially. To mitigate this we split the query along the driving table legs and dispatch multiple select statements simultaneously, materializing into a single result set.

To control the behavior of this splitting we have a pair of environment variables you can set

HARMONYCORE_ENABLE_MARS

set to any value other than 0, this will enable multiple active result sets. Set to 0 by default disabling this feature.

HARMONYCORE_MARS_TARGET_SIZE

cost weighted number of tables that can be joined to the driving table before being split. Legs that join to other legs have a 10x cost associated with them. Default value is 2 and will work well for most use cases.

Clone this wiki locally