/ Check-in [ae31dc67]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a couple of typos in comments in analyze.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | stat3-enhancement
Files: files | file ages | folders
SHA1: ae31dc67aa0637150f964de31a6da6f5797b462a
User & Date: dan 2011-08-15 12:02:21
Context
2011-08-15
12:58
Update some test cases to work with sqlite_stat3 instead of sqlite_stat2. check-in: 2504bcfb user: drh tags: stat3-enhancement
12:02
Fix a couple of typos in comments in analyze.c. check-in: ae31dc67 user: dan tags: stat3-enhancement
2011-08-13
19:35
Further testing and bug fixing for sqlite_stat3. Added the Index.avgEq field to index statistics. Fixed several problems in the query planner associated with stat3. check-in: 89b2f708 user: drh tags: stat3-enhancement
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/analyze.c.

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
** with SQLITE_ENABLE_STAT2 and if the SQLite version number is between
** 3.6.18 and 3.7.7.  The "stat2" table contains additional information
** about the distribution of keys within an index.  The index is identified by
** the "idx" column and the "tbl" column is the name of the table to which
** the index belongs.  There are usually 10 rows in the sqlite_stat2
** table for each index.
**
** The sqlite_stat2 entires for an index that have sampleno between 0 and 9
** inclusive are samples of the left-most key value in the index taken at
** evenly spaced points along the index.  Let the number of samples be S
** (10 in the standard build) and let C be the number of rows in the index.
** Then the sampled rows are given by:
**
**     rownumber = (i*C*2 + C)/(S*2)
**
................................................................................
**
** The format of the sqlite_stat3 table is similar to the format for
** the sqlite_stat2 table, with the following changes:  (1)
** The sampleno column is removed.  (2) Every sample has nEq, nLt, and nDLt
** columns which hold the approximate number of rows in the table that
** exactly match the sample, the approximate number of rows with values
** less than the sample, and the approximate number of distinct key values
** less than the sample, respectively.  (3) The number of samples can very 
** from one table to the next; the sample count does not have to be 
** exactly 10 as it is with sqlite_stat2.
**
** The ANALYZE command will typically generate sqlite_stat3 tables
** that contain between 10 and 40 samples which are distributed across
** the key space, though not uniformly, and which include samples with
** largest possible nEq values.







|







 







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
** with SQLITE_ENABLE_STAT2 and if the SQLite version number is between
** 3.6.18 and 3.7.7.  The "stat2" table contains additional information
** about the distribution of keys within an index.  The index is identified by
** the "idx" column and the "tbl" column is the name of the table to which
** the index belongs.  There are usually 10 rows in the sqlite_stat2
** table for each index.
**
** The sqlite_stat2 entries for an index that have sampleno between 0 and 9
** inclusive are samples of the left-most key value in the index taken at
** evenly spaced points along the index.  Let the number of samples be S
** (10 in the standard build) and let C be the number of rows in the index.
** Then the sampled rows are given by:
**
**     rownumber = (i*C*2 + C)/(S*2)
**
................................................................................
**
** The format of the sqlite_stat3 table is similar to the format for
** the sqlite_stat2 table, with the following changes:  (1)
** The sampleno column is removed.  (2) Every sample has nEq, nLt, and nDLt
** columns which hold the approximate number of rows in the table that
** exactly match the sample, the approximate number of rows with values
** less than the sample, and the approximate number of distinct key values
** less than the sample, respectively.  (3) The number of samples can vary 
** from one table to the next; the sample count does not have to be 
** exactly 10 as it is with sqlite_stat2.
**
** The ANALYZE command will typically generate sqlite_stat3 tables
** that contain between 10 and 40 samples which are distributed across
** the key space, though not uniformly, and which include samples with
** largest possible nEq values.