Module sqlite_stat

Module sqlite_stat 

Source
Expand description

SQLite Statistics Virtual Tables

Implements sqlite_stat1, sqlite_stat2, sqlite_stat3, and sqlite_stat4 for SQLite compatibility. These tables store index statistics computed by the ANALYZE command.

Currently, only sqlite_stat1 is fully implemented, which is the most commonly used.

Schema:

CREATE TABLE sqlite_stat1 (
  tbl TEXT,   -- table name
  idx TEXT,   -- index name (NULL for table statistics)
  stat TEXT   -- space-separated statistics (row_count selectivity...)
);

Reference: https://www.sqlite.org/fileformat2.html#stat1tab

Functionsยง

execute_sqlite_stat1_query
Execute a sqlite_stat1 query
get_sqlite_stat1_table_schema
Get the schema for sqlite_stat1
is_sqlite_stat1_table
Check if a table reference is specifically sqlite_stat1
is_sqlite_stat_table
Check if a table reference is a sqlite_stat table