]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Enhance the sqlite3_analyzer.exe utility so that it computes and shows the
authordrh <drh@noemail.net>
Thu, 15 Jun 2017 00:52:03 +0000 (00:52 +0000)
committerdrh <drh@noemail.net>
Thu, 15 Jun 2017 00:52:03 +0000 (00:52 +0000)
number of bytes of metadata on btree pages and per table and index entry.

FossilOrigin-Name: 43ad41efa9e1fdd79a9804197a227491236495f14ed56c656224d6ce181703c1

manifest
manifest.uuid
tool/spaceanal.tcl

index 8d1aada1f45d2ed01bf7d61428bf91c6907a8c87..0c507aca093170a973957e7a92c19c1e50567958 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\ssqlite3rbu_close()\sso\sthat\sthe\spzErrmsg\sparameter\smay\sbe\spassed\sNULL.
-D 2017-06-13T16:52:34.629
+C Enhance\sthe\ssqlite3_analyzer.exe\sutility\sso\sthat\sit\scomputes\sand\sshows\sthe\nnumber\sof\sbytes\sof\smetadata\son\sbtree\spages\sand\sper\stable\sand\sindex\sentry.
+D 2017-06-15T00:52:03.263
 F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
@@ -1541,7 +1541,7 @@ F tool/showlocks.c 9920bcc64f58378ff1118caead34147201f48c68
 F tool/showstat4.c b14159aa062f661b394ba37b6b7b94bfb8012ab9
 F tool/showwal.c ad9d768f96ca6199ad3a8c9562d679680bd032dd01204ea3e5ea6fb931d81847
 F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe
-F tool/spaceanal.tcl ab7d9bf68062907282a64b3e12ccbfad47193c5a
+F tool/spaceanal.tcl a91e09e9e3dd10e67ffe4a01155161fb5e6b6d399002716593780493452c4b28
 F tool/speed-check.sh 9630ba0468b609c52f48309243d4eb6e9c34deda
 F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
 F tool/speedtest16.c ecb6542862151c3e6509bbc00509b234562ae81e
@@ -1582,7 +1582,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 35b34bdf0843b49be39e13ed212e918c2d45afdb8374b5cd02ba6d2d5b16b3b9
-R 58bee221956dd673cf4d01eef24c120c
-U dan
-Z 30654fd7d5ea417a1e606ee3f07ebb27
+P c433672dd8ab625628bde2f4f40a2dc000ed915dbe91833d3f753d8ab51baf25
+R 3118b76870f7c5e12e646d6dc51a9560
+U drh
+Z 30d19856ae4fa68d439f06a24db9ac5d
index 02ab3583d2549982f74117ae69fdd5470176b72a..a8b314a01d95155a3a857d2207f82f8b9a5d93f8 100644 (file)
@@ -1 +1 @@
-c433672dd8ab625628bde2f4f40a2dc000ed915dbe91833d3f753d8ab51baf25
\ No newline at end of file
+43ad41efa9e1fdd79a9804197a227491236495f14ed56c656224d6ce181703c1
\ No newline at end of file
index e7ce846f865b780d57dc79502674f9e45a289ce7..0309e5f2f4a736fb5551473ba97229aceda84df0 100644 (file)
@@ -424,6 +424,7 @@ proc subreport {title where showFrag} {
   # avg_payload: Average payload per btree entry.
   # avg_fanout: Average fanout for internal pages.
   # avg_unused: Average unused bytes per btree entry.
+  # avg_meta: Average metadata overhead per entry.
   # ovfl_cnt_percent: Percentage of btree entries that use overflow pages.
   #
   set total_pages [expr {$leaf_pages+$int_pages+$ovfl_pages}]
@@ -433,6 +434,10 @@ proc subreport {title where showFrag} {
   set total_unused [expr {$ovfl_unused+$int_unused+$leaf_unused}]
   set avg_payload [divide $payload $nentry]
   set avg_unused [divide $total_unused $nentry]
+  set total_meta [expr {$storage - $payload - $total_unused}]
+  set total_meta [expr {$total_meta + 4*($ovfl_pages - $ovfl_cnt)}]
+  set meta_percent [percent $total_meta $storage {of metadata}]
+  set avg_meta [divide $total_meta $nentry]
   if {$int_pages>0} {
     # TODO: Is this formula correct?
     set nTab [mem eval "
@@ -460,9 +465,11 @@ proc subreport {title where showFrag} {
     statline {Bytes used after compression} $compressed_size $pct
   }
   statline {Bytes of payload} $payload $payload_percent
+  statline {Bytes of metadata} $total_meta $meta_percent
   if {$cnt==1} {statline {B-tree depth} $depth}
   statline {Average payload per entry} $avg_payload
   statline {Average unused bytes per entry} $avg_unused
+  statline {Average metadata per entry} $avg_meta
   if {[info exists avg_fanout]} {
     statline {Average fanout} $avg_fanout
   }
@@ -757,6 +764,15 @@ Bytes of payload
     at the right is the bytes of payload divided by the bytes of storage 
     consumed.
 
+Bytes of metadata
+
+    The amount of formatting and structural information stored on for the
+    table or index.  Metadata includes the btree page header, the cell pointer
+    array, the size field for each cell, the left child pointer or non-leaf
+    cells, the overflow pointers for overflow cells, and the rowid value for
+    rowid table cells.  In other words, metadata is everything that is not
+    unused space and that is not content.
+
 Average payload per entry
 
     The average amount of payload on each entry.  This is just the bytes of