SQLite Database Size
SQLite Database Size is a SQL statement in the SQLite Specific category. SQLite: query database file size, table sizes, and page usage statistics. The syntax is SELECT page_count * page_size AS db_size FROM pragma_page_count(), pragma_page_size();. It returns database size info. A typical example: -- Database size: SELECT page_count * page_size / 1024 AS size_kb FROM pragma_page_count, pragma_page_size; -- Table row counts: SELECT name, ( SELECT COUNT(*) FROM pragma_table_info(name) ) AS columns, (SELECT COUNT(*) FROM (SELECT 1 FROM '[' || name || ']' LIMIT 1000)) FROM sqlite_master WHERE type = 'table'; -- Integrity check: PRAGMA integrity_check; -- Returns 'ok' if database is intact -- Quick check: PRAGMA quick_check; -- Page usage: PRAGMA freelist_count; --… A close relative is AUTOINCREMENT (SQLite), which sQLite: unlike AUTO_INCREMENT in MySQL, only INTEGER PRIMARY KEY columns auto-increment. AUTOINCREMENT guarantees unique increasing IDs. A close relative is ROWID / _ROWID_, which sQLite: every row has an implicit 64-bit ROWID. INTEGER PRIMARY KEY becomes an alias for ROWID.