pub struct Levers { /* private fields */ }Expand description
Which planner optimizations are switched on.
An optimization that cannot be switched off cannot be measured. The claim “the covering-index path made range reads thirty times faster” is a comparison, and without an arm to compare against it is a comparison with a build that no longer exists - which is an argument, not evidence.
The shape is SQLite’s. sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS)
takes a bitmask of optimizations to disable, reached through a control
channel rather than through SQL, for exactly this reason: a knob on the SQL
surface is a knob applications start depending on, and then it is not a
measurement device any more, it is a feature with a compatibility story.
Disabling is what the mask names, so zero is the shipped engine and the default everywhere. A lever added later defaults to on without anybody having to remember to turn it on.
Implementations§
Source§impl Levers
impl Levers
Sourcepub const COVERING_INDEX: u32 = 1
pub const COVERING_INDEX: u32 = 1
Read a term’s columns from the index entry, without fetching the row.
Sourcepub const INDEXED_WRITE: u32 = 2
pub const INDEXED_WRITE: u32 = 2
Find the rows an UPDATE or DELETE touches through an index or a rowid, rather than by scanning the table.
Sourcepub const ORDERED_WALK: u32 = 4
pub const ORDERED_WALK: u32 = 4
Answer an ORDER BY by walking a B-tree in its own key order, forwards
or backwards, instead of sorting every row and throwing most away.
Sourcepub const STREAMING_GROUP: u32 = 8
pub const STREAMING_GROUP: u32 = 8
Group and de-duplicate as the rows arrive, when the walk already brings equal keys together, instead of collecting every row into a sorter or a set first.
Sourcepub const FUSED_BYTECODE: u32 = 16
pub const FUSED_BYTECODE: u32 = 16
Fold a value written into a scratch register and immediately copied into the one instruction that writes it where it was going.
Sourcepub const PLAN_CACHE: u32 = 32
pub const PLAN_CACHE: u32 = 32
Reusing a compiled program for SQL text already prepared.
The rearchitecture’s design puts a plan cache in the new engine’s prepare path, and measures it here, on the existing one, first - so the mechanism is proved independently of the new storage. It is a lever rather than a constant because a speedup that cannot be switched off cannot be measured, and because “the cache made prepare six times faster” needs an arm to be a claim rather than an assertion.
Sourcepub const AUTOMATIC_INDEX: u32 = 64
pub const AUTOMATIC_INDEX: u32 = 64
Build a throwaway structure over an unindexed inner side of a join, rather than walking it once per outer row.
What PRAGMA automatic_index switches. It is a lever rather than a
constant for the same reason the others are - an optimisation that
cannot be switched off cannot be measured - and because SQLite exposes
exactly this switch under exactly this name, so an application that
turns it off there has somewhere to turn it off here.
Sourcepub fn without(mask: u32) -> Levers
pub fn without(mask: u32) -> Levers
Returns a configuration with the named levers turned off. @param mask - the levers to disable
Sourcepub fn has(self, lever: u32) -> bool
pub fn has(self, lever: u32) -> bool
Returns whether one lever is on. @param lever - the lever to ask about
Sourcepub fn names_disabled(self) -> Vec<&'static str>
pub fn names_disabled(self) -> Vec<&'static str>
Returns the names of the levers that are off, for a report.