On Fri, 30 May 2008 09:18:39 -0700 (PDT), you wrote: >Hi , >I have two questions: > 1) Calucate the actual size of the database(NOT RUN VACUUM) - "Actual >database size" which won't include the space of deleted rows. > To be more specific you calculate the database size by the following >below(WITHOUT VACUUM) > Database file size - (pragma freelist_count * pragma page_size ) > this calculation will return the actuall database size(the size >exclude the space of deleted rows) > 2) No VACUUM the database which has a lot of deletion. > Is that true that the space of the database won't reclaim if we don't >run the "VACUUM" on the database. > Thanks, >JP
Would sqlite3_analyzer work for you? It produces both a human readable report as well as a table definition and insert statements to feed to sqlite3 command line tool. CREATE TABLE space_used( name clob, -- Name of a table or index in the database file tblname clob, -- Name of associated table is_index boolean, -- TRUE if it is an index, false for a table nentry int, -- Number of entries in the BTree leaf_entries int, -- Number of leaf entries payload int, -- Total amount of data stored in this table or index ovfl_payload int, -- Total amount of data stored on overflow pages ovfl_cnt int, -- Number of entries that use overflow mx_payload int, -- Maximum payload size int_pages int, -- Number of interior pages used leaf_pages int, -- Number of leaf pages used ovfl_pages int, -- Number of overflow pages used int_unused int, -- Number of unused bytes on interior pages leaf_unused int, -- Number of unused bytes on primary pages ovfl_unused int, -- Number of unused bytes on overflow pages gap_cnt int -- Number of gaps in the page layout ); A wealth of information, really. sqlite3_analyzer is available on the download page http://www.sqlite.org/download.html . -- ( Kees Nuyt ) c[_] _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users