1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Enhance the stat VFS to report out the total size of all pages used by

a table, even if the ZIPVFS compression backend is in play.  Update
the sqlite3_analyzer logic to use these new outputs.

FossilOrigin-Name: 19b8eaaf70db82d401d33beb7fd36045d5e8326f
This commit is contained in:
drh
2011-09-28 00:50:14 +00:00
parent f08f3843b7
commit 4c9f129d60
5 changed files with 68 additions and 35 deletions

View File

@ -36,7 +36,8 @@ ifcapable wal {
do_execsql_test stat-0.1 {
PRAGMA journal_mode = WAL;
PRAGMA journal_mode = delete;
SELECT * FROM stat;
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat;
} {wal delete sqlite_master / 1 leaf 0 0 916 0}
}
@ -50,17 +51,20 @@ do_test stat-1.0 {
} {}
do_test stat-1.1 {
execsql {
SELECT * FROM stat WHERE name = 't1';
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat WHERE name = 't1';
}
} {t1 / 2 leaf 2 10 998 5}
do_test stat-1.2 {
execsql {
SELECT * FROM stat WHERE name = 'i1';
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat WHERE name = 'i1';
}
} {i1 / 3 leaf 2 10 1000 5}
do_test stat-1.3 {
execsql {
SELECT * FROM stat WHERE name = 'sqlite_master';
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat WHERE name = 'sqlite_master';
}
} {sqlite_master / 1 leaf 2 77 831 40}
do_test stat-1.4 {
@ -77,7 +81,8 @@ do_execsql_test stat-2.1 {
INSERT INTO t3 SELECT a_string(110+rowid), a_string(221+rowid) FROM t3;
INSERT INTO t3 SELECT a_string(110+rowid), a_string(221+rowid) FROM t3;
INSERT INTO t3 SELECT a_string(110+rowid), a_string(221+rowid) FROM t3;
SELECT * FROM stat WHERE name != 'sqlite_master';
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat WHERE name != 'sqlite_master';
} [list \
sqlite_autoindex_t3_1 / 3 internal 3 368 623 125 \
sqlite_autoindex_t3_1 /000/ 8 leaf 8 946 46 123 \
@ -108,7 +113,8 @@ do_execsql_test stat-3.1 {
CREATE TABLE t4(x);
CREATE INDEX i4 ON t4(x);
INSERT INTO t4(rowid, x) VALUES(2, a_string(7777));
SELECT * FROM stat WHERE name != 'sqlite_master';
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat WHERE name != 'sqlite_master';
} [list \
i4 / 3 leaf 1 103 905 7782 \
i4 /000+000000 9 overflow 0 1020 0 0 \
@ -132,7 +138,8 @@ do_execsql_test stat-3.1 {
do_execsql_test stat-4.1 {
CREATE TABLE t5(x);
CREATE INDEX i5 ON t5(x);
SELECT * FROM stat WHERE name = 't5' OR name = 'i5';
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat WHERE name = 't5' OR name = 'i5';
} [list \
i5 / 5 leaf 0 0 1016 0 \
t5 / 4 leaf 0 0 1016 0 \
@ -149,7 +156,8 @@ do_execsql_test stat-5.1 {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(zeroblob(1513));
INSERT INTO t1 VALUES(zeroblob(1514));
SELECT * FROM stat WHERE name = 't1';
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat WHERE name = 't1';
} [list \
t1 / 2 leaf 2 993 5 1517 \
t1 /000+000000 3 overflow 0 1020 0 0 \