Skip to main content

Module plan

Module plan 

Source
Expand description

What a statement would do, asked two different ways.

§The server’s plan, which never runs the statement

explain asks the server how it would answer, and the statement itself is never executed. Asking for the plan of a statement that removes rows removes nothing, which is what makes the plan safe to ask for on any statement.

§The measured plan, which does run it

measure asks the server for the same plan with real numbers instead of estimated ones, and the server produces those numbers by executing the statement. That makes it a change in every sense that matters: it is confirmed like one, it obeys the ceiling like one, and it is refused without confirmation like one. Treating it as a plan because it is spelled like one would let a removal through under the name of an investigation.

§This tool’s own prediction

estimate answers the same question without asking the server anything: it reads the statement’s own restriction and derives the count that carries it. That prediction is what the ceiling on affected rows is checked against before the change is sent, and what a simulation reports back.

Structs§

Target
The table one change acts on.

Enums§

Estimate
How many rows a change is expected to touch, decided before it is sent.

Functions§

absent_trace
The gap declared when the server offers no reasoning for its choice.
count_values
The values that belong to the derived count, taken from the change’s own.
estimate
Predicts how many rows a change would touch, from the statement alone.
explain
Builds the request for the server’s own plan of a statement.
measure
Builds the request for the plan with measured rather than estimated numbers.
refuse_unplannable
Refuses a statement asked for a plan that this tool cannot plan.
restriction_of
The restriction a change carries, when it carries one.
running
The request for the plan of a statement running on another connection.
target_of
The table a change acts on, when the statement names exactly one.
undecidable_gap
The gap left when the ceiling could not be applied at all.