Features & workflows
Reading a query plan
Ask the engine how it intends to run a statement before you run it — and learn the handful of things worth looking for in the answer.
The Plan panel sits beside your results and shows how the database intends to execute the statement your cursor is on. It is the fastest way to find out why something is slow, and it costs nothing to look.
Estimate first, measure second
By default the panel asks the engine to plan the statement without running it. That is safe on anything, including a production database and a statement that writes.
There is also an Analyze option, which gives you real timings and real row counts instead of estimates. Analyze genuinely executes the statement — so on anything that writes, it writes. AddisDB asks before doing that, and you should treat the answer the same way you would treat running the statement yourself.
What to look for
- A full scan of a large table where you expected an index to be used — usually a missing index, or a WHERE clause written so the index cannot apply.
- An estimate far away from the actual count, which normally means the engine’s statistics are stale and need refreshing.
- A sort or grouping step that spills to disk, which shows up as a much larger cost than the steps around it.
- A nested loop over a large number of rows, where a hash or merge strategy would have been cheaper.
- The step holding the largest share of total cost — start there, not at the top of the tree.
Why a plan can change on its own
The same query can be planned differently tomorrow. Engines decide strategy from statistics about your data, so as a table grows or its distribution shifts, the plan shifts with it. A query that was fast for a year can turn slow without anybody changing it — which is why it is worth checking the plan of a query that has recently got slower, rather than assuming the query is at fault.
Not every engine can answer
Planning is a feature of the engine, not of AddisDB. Most SQL databases explain themselves in detail; some document stores and HTTP-based warehouses expose little or nothing. Where an engine has no planner to ask, the panel says so plainly rather than inventing an answer.