清单 2. 列出表和架构
C:\minblogg>sqlite3 c:\minblogg\www\db\alf.db SQLite version 3.2.1 Enter ".help" for instructions sqlite> .tables mytable sqlite> select * from mytable; Nils-Erik|23 sqlite> .schema CREATE TABLE mytable(name varchar(40), age smallint); sqlite>
SQLite 还附带命令行数据库分析器,该分析器允许您显示关于任何 SQLite 数据库当前状态的详细信息。
清单 3. SQLite 分析器
C:\minblogg>sqlite3_analyzer www\db\alf.db Analyzing table mytable... Analyzing table sqlite_master... /** Disk-Space Utilization Report For www\db\alf.db *** As of 2005-Apr-24 18:56:40 Page size in bytes.................... 1024 Pages in the whole file (measured).... 2 Pages in the whole file (calculated).. 2 Pages that store data................. 2 100.0% Pages on the freelist (per header).... 0 0.0% Pages on the freelist (calculated).... 0 0.0% Pages of auto-vacuum overhead......... 0 0.0% Number of tables in the database...... 2 Number of indices..................... 0 Number of named indices............... 0 Automatically generated indices....... 0 Size of the file in bytes............. 2048 Bytes of user payload stored.......... 13 0.63% *** Page counts for all tables with their indices ******************** MYTABLE............................... 1 50.0% SQLITE_MASTER......................... 1 50.0% *** All tables ******************************************************* Percentage of total database.......... 100.0% Number of entries..................... 2 Bytes of storage consumed............. 2048 Bytes of payload...................... 91 4.4% Average payload per entry............. 45.50 Average unused bytes per entry........ 916.50 Maximum payload per entry............. 78 Entries that use overflow............. 0 0.0% Primary pages used.................... 2 Overflow pages used................... 0 Total pages used...................... 2 Unused bytes on primary pages......... 1833 89.5% Unused bytes on overflow pages........ 0 Unused bytes on all pages............. 1833 89.5% *** Table MYTABLE **************************************************** Percentage of total database.......... 50.0% Number of entries..................... 1 Bytes of storage consumed............. 1024 Bytes of payload...................... 13 1.3% Average payload per entry............. 13.00 Average unused bytes per entry........ 999.00 Maximum payload per entry............. 13 Entries that use overflow............. 0 0.0% Primary pages used.................... 1 Overflow pages used................... 0 Total pages used...................... 1 Unused bytes on primary pages......... 999 97.6% Unused bytes on overflow pages........ 0 Unused bytes on all pages............. 999 97.6%
由于完全能够使用命令行界面来管理数据库,因此它可以为数据库管理员带来很大的方便。目前有许多优秀的基于 Web 的 SQLite 数据库管理系统。其中有一个是基于 PHP 的 SQLiteManager。
|