SQLite

Check-in [3a261f383f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Minor tweaks to the TCL code for sqlite3_analyzer.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3a261f383f11d839d3a23d454b4422298bef9c88
User & Date: drh 2011-09-21 20:10:42.584
Context
2011-09-22
00:06
Integrate build changes for sqlite3_analyzer into the MSVC makefile. Also, more cleanup of build files, including sqlite3_analyzer, for all makefiles. (check-in: af1c571829 user: mistachkin tags: trunk)
2011-09-21
20:10
Minor tweaks to the TCL code for sqlite3_analyzer. (check-in: 3a261f383f user: drh tags: trunk)
18:29
Remove unnecessary dependencies from the sqlite3_analyzer targets in makefiles. (check-in: 0bd8fd352d user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to tool/spaceanal.tcl.
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

# Open the database
#
sqlite3 db $file_to_analyze
register_dbstat_vtab db

set pageSize [db one {PRAGMA page_size}]

#set DB [btree_open $file_to_analyze 1000 0]

# In-memory database for collecting statistics. This script loops through
# the tables and indices in the database being analyzed, adding a row for each
# to an in-memory database (for which the schema is shown below). It then
# queries the in-memory db to produce the space-analysis report.
#
sqlite3 mem :memory:







|
<







31
32
33
34
35
36
37
38

39
40
41
42
43
44
45

# Open the database
#
sqlite3 db $file_to_analyze
register_dbstat_vtab db

set pageSize [db one {PRAGMA page_size}]
db eval {SELECT count(*) FROM sqlite_master}


# In-memory database for collecting statistics. This script loops through
# the tables and indices in the database being analyzed, adding a row for each
# to an in-memory database (for which the schema is shown below). It then
# queries the in-memory db to produce the space-analysis report.
#
sqlite3 mem :memory:
62
63
64
65
66
67
68
69
70
71

72
73
74
75
76
77
78
79
80
   ovfl_unused int,  -- Number of unused bytes on overflow pages
   gap_cnt int       -- Number of gaps in the page layout
);}
mem eval $tabledef

# Create a temporary "dbstat" virtual table.
#
db eval { 
  CREATE VIRTUAL TABLE temp.stat USING dbstat;
  CREATE TEMP TABLE dbstat AS SELECT * FROM temp.stat ORDER BY name, path;

  DROP TABLE temp.stat;
}

proc isleaf {pagetype is_index} {
  return [expr {$pagetype == "leaf" || ($pagetype == "internal" && $is_index)}]
}
proc isoverflow {pagetype is_index} {
  return [expr {$pagetype == "overflow"}]
}







<
|
|
>
|
<







61
62
63
64
65
66
67

68
69
70
71

72
73
74
75
76
77
78
   ovfl_unused int,  -- Number of unused bytes on overflow pages
   gap_cnt int       -- Number of gaps in the page layout
);}
mem eval $tabledef

# Create a temporary "dbstat" virtual table.
#

db eval {CREATE VIRTUAL TABLE temp.stat USING dbstat}
db eval {CREATE TEMP TABLE dbstat AS SELECT * FROM temp.stat
         ORDER BY name, path}
db eval {DROP TABLE temp.stat}


proc isleaf {pagetype is_index} {
  return [expr {$pagetype == "leaf" || ($pagetype == "internal" && $is_index)}]
}
proc isoverflow {pagetype is_index} {
  return [expr {$pagetype == "overflow"}]
}