SingleStore DB

Query Classification

The workload manager classifies queries by their size: small, medium, or large. Queries are classified to determine their Queueing Policy.

Small Queries

Small queries do not exceed the workload_management_memory_queue_threshold, which is a small amount of memory relative the total amount of leaf memory available to queries.

Small queries also do not use distributed joins. For this reason, they do not require threads or connections on the leaves.

Medium Queries

Medium queries fit within the following lower and upper resource thresholds. These resources are threads used per leaf, connections used per leaf, and memory used per leaf.

If the resource requirements for a new medium query exceed the total amount of resources allocated to all aggregators for all medium queries, the new query is queued in a local queue that is maintained by an individual aggregator. Each aggregator decides when to dequeue the queries in its local queue.

Lower Thresholds
  • Threads used per leaf: 1

  • Connections used per leaf: 1

  • Memory used per leaf: Total leaf memory * workload_management_memory_queue_threshold

Upper Thresholds
  • Threads used per leaf: 50% * workload_management_max_threads_per_leaf / workload_management_expected_aggregators

  • Connections used per leaf: 50% * workload_management_max_connections_per_leaf / workload_management_expected_aggregators

  • Memory used per leaf: Total leaf memory / workload_management_expected_aggregators

Large queries

Queries that exceed the upper threshold for medium queries are classified as large queries.