SQLite

View Ticket
Login
2014-06-30
18:58 Fixed ticket [b2fa5424]: Incorrect STAT4 samples for WITHOUT ROWID tables plus 5 other changes (artifact: a9c56e5c user: drh)
18:57
Fix for ticket [b2fa5424e6fcb15]: Better define the format of the sqlite_stat4 file for WITHOUT ROWID tables and make sure the ANALYZE command generates a file in the appropriate format. Use the sqlite_stat4 data to enable the use of WHERE terms that cover all indexed columns plus some prefix of columns in the primary key. (check-in: bc2de809 user: drh tags: trunk)
13:32
Generate complete samples for sqlite_stat4 on WITHOUT ROWID tables. Ticket [b2fa5424e6fcb15b5] (check-in: 8cb43edd user: drh tags: stat4-without-rowid)
13:06 New ticket [b2fa5424] Incorrect STAT4 samples for WITHOUT ROWID tables. (artifact: c4cd9e13 user: drh)

Ticket Hash: 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.