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

Update sqlite3_analyzer to report on the number of WITHOUT ROWID tables and

to provide separate aggregate statistics for WITHOUT and WITH ROWID tables.

FossilOrigin-Name: 4152894433c3a292d983b1c196664a0c46e406eccd7e644a64fa443fdb204825
This commit is contained in:
drh
2024-06-18 12:19:13 +00:00
parent e9540e2881
commit 99623a83aa
3 changed files with 18 additions and 8 deletions

View File

@ -596,6 +596,7 @@ set nindex [db eval {SELECT count(*) FROM sqlite_schema WHERE type='index'}]
set sql {SELECT count(*) FROM sqlite_schema WHERE name LIKE 'sqlite_autoindex%'}
set nautoindex [db eval $sql]
set nmanindex [expr {$nindex-$nautoindex}]
set nwithoutrowid [db eval {SELECT count(*) FROM pragma_table_list WHERE wr}]
# set total_payload [mem eval "SELECT sum(payload) FROM space_used"]
set user_payload [mem one {SELECT int(sum(payload)) FROM space_used
@ -614,6 +615,7 @@ statline {Pages on the freelist (per header)} $free_pgcnt2 $free_percent2
statline {Pages on the freelist (calculated)} $free_pgcnt $free_percent
statline {Pages of auto-vacuum overhead} $av_pgcnt $av_percent
statline {Number of tables in the database} $ntable
statline {Number of WITHOUT ROWID tables} $nwithoutrowid
statline {Number of indices} $nindex
statline {Number of defined indices} $nmanindex
statline {Number of implied indices} $nautoindex
@ -672,6 +674,14 @@ if {$nindex>0} {
subreport {All tables and indices} 1 0
}
subreport {All tables} {NOT is_index} 0
if {$nwithoutrowid>0} {
subreport {All WITHOUT ROWID tables} {is_without_rowid} 0
set nrowidtab [db eval {SELECT count(*) FROM pragma_table_list
WHERE type='table' AND NOT wr}]
if {$nrowidtab>0} {
subreport {ALL rowid tables} {NOT is_without_rowid AND NOT is_index} 0
}
}
if {$nindex>0} {
subreport {All indices} {is_index} 0
}