SQLite 表磁盘使用情况 [英] SQLite table disk usage

查看:28
本文介绍了SQLite 表磁盘使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不将其复制到新的空数据库中的情况下,找出 SQLite 数据库中单个表的磁盘使用情况?

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

推荐答案

您可以使用 sqlite3_analyzer 来自 https://www.sqlite.org/download.html.

这是一个非常酷的工具.它显示了每个表使用的页数,有索引和没有索引(默认情况下,每页为 1024 字节).

It's a really cool tool. It shows you the number of pages used by each table with and without indexes (each page, by default, is 1024 bytes).

这是 Northwind 数据库的示例 sqlite3_analyzer 输出:

This is a sample sqlite3_analyzer output for the Northwind database:

*** Page counts for all tables with their indices ********************

EMPLOYEES............................. 200         34.4% 
ORDERS................................ 152         26.2% 
CATEGORIES............................ 90          15.5% 
ORDER DETAILS......................... 81          13.9% 
CUSTOMERS............................. 17           2.9% 
SQLITE_MASTER......................... 11           1.9% 
PRODUCTS.............................. 7            1.2% 
SUPPLIERS............................. 7            1.2% 
TERRITORIES........................... 6            1.0% 
CUSTOMERCUSTOMERDEMO.................. 2            0.34% 
CUSTOMERDEMOGRAPHICS.................. 2            0.34% 
EMPLOYEETERRITORIES................... 2            0.34% 
REGION................................ 2            0.34% 
SHIPPERS.............................. 2            0.34% 

它还生成 SQL 语句,可用于创建包含使用情况统计信息的数据库,然后您可以对其进行分析.

It also generates SQL statements which can be used to create a database with usage statistics, which you can then analyze.

这篇关于SQLite 表磁盘使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆