1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Set the TF_StatsUsed flag on tables when the query planner outcome is

affected by the sqlite_stat1 data.  Also, change the column names of the
"PRAGMA stats" command so that they are not keywords.

FossilOrigin-Name: fb2b8ae8310e4ea4b42354bbf36c3084a9d5c6d7
This commit is contained in:
drh
2017-02-17 15:26:36 +00:00
parent 33bec3f5e8
commit a3928dd7be
8 changed files with 165 additions and 22 deletions

View File

@@ -1883,10 +1883,13 @@ struct Table {
#define TF_Ephemeral 0x0002 /* An ephemeral table */
#define TF_HasPrimaryKey 0x0004 /* Table has a primary key */
#define TF_Autoincrement 0x0008 /* Integer primary key is autoincrement */
#define TF_HasStat1 0x0010 /* Has STAT1 data */
#define TF_HasStat1 0x0010 /* nRowLogEst set from sqlite_stat1 */
#define TF_WithoutRowid 0x0020 /* No rowid. PRIMARY KEY is the key */
#define TF_NoVisibleRowid 0x0040 /* No user-visible "rowid" column */
#define TF_OOOHidden 0x0080 /* Out-of-Order hidden columns */
#define TF_SizeChng 0x0100 /* nRowLogEst might be inaccurate */
#define TF_StatsUsed 0x0200 /* Query planner decisions affected by
** Index.aiRowLogEst[] values */
/*
** Test to see whether or not a table is a virtual table. This is
@@ -2129,7 +2132,7 @@ struct Index {
unsigned isResized:1; /* True if resizeIndexObject() has been called */
unsigned isCovering:1; /* True if this is a covering index */
unsigned noSkipScan:1; /* Do not try to use skip-scan if true */
unsigned hasStat1:1; /* True if stat1 data has been loaded */
unsigned hasStat1:1; /* aiRowLogEst values come from sqlite_stat1 */
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
int nSample; /* Number of elements in aSample[] */
int nSampleCol; /* Size of IndexSample.anEq[] and so on */