Query Optimizer

Get AI-powered suggestions to make your dataset SQL queries more performant and structurally sound.

When you write a SQL query for a dataset, the Query Optimizer reviews it and suggests ways to make it faster and more efficient — for example, replacing SELECT * with the columns you actually need, restructuring inefficient joins, or adding filters that reduce how much data your warehouse has to scan. Where it can, it also looks at the referenced tables' columns and the query plan so its suggestions are grounded in your actual data, and it tailors them to your warehouse (Snowflake, Amazon Redshift, Google BigQuery, and more).

The Query Optimizer complements Dataset validation: validation confirms your query runs, while the optimizer suggests how to make it run better.

Where to find it

The Query optimizer panel appears above the SQL editor when you create or edit a query-backed dataset.

Optimize a query

  1. Open a query dataset in the editor and make sure your SQL is in place.
  2. Click Optimize query. Simon reads your query, inspects the referenced tables, reviews the query plan where available, and analyzes it for improvements. This can take a moment.
  3. Review the suggestions. Each one includes:
    • a short title describing the improvement,
    • a plain-language explanation of why it helps, and
    • a Show rewritten SQL toggle so you can see the full rewritten query before applying anything.

Apply suggestions

You have two ways to apply what you see:

  • Apply suggestion — swaps that single suggestion's rewrite into the editor. Applying another suggestion replaces it, because each rewrite is a complete version of your query rather than a stacked change.
  • Apply all optimizations — applies one combined query that includes every suggested improvement at once. This is usually what you want if you agree with the suggestions.

After applying, click Reoptimize to analyze the updated query again, and use Helpful? Yes / No on each suggestion to tell us whether it was useful — your feedback helps the optimizer improve.

🚧

Always validate before and after

Suggestions are AI-generated and can be incorrect. Before and after applying a rewrite, click Run to confirm the results are what you expect and haven't changed unintentionally. Treat the optimizer as a knowledgeable assistant, not a replacement for reviewing and testing your query.

Good to know

  • The optimizer never runs your query against your data when it analyzes it — it only reviews the SQL, your table schema, and the query plan. You stay in control of when the query actually runs.
  • Schema and query-plan details are used when they're available; if Simon can't read them for a particular table or warehouse, the optimizer still analyzes your query and the suggestions are based on the SQL itself.
📘

Availability

The Query Optimizer is currently in beta. If you don't see it in your dataset editor, reach out to your Customer Solutions Manager.