Documentation Source Text

Check-in [d33510f222]
Login

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

Overview
Comment:Updates to the dbstat documentation to explain how it can be used to get information about attached databases other than "main".
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d33510f2220005cbf23de5f1c1d0c3a79b511c99
User & Date: drh 2015-05-11 17:09:58
Context
2015-05-15
14:53
Link from the ATTACH documentation page to the DETACH page. Increased information about TH3. These are cherry-picks from trunk. check-in: 643e08dfb8 user: drh tags: branch-3.8.10
2015-05-11
19:12
Update fts3.html with a description of the matchinfo 'b' option. check-in: 2dad241898 user: dan tags: trunk
17:09
Updates to the dbstat documentation to explain how it can be used to get information about attached databases other than "main". check-in: d33510f222 user: drh tags: trunk
16:03
Fix a typo on the mostdeployed.html page. check-in: 7da9280ceb user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pages/dbstat.in.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28





29
30
31
32
33
34
35
..
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<title>The DBSTAT Virtual Table</title>
<tcl>hd_keywords dbstat {dbstat virtual table}</tcl>
<h2>The DBSTAT Virtual Table</h2>

<p>
The <b>dbstat</b> virtual table is available on all 
[database connections] when SQLite is built using the
[SQLITE_ENABLE_DBSTAT_VTAB] compile-time option.
The dbstat virtual table provides low-level information 
about btree and overflow pages in the main database file.
The dbstat virtual table itself can exist in any database
(TEMP is recommended) but it always provides information
about only the main database.

<p>
The recommanded way to create an instance of the dbstat
virtual table is as follows:

<blockquote><pre>
CREATE VIRTUAL TABLE temp.stat USING dbstat;
</pre></blockquote>

<p>
Note the "temp." qualifier before the virtual table name ("stat").  This
qualifier causes the virtual table to be temporary - to only exist for
the duration of the current database connection.  This is the
recommended approach.






<p>
The schema for the dbstat virtual table is this:
<blockquote><pre>
CREATE TABLE dbstat(
  name       STRING,     -- Name of table or index
  path       INTEGER,    -- Path to page from root
  pageno     INTEGER,    -- Page number
................................................................................
  pgoffset   INTEGER,    -- Offset of page in file
  pgsize     INTEGER     -- Size of the page
);
</pre></blockquote>

<p>
There is a single row of the dbstat table for each page in the
main database file.  Freelist pages, the lock page, and
pointer-map pages of the database file do not appear in the
dbstat virtual table.

<h3>The "path" column of the dbstat virtual table</h3>

<p>
The "path" column describes the path taken from the 





|


|
|
|
|
<






|








>
>
>
>
>







 







|







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<title>The DBSTAT Virtual Table</title>
<tcl>hd_keywords dbstat {dbstat virtual table}</tcl>
<h2>The DBSTAT Virtual Table</h2>

<p>
^The <b>dbstat</b> virtual table is available on all 
[database connections] when SQLite is built using the
[SQLITE_ENABLE_DBSTAT_VTAB] compile-time option.
^The dbstat virtual table provides low-level information 
about btree and overflow pages in a database file.
^The dbstat virtual table itself can be create as a TEMP
table while providing information about the main database.


<p>
The recommanded way to create an instance of the dbstat
virtual table is as follows:

<blockquote><pre>
CREATE VIRTUAL TABLE temp.stat USING dbstat(main);
</pre></blockquote>

<p>
Note the "temp." qualifier before the virtual table name ("stat").  This
qualifier causes the virtual table to be temporary - to only exist for
the duration of the current database connection.  This is the
recommended approach.

<p>
The "main" argument to dbstat is the named of the attached database
for which information is to be provided.  The default is "main", and
so the use of "main" in the example above is redundant.

<p>
The schema for the dbstat virtual table is this:
<blockquote><pre>
CREATE TABLE dbstat(
  name       STRING,     -- Name of table or index
  path       INTEGER,    -- Path to page from root
  pageno     INTEGER,    -- Page number
................................................................................
  pgoffset   INTEGER,    -- Offset of page in file
  pgsize     INTEGER     -- Size of the page
);
</pre></blockquote>

<p>
There is a single row of the dbstat table for each page in the
database file.  Freelist pages, the lock page, and
pointer-map pages of the database file do not appear in the
dbstat virtual table.

<h3>The "path" column of the dbstat virtual table</h3>

<p>
The "path" column describes the path taken from the