Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | In the "pgidx" report from "showdb", also show the number of rows on each database btree page. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2bda9dc41c07092ae37d0c6001c1271e |
User & Date: | drh 2019-04-17 13:23:28 |
Context
2019-04-17
| ||
13:58 | Fix a typo in the CLI help output for the ".dump" command. check-in: 57638248 user: drh tags: trunk | |
13:23 | In the "pgidx" report from "showdb", also show the number of rows on each database btree page. check-in: 2bda9dc4 user: drh tags: trunk | |
12:29 | In the "pgidx" command of the showdb utility, try to identify orphaned pages and show when pages have been zeroed out. check-in: eed701ef user: drh tags: trunk | |
Changes
Changes to tool/showdb.c.
857 857 const char *zName /* Name of the table */ 858 858 ){ 859 859 unsigned char *a; 860 860 const char *zType = "corrupt node"; 861 861 int nCell; 862 862 int i; 863 863 int hdr = pgno==1 ? 100 : 0; 864 + char zEntry[30]; 864 865 865 866 if( pgno<=0 || pgno>g.mxPage ) return; 866 867 a = fileRead((pgno-1)*g.pagesize, g.pagesize); 867 868 switch( a[hdr] ){ 868 869 case 0: { 869 870 if( allZero(a, g.pagesize) ){ 870 871 zType = "zeroed page"; ................................................................................ 880 881 case 10: zType = "leaf of index"; break; 881 882 case 13: zType = "leaf of table"; break; 882 883 default: { 883 884 if( parent<0 ) return; 884 885 zType = "corrupt node"; 885 886 } 886 887 } 888 + nCell = a[hdr+3]*256 + a[hdr+4]; 889 + if( nCell==1 ){ 890 + sqlite3_snprintf(sizeof(zEntry),zEntry,"1 row"); 891 + }else{ 892 + sqlite3_snprintf(sizeof(zEntry),zEntry,"%d rows", nCell); 893 + } 887 894 if( parent>0 ){ 888 - page_usage_msg(pgno, "%s [%s], child %d of page %d", 889 - zType, zName, idx, parent); 895 + page_usage_msg(pgno, "%s [%s], child %d of page %d, %s", 896 + zType, zName, idx, parent, zEntry); 890 897 }else if( parent==0 ){ 891 - page_usage_msg(pgno, "root %s [%s]", zType, zName); 898 + page_usage_msg(pgno, "root %s [%s], %s", zType, zName, zEntry); 892 899 }else{ 893 - page_usage_msg(pgno, "orphaned %s", zType); 900 + page_usage_msg(pgno, "orphaned %s, %s", zType, zEntry); 894 901 } 895 - nCell = a[hdr+3]*256 + a[hdr+4]; 896 902 if( a[hdr]==2 || a[hdr]==5 ){ 897 903 int cellstart = hdr+12; 898 904 unsigned int child; 899 905 for(i=0; i<nCell; i++){ 900 906 int ofst; 901 907 902 908 ofst = cellstart + i*2;