|Title:||Incorrect STAT4 samples for WITHOUT ROWID tables|
|Last Modified:||2014-06-30 18:58:01|
|Version Found In:||3.8.5|
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.