GGshow reloaded GGshow reloaded

December 31, 2011

ROWID messed up by VACUUM

Issue:

  • ROWIDs in a SQLite table has been changed after executed a VACUUM command.

Reason:

  • VACUUM command rebuilds the entire database, and recreates rowid for all tables.

Solution:

  • Although query by ROWID could be fast, but it should not be used as an external key.
  • Use an explicits integer primary key in the tables.
    CREATE TABLE t(x INTEGER PRIMARY KEY ASC, y, z);
Filed under: Database,SQLite — Tags: , , — GG @ 4:29 pm

© 2024 GGSHOW | Powered by WordPress