The query lifecycle
A query moves through six stages from submission to results:Stage 1: Query submission
You submit an NQL query to the control plane through:- The Query Editor in the Narrative I/O interface
- The NQL API for programmatic access
- Materialized view definitions that run on a schedule
Stage 2: Compilation and transpilation
The control plane transforms your NQL into executable SQL through several steps: Parsing. The NQL syntax is parsed and validated. Malformed queries fail here with syntax errors. Resolution. Dataset references are resolved to their actual locations. Rosetta Stone mappings translate standardized attribute names to physical column names. Permission verification. Your access grants are checked for every dataset and field in the query. If you lack permission to access any referenced data, the query fails before execution. Optimization. The query planner analyzes the query structure to determine an efficient execution strategy. Transpilation. The NQL is converted to native SQL for your target data plane’s database engine. A Snowflake data plane receives Snowflake SQL; a Spark data plane receives Spark SQL. See NQL Design Philosophy for details on transpilation. At the end of this stage, the control plane has a compiled query ready for execution.Stage 3: Job enqueueing
The control plane creates a job containing the compiled SQL and adds it to the job queue. The job queue is a coordination mechanism between the control plane and data planes—it holds work waiting for execution. Query execution is one type of job. The job queue also handles other operations like dataset management and system tasks. See Job Types for a complete list.Stage 4: Operator polling
Each data plane runs an operator component that bridges the control plane and your data infrastructure. The operator:- Polls the control plane’s job queue for work targeting its data plane
- Authenticates to ensure only authorized operators can pick up jobs
- Claims jobs for execution
- Your data plane can be behind a firewall
- The control plane never needs credentials to your database
- You control when and how jobs are executed

