SQLite
View Ticket
Not logged in
Ticket UUID: b2fa5424e6fcb15b53ad7fe0e39aa067e463f99a
Title: Incorrect STAT4 samples for WITHOUT ROWID tables
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2014-06-30 18:58:01
Version Found In: 3.8.5
User Comments:
drh added on 2014-06-30 13:06:54:

The samples added to the sqlite_stat4 table by the ANALYZE command are incorrect for WITHOUT ROWID tables. After the key columns, a BLOB that is the record encoding of the key is added. This is contrary to the file-format documentation which says that the sample should be an exact copy of the index entry. Either the file-format document needs to be fixed or else the samples need to be computed differently. Or both.

Note that the bug has been harmless up to now because the query planner is unable to use columns in the sample past the key and so the incorrect sample content was never accessed or used. However, if the query planner is improved to make use of the extra sample content, older sqlite_stat4 tables might need to be recomputed.