From: drh Date: Wed, 17 Apr 2019 13:23:28 +0000 (+0000) Subject: In the "pgidx" report from "showdb", also show the number of rows on each X-Git-Tag: version-3.29.0~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25f933ad93e5990cf5b02fb5447790b027273710;p=thirdparty%2Fsqlite.git In the "pgidx" report from "showdb", also show the number of rows on each database btree page. FossilOrigin-Name: 2bda9dc41c07092ae37d0c6001c1271e0622bfff7151201fc2bb4c95422c087b --- diff --git a/manifest b/manifest index bae2f7cb9c..b0c452f0bf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\s"pgidx"\scommand\sof\sthe\sshowdb\sutility,\stry\sto\sidentify\sorphaned\spages\nand\sshow\swhen\spages\shave\sbeen\szeroed\sout. -D 2019-04-17T12:29:45.915 +C In\sthe\s"pgidx"\sreport\sfrom\s"showdb",\salso\sshow\sthe\snumber\sof\srows\son\seach\ndatabase\sbtree\spage. +D 2019-04-17T13:23:28.341 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1768,7 +1768,7 @@ F tool/replace.tcl 60f91e8dd06ab81f74d213ecbd9c9945f32ac048 F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 F tool/run-speed-test.sh f95d19fd669b68c4c38b6b475242841d47c66076 -F tool/showdb.c b4cd49d8f4df86349a6b41993a3eb5651e18a3f9903b4fbb70d18b66c8a358ca +F tool/showdb.c 97d14a1ce32d5edda84081a5c939bd8975abd89568a773b288940e67e4c7e3ad F tool/showjournal.c 5bad7ae8784a43d2b270d953060423b8bd480818 F tool/showlocks.c 9920bcc64f58378ff1118caead34147201f48c68 F tool/showshm.c a0ab6ec32dd1f11218ca2a4018f8fb875b59414801ab8ceed8b2e69b7b45a809 @@ -1818,7 +1818,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 5df2bf62fcd4dfdaa195062dddbd5ce5420bc239b2649ac8f547e0db34e7f0bb -R f4eb9f2a8e78f2d407da5d6c15776852 +P eed701ef919c70d891727250be6a1b626aeb894c562d221e319ae6d74fc71d3d +R cec164e033a6cbc58045abf1be62db04 U drh -Z 369a3d8533a731558ce8e524f18f4b7d +Z 343bb3a0f539a2adef3662c41f5a7ef0 diff --git a/manifest.uuid b/manifest.uuid index 9dae86999e..0138e20713 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -eed701ef919c70d891727250be6a1b626aeb894c562d221e319ae6d74fc71d3d \ No newline at end of file +2bda9dc41c07092ae37d0c6001c1271e0622bfff7151201fc2bb4c95422c087b \ No newline at end of file diff --git a/tool/showdb.c b/tool/showdb.c index a3301392ab..a28656b3ea 100644 --- a/tool/showdb.c +++ b/tool/showdb.c @@ -861,6 +861,7 @@ static void page_usage_btree( int nCell; int i; int hdr = pgno==1 ? 100 : 0; + char zEntry[30]; if( pgno<=0 || pgno>g.mxPage ) return; a = fileRead((pgno-1)*g.pagesize, g.pagesize); @@ -884,15 +885,20 @@ static void page_usage_btree( zType = "corrupt node"; } } + nCell = a[hdr+3]*256 + a[hdr+4]; + if( nCell==1 ){ + sqlite3_snprintf(sizeof(zEntry),zEntry,"1 row"); + }else{ + sqlite3_snprintf(sizeof(zEntry),zEntry,"%d rows", nCell); + } if( parent>0 ){ - page_usage_msg(pgno, "%s [%s], child %d of page %d", - zType, zName, idx, parent); + page_usage_msg(pgno, "%s [%s], child %d of page %d, %s", + zType, zName, idx, parent, zEntry); }else if( parent==0 ){ - page_usage_msg(pgno, "root %s [%s]", zType, zName); + page_usage_msg(pgno, "root %s [%s], %s", zType, zName, zEntry); }else{ - page_usage_msg(pgno, "orphaned %s", zType); + page_usage_msg(pgno, "orphaned %s, %s", zType, zEntry); } - nCell = a[hdr+3]*256 + a[hdr+4]; if( a[hdr]==2 || a[hdr]==5 ){ int cellstart = hdr+12; unsigned int child;