Documentation Source Text

Check-in [83b2bf0c4d]
Login

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

Overview
Comment:Clarification of the meaning of the stat column in sqlite_stat1.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 83b2bf0c4d3811e788aa22fa2fb2d0b289c72229
User & Date: drh 2013-09-19 14:30:37.229
Context
2013-09-30
12:10
Fix to the releaselog/current.html generator. (check-in: e7d9c2101a user: drh tags: trunk)
2013-09-19
14:30
Clarification of the meaning of the stat column in sqlite_stat1. (check-in: 83b2bf0c4d user: drh tags: trunk)
14:24
Leave unspecified what it means for the sqlite_stat3 and sqlite_stat4 tables to have idx columns equal to their tbl column. (check-in: c538b41b91 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/fileformat2.in.
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184

1185
1186
1187
1188
1189
1190
1191
1192
1193

1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
</pre></blockquote>

<p>There is normally one row per index, with the index identified by the
name in the sqlite_stat1.idx column.  The sqlite_stat1.tbl column is
the name of the table to which the index belongs.  In each such row, 
the sqlite_stat.stat column will be
a string consisting of a list of integers.  The first integer in this
list is the number of rows in the index and in the table.  The second
integer is the average number of rows in the index that have the same
value in the first column of the index.  The third integer is the average
number of rows in the index that have the same value for the first two
columns.  The N-th integer (for N>1) is the average number of rows in 

the index which have the same value for the first N-1 columns.  For
a K-column index, there will be K+1 integers in the stat column.  If
the index is unique, then the last integer will be 1.

<p>The list of integers in the stat column can optionally be followed
by the keyword "unordered".  The "unordered" keyword, if it is present,
must be separated from the last integer by a single space.  If the
"unordered" keyword is present, then the query planner assumes that
the index is unordered and will not use the index for a range query.


<p>If the sqlite_stat1.idx column is NULL, then the sqlite_stat1.stat
column contains a single integer which is the (estimated) number of
rows in the table identified by sqlite_stat1.tbl.

<tcl>hd_fragment stat2tab {sqlite_stat2}</tcl>
<h4>2.5.4 The sqlite_stat2 table</h4>

<p>The sqlite_stat2 is only created and is only used if SQLite is compiled
with SQLITE_ENABLE_STAT2 and if the SQLite version number is between







|
|
|
|
|
>








|
>


|







1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
</pre></blockquote>

<p>There is normally one row per index, with the index identified by the
name in the sqlite_stat1.idx column.  The sqlite_stat1.tbl column is
the name of the table to which the index belongs.  In each such row, 
the sqlite_stat.stat column will be
a string consisting of a list of integers.  The first integer in this
list is the approximate number of rows in the index and in the table.  
The second integer is the approximate average number of rows in the index
that have the same value in the first column of the index.  The third 
integer is the approximate average number of rows in the index that have 
the same value for the first two columns.  The N-th integer (for N>1) 
is the approximate average number of rows in 
the index which have the same value for the first N-1 columns.  For
a K-column index, there will be K+1 integers in the stat column.  If
the index is unique, then the last integer will be 1.

<p>The list of integers in the stat column can optionally be followed
by the keyword "unordered".  The "unordered" keyword, if it is present,
must be separated from the last integer by a single space.  If the
"unordered" keyword is present, then the query planner assumes that
the index is unordered and will not use the index for a range query
or for sorting.

<p>If the sqlite_stat1.idx column is NULL, then the sqlite_stat1.stat
column contains a single integer which is the approximate number of
rows in the table identified by sqlite_stat1.tbl.

<tcl>hd_fragment stat2tab {sqlite_stat2}</tcl>
<h4>2.5.4 The sqlite_stat2 table</h4>

<p>The sqlite_stat2 is only created and is only used if SQLite is compiled
with SQLITE_ENABLE_STAT2 and if the SQLite version number is between