Module 02 · Lesson 7 of 9Detailed study · about 25 min

Concurrency and query queueing

Concurrency is overlapping work. Queueing is time spent waiting for work to proceed.

Understand the idea

A warehouse can execute multiple queries at the same time. The capacity available to each workload depends on query resource requirements and warehouse configuration. A count of users alone does not describe the demand.

Key ideas in simple English
ConceptWhat it means
Concurrent demandDepends on both query count and resource requirements.
Overload waitCapacity is busy serving arriving work.
Provisioning waitResources are starting or changing.
Other blockingInvestigate transactions and the relevant wait reason.

A concrete example

Query A waits 40 seconds and executes for 5. Query B waits 0 and executes for 25. Their remedies may differ.

Remember: Inspect wait reasons and execution separately before adjusting compute.

Explain it step by step · full theory

Concurrency describes overlapping work

A warehouse can execute multiple queries at the same time. The capacity available to each workload depends on query resource requirements and warehouse configuration. A count of users alone does not describe the demand.

Ten tiny lookups and ten large joins can behave differently. For the shop, morning dashboard users may overlap with the daily transformation. If both share compute, their timing can affect each other even though each query is correct.

Read an elapsed-time breakdown

A request can spend time compiling, waiting for warehouse provisioning, waiting for overloaded compute, waiting on transaction-related conditions and executing. Query History exposes relevant timings, while warehouse activity shows running and queued work.

The specific metric names matter. Queued-overload time suggests insufficient capacity for arriving work. Queued-provisioning time points toward resources starting or changing. Transaction blocking needs investigation of the statements and transactions involved.

Compare two fictional observations

These invented timings illustrate diagnosis. They are not benchmark measurements. Report A takes longer overall because of waiting, while report B spends most of its time doing work.

For A, inspect the workload arriving at the same time and warehouse load. For B, inspect scans, joins and spill in the query profile. A larger warehouse is a hypothesis to evaluate once the source of delay is understood.

Simplified teaching observations in seconds
QueryQueue waitExecutionSimplified total
A40545
B02525

Choose a workload-level response

Possible responses include separating transformation and reporting warehouses, scheduling predictable work to reduce collisions, optimizing expensive queries, resizing or adding supported multi-cluster capacity.

Each choice has a cost and operating effect. Record the workload, selected configuration, queue time, execution time and user-facing completion time. This lets the team tell whether the intervention solved the observed problem.

Words used in this lesson
Concurrency
Overlapping query activity.
Queue time
Time spent waiting before relevant work can execute.
Workload isolation
Assigning workloads separate compute resources.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 3

Concurrency and query queueing

Dashboards
Transformations
Shared warehouse

Arrive

Requests overlap during a busy period.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Arrive

    Requests overlap during a busy period.

  2. Wait

    Inspect the reason for waiting.

  3. Respond

    Choose a remedy for the observed cause.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.
Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Inspect your recent queries

SQL · example
SELECT QUERY_ID, WAREHOUSE_NAME, EXECUTION_STATUS, QUEUED_OVERLOAD_TIME
FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY(RESULT_LIMIT => 20))
ORDER BY START_TIME DESC;

What to expect and why

Select a database first. Query history is role-scoped; queued overload time is in milliseconds. A zero does not prove the account never queues. This observes activity rather than manufacturing contention.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Query A waits 40 seconds and executes for 5. What deserves immediate investigation?

Try it yourself

Explain how you would investigate reports A and B from the table.

Compare your reasoning

For A, investigate waiting and the workload at arrival time. For B, inspect execution operators and resource usage. Compare any change using both total response and consumption.

Official sources and curriculum

Module 02 · See module scope