Skip to main content

Levers

Struct Levers 

Source
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

Source

pub const COVERING_INDEX: u32 = 1

Read a term’s columns from the index entry, without fetching the row.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const EVERY: u32

Every lever this build has.

Source

pub fn all() -> Levers

Returns the shipped configuration: everything on.

Source

pub fn without(mask: u32) -> Levers

Returns a configuration with the named levers turned off. @param mask - the levers to disable

Source

pub fn has(self, lever: u32) -> bool

Returns whether one lever is on. @param lever - the lever to ask about

Source

pub fn disabled(self) -> u32

Returns the mask of what is off, which is what a report prints.

Source

pub fn names_disabled(self) -> Vec<&'static str>

Returns the names of the levers that are off, for a report.

Trait Implementations§

Source§

impl Clone for Levers

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Levers

Source§

impl Debug for Levers

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Levers

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Levers

Source§

impl PartialEq for Levers

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Levers

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.