SQLite table disk usage

后端 未结 5 1047
借酒劲吻你
借酒劲吻你 2021-01-30 08:39

How can I find out the disk usage of a single table inside a SQLite database without copying it in a new empty database?

5条回答
  •  无人及你
    2021-01-30 08:49

    It is possible to get details about all the pages used by each table or index from the dbstat table, and it is also possible to aggregate that to get the disk usage of each table or index.

    For example, it is possible get the 10 tables using more disk space like this:

    sqlite> select name, sum(pgsize) as size from dbstat group by name order by size desc limit 10;
    

    Based on https://www.sqlite.org/dbstat.html

提交回复
热议问题