On 12/25/15, Valentin Davydov <sqlite-user at soi.spb.ru> wrote: > > It would be desirable to improve algorithm of INTEGRITY_CHECK pragma. > Presently it is generally useless for indexed databases which don't fit > entirely in RAM (and which usually need checking much strongly than > smaller ones). >
For each row of each table in the database, PRAGMA integrity_check verifies that there are corresponding entries in the indexes associated with that table. This operation typically involves lots of random seeking, which can be slow for large databases. The "PRAGMA quick_check" command works just like "PRAGMA integrity_check" except that it skips this row-by-row checking of index entries. PRAGMA quick_check still verifies that each index has the correct number of entires, but it does not verify that all the entries correspond to table rows. Hence, PRAGMA quick_check is able to do a single scan through the entire database file, reading each page only once, and without doing a lot of seeking. It can therefore be a lot faster. -- D. Richard Hipp drh at sqlite.org