Documentation Source Text

Changes On Branch branch-3.10
Login

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

Changes In Branch branch-3.10 Excluding Merge-Ins

This is equivalent to a diff from a44bb18833 to 4802ce4c0a

2016-02-12
05:18
Merge changes from the 3.10 branch. (check-in: 09a0fd52d7 user: drh tags: trunk)
05:17
Change "Universal App Platform" to "Universal Windows Platform". (Leaf check-in: 4802ce4c0a user: drh tags: branch-3.10)
2016-02-10
13:38
Add the snapshot tarball to the list of possible download files. (check-in: 6af983fad9 user: drh tags: branch-3.10)
2016-01-12
13:44
Fix typos in the TCL interface documentation. (check-in: 217ea4895f user: drh tags: branch-3.10)
2016-01-11
13:00
Begin entering 3.11.0 changes. (check-in: 166fc2da3a user: drh tags: trunk)
2016-01-06
16:09
Fix an error regarding operator precedence in fts5.html. (check-in: a44bb18833 user: dan tags: trunk)
12:23
Update download.in to look for products with version numbers starting with "31" instead of "30". (check-in: 55ba3b7506 user: dan tags: trunk)

Changes to pages/changes.in.

15
16
17
18
19
20
21



























22
23
24
25
26
27
28
<tcl>
set nChng 0
proc chng {date desc {options {}}} {
  global nChng aChng
  set aChng($nChng) [list $date $desc $options]
  incr nChng
}




























chng {2016-01-06 (3.10.0)} {
<p><b>General improvements:</b>
<li>Added support for [LIKE], [GLOB], and [REGEXP] operators on [virtual tables].
<li>Added the [colUsed field] to [sqlite3_index_info] for use by
    the [sqlite3_module.xBestIndex] method.
<li>Enhance the [PRAGMA cache_spill] statement to accept a 32-bit integer







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<tcl>
set nChng 0
proc chng {date desc {options {}}} {
  global nChng aChng
  set aChng($nChng) [list $date $desc $options]
  incr nChng
}

chng {2016-01-20 (3.10.2)} {
<p><b>Critical bug fix:</b>
<li>Version 3.10.0 introduced a case-folding bug in the [LIKE] operator which is fixed
    by this patch release.  Ticket 
    [https://www.sqlite.org/src/info/80369eddd5c94 | 80369eddd5c94].
<p><b>Other miscellaneous bug fixes:</b>
<li>Fix a use-after-free that can occur when SQLite is compiled with -DSQLITE_HAS_CODEC.
<li>Fix the build so that it works with -DSQLITE_OMIT_WAL.
<li>Fix the configure script for the amalgamation so that the --readline option works again
    on Raspberry PIs.
<p><b>Hashes:</b>
<li>SQLITE_SOURCE_ID: "2016-01-20 15:27:19 17efb4209f97fb4971656086b138599a91a75ff9"
<li>SHA1 for sqlite3.c: f7088b19d97cd7a1c805ee95c696abd54f01de4f
} {patchagainst 1 patchagainst 2}

chng {2016-01-14 (3.10.1)} {
<p><b>New feature:</b>
<li>Add the [SQLITE_FCNTL_JOURNAL_POINTER] file control.
<p><b>Bug fix:</b>
<li>Fix a 16-month-old bug in the query planner that could generate incorrect results
    when a scalar subquery attempts to use the [block sorting] optimization.  Ticket
    [https://www.sqlite.org/src/info/cb3aa0641d9a4|cb3aa0641d9a4].
<p><b>Hashes:</b>
<li>SQLITE_SOURCE_ID: "2016-01-13 21:41:56 254419c36766225ca542ae873ed38255e3fb8588"
<li>SHA1 for sqlite3.c: 1398ba8e4043550a533cdd0834bfdad1c9eab0f4
} {patchagainst 1}

chng {2016-01-06 (3.10.0)} {
<p><b>General improvements:</b>
<li>Added support for [LIKE], [GLOB], and [REGEXP] operators on [virtual tables].
<li>Added the [colUsed field] to [sqlite3_index_info] for use by
    the [sqlite3_module.xBestIndex] method.
<li>Enhance the [PRAGMA cache_spill] statement to accept a 32-bit integer

Changes to pages/download.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
<title>SQLite Download Page</title>

<h2>SQLite Download Page</h2>
<table width="100%" cellpadding="5" cellspacing="0">

<tcl>
hd_keywords {download page}
set nDownload 0
set BG {}
unset -nocomplain href
unset -nocomplain href_cnt
set href_cnt 0

proc Product {pattern desc {frag {}}} {

  regsub VVV $pattern {*} p3
  regsub DATE $p3 {20*} p3
  regsub YEAR $p3 {20[134][0-9]} p3
  regsub VVV $pattern {(3\d{6})} pattern
  regsub DATE $pattern {(\d{12})} pattern
  regsub YEAR $pattern {\d{4}} pattern
  set p2 [string map {* .*} $pattern]
  set flist [glob -nocomplain $p3]
  foreach file [lsort -dict $flist] {
    if {![regexp ^$p2\$ $file all version]} continue
    if {[regexp {^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$} $version \
           all year month day hour min]} {












>
|
>


|

|







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
<title>SQLite Download Page</title>

<h2>SQLite Download Page</h2>
<table width="100%" cellpadding="5" cellspacing="0">

<tcl>
hd_keywords {download page}
set nDownload 0
set BG {}
unset -nocomplain href
unset -nocomplain href_cnt
set href_cnt 0
set disable_more 0
proc Product {pattern desc {frag {}} {disable_flag 0}} {
  if {$::disable_more} return
  regsub VVV $pattern {*} p3
  regsub DATE $p3 {20*} p3
  regsub YEAR $p3 {20[1234][0-9]} p3
  regsub VVV $pattern {(3\d{6})} pattern
  regsub DATE $pattern {(\d{12,17})} pattern
  regsub YEAR $pattern {\d{4}} pattern
  set p2 [string map {* .*} $pattern]
  set flist [glob -nocomplain $p3]
  foreach file [lsort -dict $flist] {
    if {![regexp ^$p2\$ $file all version]} continue
    if {[regexp {^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$} $version \
           all year month day hour min]} {
72
73
74
75
76
77
78



79
80
81
82
83
84
85
86
87
88
89

90
91
92
93
94
95
96
97




98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117



118
119
120
121
122
123
124
    hd_puts "<a id='a$href_cnt' href='hp1.html'>[file tail $file]</a><br>($size $units)</td>\n"
    hd_puts "<td width=\"5\"></td>"
    regsub -all VERSION $desc $version d2
    hd_puts "\n<td valign=\"top\">"
    hd_resolve [string trim $d2]
    hd_puts "<br>(sha1: $sha1sum)</td></tr>\n"
    incr ::nDownload



  }
  if {$frag!=""} {
    eval hd_keywords [lrange $frag 1 end]
  }
}
cd $::DEST

proc Heading {title {tag {}} {bgcolor {}}} {
  set ::pending_heading $title
  set ::pending_tag $tag
  set ::BG $bgcolor

  # hd_puts "<tr><td colspan=4><big><b>$title</b></big></td></tr>"
}

set Caution #fff1c8

Heading {Pre-release Snapshots} {} $Caution






Product {snapshot/sqlite-amalgamation-DATE.zip} {
  The [amalgamation]: complete source code a single "sqlite3.c" file.
}
#  The [amalgamation] as of VERSION.
#  See the <a href="http://www.sqlite.org/draft/releaselog/current.html">pending
#  change log</a> for details.
Product {snapshot/sqlite-amalgamation32k-DATE.zip} {
  The [amalgamation] split into 6 separate source files each with less
  than 32767 lines of code.
}
#  See the <a href="http://www.sqlite.org/draft/releaselog/current.html">pending
#  change log</a> for details.
#Product {snapshot/sqlite-tea-DATE.zip} {
#  This is a snapshot (as of VERSION) of the current SQLite code under 
#  development, packaged and ready to build using the
#  <a href="http://www.tcl-lang.org/doc/tea/">Tcl Extension Architecture (TEA)</a>.
#  Use this snapshot for testing only.  This is not a release.
#}
Product {snapshot/sqlite-uap-DATE.vsix} {
  VSIX package for Universal App Platform development using Visual Studio 2015 CTP.



}

Heading {Pre-release Windows DLLs} {} $Caution

Product snapshot/sqlite-dll-win32-x86-DATE.zip {
  A 32-bit Windows DLL as of VERSION.
  See the







>
>
>











>








>
>
>
>



















|
>
>
>







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
    hd_puts "<a id='a$href_cnt' href='hp1.html'>[file tail $file]</a><br>($size $units)</td>\n"
    hd_puts "<td width=\"5\"></td>"
    regsub -all VERSION $desc $version d2
    hd_puts "\n<td valign=\"top\">"
    hd_resolve [string trim $d2]
    hd_puts "<br>(sha1: $sha1sum)</td></tr>\n"
    incr ::nDownload
    if {$disable_flag} {
      set ::disable_more 1
    }
  }
  if {$frag!=""} {
    eval hd_keywords [lrange $frag 1 end]
  }
}
cd $::DEST

proc Heading {title {tag {}} {bgcolor {}}} {
  set ::pending_heading $title
  set ::pending_tag $tag
  set ::BG $bgcolor
  set ::disable_more 0
  # hd_puts "<tr><td colspan=4><big><b>$title</b></big></td></tr>"
}

set Caution #fff1c8

Heading {Pre-release Snapshots} {} $Caution


Product {snapshot/sqlite-snapshot-DATE.tar.gz} {
  The [amalgamation] source code, the [command-line shell] source code,
  configure/make scripts for unix, and a Makefile.msc for Windows.
}
Product {snapshot/sqlite-amalgamation-DATE.zip} {
  The [amalgamation]: complete source code a single "sqlite3.c" file.
}
#  The [amalgamation] as of VERSION.
#  See the <a href="http://www.sqlite.org/draft/releaselog/current.html">pending
#  change log</a> for details.
Product {snapshot/sqlite-amalgamation32k-DATE.zip} {
  The [amalgamation] split into 6 separate source files each with less
  than 32767 lines of code.
}
#  See the <a href="http://www.sqlite.org/draft/releaselog/current.html">pending
#  change log</a> for details.
#Product {snapshot/sqlite-tea-DATE.zip} {
#  This is a snapshot (as of VERSION) of the current SQLite code under 
#  development, packaged and ready to build using the
#  <a href="http://www.tcl-lang.org/doc/tea/">Tcl Extension Architecture (TEA)</a>.
#  Use this snapshot for testing only.  This is not a release.
#}
Product {snapshot/sqlite-uap-DATE.vsix} {
  VSIX package for Universal Windows Platform development using Visual Studio 2015 CTP.
}
Product {snapshot/sqlite-uwp-DATE.vsix} {
  VSIX package for Universal Windows Platform development using Visual Studio 2015 CTP.
}

Heading {Pre-release Windows DLLs} {} $Caution

Product snapshot/sqlite-dll-win32-x86-DATE.zip {
  A 32-bit Windows DLL as of VERSION.
  See the
178
179
180
181
182
183
184







185
186
187
188
189
190
191
192
193
194
195
196
197
198
199






200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228










229
230
231
232
233
234
235
236
237
238
239
240
241
242
243



244
245
246
247
248
249
250

Product {YEAR/sqlite-doc-VVV.zip} {
  Documentation as a bundle of static HTML files.
}

Heading {Precompiled Binaries for Linux} linux








Product YEAR/sqlite-shell-linux-x86-VVV.zip {
  The [command-line shell] program (version VERSION).
}

Product YEAR/sqlite-analyzer-linux-x86-VVV.zip {
  A program to analyze how space is allocated inside an SQLite database
  file (version VERSION).
}

Product YEAR/sqldiff-linux-x86-VVV.zip {
  A program to display differences between two SQLite database files.
  (version VERSION).
}

Heading {Precompiled Binaries for Mac OS X (x86)} mac







Product YEAR/sqlite-shell-osx-x86-VVV.zip {
  The [command-line shell] program (version VERSION).
}

Product YEAR/sqlite-analyzer-osx-x86-VVV.zip {
  A program to analyze how space is allocated inside an SQLite database
  file (version VERSION).
}

Product YEAR/sqldiff-osx-x86-VVV.zip {
  A program to display differences between two SQLite database files.
  (version VERSION).
}

Heading {Precompiled Binaries for Windows} win32

set start $nDownload
Product YEAR/sqlite-shell-win32-x86-VVV.zip {
  The [command-line shell] program (version VERSION).
}

Product YEAR/sqlite-dll-win32-x86-VVV.zip {
  32-bit DLL (x86) for SQLite verison VERSION.
}

Product YEAR/sqlite-dll-win64-x64-VVV.zip {
  64-bit DLL (x64) for SQLite version VERSION.
}











Product YEAR/sqlite-analyzer-win32-x86-VVV.zip {
  A program to analyze how space is allocated inside an SQLite database
  file (version VERSION).
}

Product YEAR/sqldiff-win32-x86-VVV.zip {
  A program to display differences between two SQLite database files.
  (version VERSION).
}

Heading {Universal App Platform}

Product YEAR/sqlite-uap-VVV.vsix {
  VSIX package for Universal App Platform development using Visual Studio 2015.



}

Heading {Precompiled Binaries for Windows Phone 8} wp8


Product YEAR/sqlite-wp80-winrt-VVV.vsix {
  A complete VSIX package with an extension SDK and all other components







>
>
>
>
>
>
>















>
>
>
>
>
>


















<
<
<








>
>
>
>
>
>
>
>
>
>











|


|
>
>
>







191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286

Product {YEAR/sqlite-doc-VVV.zip} {
  Documentation as a bundle of static HTML files.
}

Heading {Precompiled Binaries for Linux} linux


Product YEAR/sqlite-tools-linux-x86-VVV.zip {
  A bundle of command-line tools for managing SQLite database files,
  including the [command-line shell] program, the [sqldiff] program, and
  the [sqlite3_analyzer] program.
} {} 1

Product YEAR/sqlite-shell-linux-x86-VVV.zip {
  The [command-line shell] program (version VERSION).
}

Product YEAR/sqlite-analyzer-linux-x86-VVV.zip {
  A program to analyze how space is allocated inside an SQLite database
  file (version VERSION).
}

Product YEAR/sqldiff-linux-x86-VVV.zip {
  A program to display differences between two SQLite database files.
  (version VERSION).
}

Heading {Precompiled Binaries for Mac OS X (x86)} mac

Product YEAR/sqlite-tools-osx-x86-VVV.zip {
  A bundle of command-line tools for managing SQLite database files,
  including the [command-line shell] program, the [sqldiff] program, and
  the [sqlite3_analyzer] program.
} {} 1

Product YEAR/sqlite-shell-osx-x86-VVV.zip {
  The [command-line shell] program (version VERSION).
}

Product YEAR/sqlite-analyzer-osx-x86-VVV.zip {
  A program to analyze how space is allocated inside an SQLite database
  file (version VERSION).
}

Product YEAR/sqldiff-osx-x86-VVV.zip {
  A program to display differences between two SQLite database files.
  (version VERSION).
}

Heading {Precompiled Binaries for Windows} win32

set start $nDownload




Product YEAR/sqlite-dll-win32-x86-VVV.zip {
  32-bit DLL (x86) for SQLite verison VERSION.
}

Product YEAR/sqlite-dll-win64-x64-VVV.zip {
  64-bit DLL (x64) for SQLite version VERSION.
}

Product YEAR/sqlite-tools-win32-x86-VVV.zip {
  A bundle of command-line tools for managing SQLite database files,
  including the [command-line shell] program, the [sqldiff.exe] program, and
  the [sqlite3_analyzer.exe] program.
} {} 1

Product YEAR/sqlite-shell-win32-x86-VVV.zip {
  The [command-line shell] program (version VERSION).
}

Product YEAR/sqlite-analyzer-win32-x86-VVV.zip {
  A program to analyze how space is allocated inside an SQLite database
  file (version VERSION).
}

Product YEAR/sqldiff-win32-x86-VVV.zip {
  A program to display differences between two SQLite database files.
  (version VERSION).
}

Heading {Universal Windows Platform}

Product YEAR/sqlite-uap-VVV.vsix {
  VSIX package for Universal Windows Platform development using Visual Studio 2015.
}
Product YEAR/sqlite-uwp-VVV.vsix {
  VSIX package for Universal Windows Platform development using Visual Studio 2015.
}

Heading {Precompiled Binaries for Windows Phone 8} wp8


Product YEAR/sqlite-wp80-winrt-VVV.vsix {
  A complete VSIX package with an extension SDK and all other components

Changes to pages/fileformat2.in.

496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
that consists of a single page that is both a leaf and the root.
Because there are pointers from parents to children, every page of a
complete b-tree can be located if only the root page is known.  Hence,
b-trees are identified by their root page number.</p>

<p>A b-tree page is either a table b-tree page or an index b-tree page.
All pages within each complete b-tree are of the same type: either table
or index.  There is a one table b-trees in the database file
for each rowid table in the database schema, including system tables
such as sqlite_master.  There is one index b-trees
in the database file for each index in the schema, including implied indexes
created by uniqueness constraints.  There are no b-trees associated with
[virtual tables].  Specific virtual table implementations might make use
of [shadow tables] for storage, but those shadow tables will have separate
entries in the database schema.  [WITHOUT ROWID] tables use index b-trees
rather than a table b-trees, so there is one
index b-tree in the database file for each [WITHOUT ROWID] table.







|

|







496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
that consists of a single page that is both a leaf and the root.
Because there are pointers from parents to children, every page of a
complete b-tree can be located if only the root page is known.  Hence,
b-trees are identified by their root page number.</p>

<p>A b-tree page is either a table b-tree page or an index b-tree page.
All pages within each complete b-tree are of the same type: either table
or index.  There is one table b-trees in the database file
for each rowid table in the database schema, including system tables
such as sqlite_master.  There is one index b-tree
in the database file for each index in the schema, including implied indexes
created by uniqueness constraints.  There are no b-trees associated with
[virtual tables].  Specific virtual table implementations might make use
of [shadow tables] for storage, but those shadow tables will have separate
entries in the database schema.  [WITHOUT ROWID] tables use index b-trees
rather than a table b-trees, so there is one
index b-tree in the database file for each [WITHOUT ROWID] table.
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656

<tcl>hd_fragment varint {variable-length integer} {varint}</tcl>

<p>A variable-length integer or "varint" is a static Huffman encoding
of 64-bit twos-complement integers that uses less space for small positive 
values. 
A varint is between 1 and 9 bytes in length.  The varint consists of either
zero or more byte which have the high-order bit set followed by a single byte
with the high-order bit clear, or nine bytes, whichever is shorter.
The lower seven bits of each of the first eight bytes and all 8 bits of
the ninth byte are used to reconstruct the 64-bit twos-complement integer.
Varints are big-endian: bits taken from the earlier byte of the varint
are the more significant than bits taken from the later bytes. </p>

<p>The format of a cell depends on which kind of b-tree page the cell







|







642
643
644
645
646
647
648
649
650
651
652
653
654
655
656

<tcl>hd_fragment varint {variable-length integer} {varint}</tcl>

<p>A variable-length integer or "varint" is a static Huffman encoding
of 64-bit twos-complement integers that uses less space for small positive 
values. 
A varint is between 1 and 9 bytes in length.  The varint consists of either
zero or more bytes which have the high-order bit set followed by a single byte
with the high-order bit clear, or nine bytes, whichever is shorter.
The lower seven bits of each of the first eight bytes and all 8 bits of
the ninth byte are used to reconstruct the 64-bit twos-complement integer.
Varints are big-endian: bits taken from the earlier byte of the varint
are the more significant than bits taken from the later bytes. </p>

<p>The format of a cell depends on which kind of b-tree page the cell
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
pages.
<li>A 4-byte big-endian integer page number for the first page of the
overflow page list - omitted if all payload fits on the b-tree page.
</ul></p></dd>

<dt><p>Index B-Tree Interior Cell (header 0x02):</p></dt>
<dd><p><ul>
<li>A 4-byte big-endianpage number which is the left child pointer.
<li>A varint which is the total number of bytes of key payload, including any
overflow
<li>The initial portion of the payload that does not spill to overflow
pages.
<li>A 4-byte big-endian integer page number for the first page of the
overflow page list - omitted if all payload fits on the b-tree page.
</ul></p></dd>







|







683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
pages.
<li>A 4-byte big-endian integer page number for the first page of the
overflow page list - omitted if all payload fits on the b-tree page.
</ul></p></dd>

<dt><p>Index B-Tree Interior Cell (header 0x02):</p></dt>
<dd><p><ul>
<li>A 4-byte big-endian page number which is the left child pointer.
<li>A varint which is the total number of bytes of key payload, including any
overflow
<li>The initial portion of the payload that does not spill to overflow
pages.
<li>A 4-byte big-endian integer page number for the first page of the
overflow page list - omitted if all payload fits on the b-tree page.
</ul></p></dd>
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783

<blockquote><dl>
<dt>Table B-Tree Leaf Cell:</dt>
<dd><p>
^If the payload size P is less than or equal to U-35 then
the entire payload is stored on the b-tree leaf page.  
^(Let M be ((U-12)*32/255)-23.  If P is greater than U-35
then the number of byte stored on the b-tree leaf page is the smaller of
M+((P-M)%(U-4)) and U-35.)^
^(Note that number of bytes stored on the leaf page is never less than M.)^
</p></dd>

<dt>Table B-Tree Interior Cell:</dt>
<dd><p>
Interior pages of table b-trees have no payload and so there is never
any payload to spill.
</p></dd>

<dt>Index B-Tree Leaf Or Interior Cell:</dt>
<dd><p>
^(Let X be ((U-12)*64/255)-23).  If the payload size P is less than
or equal to X then the entire payload is stored on the b-tree page.)^
^(Let M be ((U-12)*32/255)-23.  If P is greater than X then the number
of byte stored on the b-tree page is the smaller of
M+((P-M)%(U-4)) and X.)^
^(Note that number of bytes stored on the index page is never less than M.)^
</p></dd>
</dl></blockquote>

<p>The overflow thresholds are designed to give a minimum fanout of
4 for index b-trees and to make sure enough of the payload







|















|







753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783

<blockquote><dl>
<dt>Table B-Tree Leaf Cell:</dt>
<dd><p>
^If the payload size P is less than or equal to U-35 then
the entire payload is stored on the b-tree leaf page.  
^(Let M be ((U-12)*32/255)-23.  If P is greater than U-35
then the number of bytes stored on the b-tree leaf page is the smaller of
M+((P-M)%(U-4)) and U-35.)^
^(Note that number of bytes stored on the leaf page is never less than M.)^
</p></dd>

<dt>Table B-Tree Interior Cell:</dt>
<dd><p>
Interior pages of table b-trees have no payload and so there is never
any payload to spill.
</p></dd>

<dt>Index B-Tree Leaf Or Interior Cell:</dt>
<dd><p>
^(Let X be ((U-12)*64/255)-23).  If the payload size P is less than
or equal to X then the entire payload is stored on the b-tree page.)^
^(Let M be ((U-12)*32/255)-23.  If P is greater than X then the number
of bytes stored on the b-tree page is the smaller of
M+((P-M)%(U-4)) and X.)^
^(Note that number of bytes stored on the index page is never less than M.)^
</p></dd>
</dl></blockquote>

<p>The overflow thresholds are designed to give a minimum fanout of
4 for index b-trees and to make sure enough of the payload
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
<p>^(In a database that uses ptrmap pages, all pages at locations identified
by the computation in the previous paragraph must be ptrmap page and no
other page may be a ptrmap page.  Except, if the byte-lock page happens to
fall on the same page number as a ptrmap page, then the ptrmap is moved
to the following page for that one case.)^</p>

<p>Each 5-byte entry on a ptrmap page provides back-link information about 
one of pages that immediately follow the pointer map.  ^(If page B is a
ptrmap page then back-link information about page B+1 is provided by
the first entry on the pointer map.  Information about page B+2 is
provided by the second entry.  And so forth.)^</p>

<p>Each 5-byte ptrmap entry consists of one byte of "page type" information
followed by a 4-byte big-endian page number.  Five page types are recognized:
</p>







|







825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
<p>^(In a database that uses ptrmap pages, all pages at locations identified
by the computation in the previous paragraph must be ptrmap page and no
other page may be a ptrmap page.  Except, if the byte-lock page happens to
fall on the same page number as a ptrmap page, then the ptrmap is moved
to the following page for that one case.)^</p>

<p>Each 5-byte entry on a ptrmap page provides back-link information about 
one of the pages that immediately follow the pointer map.  ^(If page B is a
ptrmap page then back-link information about page B+1 is provided by
the first entry on the pointer map.  Information about page B+2 is
provided by the second entry.  And so forth.)^</p>

<p>Each 5-byte ptrmap entry consists of one byte of "page type" information
followed by a 4-byte big-endian page number.  Five page types are recognized:
</p>
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
integer key for each entry in the table b-tree.</p>

<p> ^The content of each SQL table row is stored in the database file by
first combining the values in the various columns into a byte array
in the record format, then storing that byte array as the payload in
an entry in the table b-tree.  ^The order of values in the record is
the same as the order of columns in the SQL table definition.
^When an SQL table that includes an
[INTEGER PRIMARY KEY] column (which aliases the [rowid]) then that
column appears in the record as a NULL value.  ^SQLite will always use
the table b-tree key rather than the NULL value when referencing the
[INTEGER PRIMARY KEY] column.</p>

<p> ^If the [affinity] of a column is REAL and that column contains a
value that can be converted to an integer without loss of information







|







1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
integer key for each entry in the table b-tree.</p>

<p> ^The content of each SQL table row is stored in the database file by
first combining the values in the various columns into a byte array
in the record format, then storing that byte array as the payload in
an entry in the table b-tree.  ^The order of values in the record is
the same as the order of columns in the SQL table definition.
^When an SQL table includes an
[INTEGER PRIMARY KEY] column (which aliases the [rowid]) then that
column appears in the record as a NULL value.  ^SQLite will always use
the table b-tree key rather than the NULL value when referencing the
[INTEGER PRIMARY KEY] column.</p>

<p> ^If the [affinity] of a column is REAL and that column contains a
value that can be converted to an integer without loss of information
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
and virtual tables, the rootpage column is 0 or NULL.</p>

<p>^(The sqlite_master.sql column stores SQL text that describes the
object.  This SQL text is a [CREATE TABLE], [CREATE VIRTUAL TABLE],
[CREATE INDEX],
[CREATE VIEW], or [CREATE TRIGGER] statement that if evaluated against
the database file when it is the main database of a [database connection]
would recreated the object.)^  The text is usually a copy of the original
statement used to create the object but with normalizations applied so
that the text conforms to the following rules:

<ul>
<li>^The CREATE, TABLE, VIEW, TRIGGER, and INDEX keywords at the beginning
of the statement are converted to all upper case letters.
<li>^The TEMP or TEMPORARY keyword is removed if it occurs after the 







|







1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
and virtual tables, the rootpage column is 0 or NULL.</p>

<p>^(The sqlite_master.sql column stores SQL text that describes the
object.  This SQL text is a [CREATE TABLE], [CREATE VIRTUAL TABLE],
[CREATE INDEX],
[CREATE VIEW], or [CREATE TRIGGER] statement that if evaluated against
the database file when it is the main database of a [database connection]
would recreate the object.)^  The text is usually a copy of the original
statement used to create the object but with normalizations applied so
that the text conforms to the following rules:

<ul>
<li>^The CREATE, TABLE, VIEW, TRIGGER, and INDEX keywords at the beginning
of the statement are converted to all upper case letters.
<li>^The TEMP or TEMPORARY keyword is removed if it occurs after the 
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218

<ul>
<li><p>Indices with names of the form "sqlite_autoindex_TABLE_N" that
       are used to implement [UNIQUE] and [PRIMARY KEY] constraints on
       ordinary tables.

<li><p>A table with the name "sqlite_sequence" that is used to keep track
       of the maximum historical [INTEGER PRIMARY KEY] for a table that
       using [AUTOINCREMENT].

<li><p>Tables with names of the form "sqlite_statN" where N is an integer.
       Such tables store database statistics gathered by the [ANALYZE]
       command and used by the query planner to help determine the best
       algorithm to use for each query.
</ul>







|







1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218

<ul>
<li><p>Indices with names of the form "sqlite_autoindex_TABLE_N" that
       are used to implement [UNIQUE] and [PRIMARY KEY] constraints on
       ordinary tables.

<li><p>A table with the name "sqlite_sequence" that is used to keep track
       of the maximum historical [INTEGER PRIMARY KEY] for a table
       using [AUTOINCREMENT].

<li><p>Tables with names of the form "sqlite_statN" where N is an integer.
       Such tables store database statistics gathered by the [ANALYZE]
       command and used by the query planner to help determine the best
       algorithm to use for each query.
</ul>
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
that contain between 10 and 40 samples that are distributed across
the key space and with large nEq values.

<p>^(In a well-formed sqlite_stat3 table, the samples for any single
index must appear in the same order that they occur in the index.  
In other words, if the entry with left-most column S1 is earlier in
the index b-tree than the
entry with lef-most column S2, then in the sqlite_stat3 table, 
sample S1 must have a smaller rowid than sample S2.)^

<tcl>hd_fragment stat4tab {sqlite_stat4} SQLITE_STAT4</tcl>
<h4>2.6.6 The sqlite_stat4 table</h4>

<p>The sqlite_stat4 is only created and is only used if SQLite is compiled
with [SQLITE_ENABLE_STAT4] and if the SQLite version number is







|







1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
that contain between 10 and 40 samples that are distributed across
the key space and with large nEq values.

<p>^(In a well-formed sqlite_stat3 table, the samples for any single
index must appear in the same order that they occur in the index.  
In other words, if the entry with left-most column S1 is earlier in
the index b-tree than the
entry with left-most column S2, then in the sqlite_stat3 table, 
sample S1 must have a smaller rowid than sample S2.)^

<tcl>hd_fragment stat4tab {sqlite_stat4} SQLITE_STAT4</tcl>
<h4>2.6.6 The sqlite_stat4 table</h4>

<p>The sqlite_stat4 is only created and is only used if SQLite is compiled
with [SQLITE_ENABLE_STAT4] and if the SQLite version number is
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
    <td>^(The sqlite_stat4.nLt column holds a list of N integers where
    the K-th integer is the approximate number of entries in the
    index whose K left-most columns are collectively less than the 
    K left-most columns of the sample.)^

<tr><td valign="top" align="right">nDLt:</td>
    <td>^(The sqlite_stat4.nDLt column holds a list of N integers where
    the K-th integers is the approximate
    number of entries in the index that are distinct in the first K columns and
    that are whose left-most K columns are collectively less than the left-most
    K columns of the sample.)^
</table>
</center>

<p>The sqlite_stat4 is a generalization of the sqlite_stat3 table.  The
sqlite_stat3 table provides information about the left-most column of an
index whereas the sqlite_stat4 table provides information about all columns







|

|







1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
    <td>^(The sqlite_stat4.nLt column holds a list of N integers where
    the K-th integer is the approximate number of entries in the
    index whose K left-most columns are collectively less than the 
    K left-most columns of the sample.)^

<tr><td valign="top" align="right">nDLt:</td>
    <td>^(The sqlite_stat4.nDLt column holds a list of N integers where
    the K-th integer is the approximate
    number of entries in the index that are distinct in the first K columns and
    where the left-most K columns are collectively less than the left-most
    K columns of the sample.)^
</table>
</center>

<p>The sqlite_stat4 is a generalization of the sqlite_stat3 table.  The
sqlite_stat3 table provides information about the left-most column of an
index whereas the sqlite_stat4 table provides information about all columns

Changes to pages/index.in.

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

</td>
<td width="20"></td><td bgcolor="#044a64" width="1"></td><td width="20"></td>
<td valign="top">
<h3>Current Status</h3>

<p><ul>
<li><a href="releaselog/3_10_0.html">Version 3.10.0</a>
of SQLite is recommended for all new development.
</li>
</ul></p>

<h3>Common Links</h3>

<p><ul>







|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

</td>
<td width="20"></td><td bgcolor="#044a64" width="1"></td><td width="20"></td>
<td valign="top">
<h3>Current Status</h3>

<p><ul>
<li><a href="releaselog/3_10_2.html">Version 3.10.2</a>
of SQLite is recommended for all new development.
</li>
</ul></p>

<h3>Common Links</h3>

<p><ul>

Changes to pages/news.in.

14
15
16
17
18
19
20
















21
22
23
24
25
26
27
  hd_puts "<h3>$date - $title</h3>"
  regsub -all "\n( *\n)+" $text "</p>\n\n<p>" txt
  regsub -all {[Tt]icket #(\d+)} $txt \
      {<a href="http://www.sqlite.org/cvstrac/tktview?tn=\1">\0</a>} txt
  hd_resolve "<blockquote>$txt</blockquote>"
  hd_puts "<hr width=\"50%\">"
}

















newsitem {2016-01-06} {Release 3.10.0} {
<p>SQLite [version 3.10.0] is a regularly scheduled maintenance release.
}

newsitem {2015-11-02} {Release 3.9.2} {
<p>SQLite [version 3.9.2] is a patch release fixing two obscure bugs.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
40
41
42
43
  hd_puts "<h3>$date - $title</h3>"
  regsub -all "\n( *\n)+" $text "</p>\n\n<p>" txt
  regsub -all {[Tt]icket #(\d+)} $txt \
      {<a href="http://www.sqlite.org/cvstrac/tktview?tn=\1">\0</a>} txt
  hd_resolve "<blockquote>$txt</blockquote>"
  hd_puts "<hr width=\"50%\">"
}

newsitem {2016-01-20} {Release 3.10.2} {
<p>Yikes!  An optimization attempt gone bad resulted in a 
[https://www.sqlite.org/src/info/80369eddd5c94 | bug in the LIKE operator]
which is fixed by this patch release.
Three other minor but low-risk fixes are also included in the patch.
}

newsitem {2016-01-14} {Release 3.10.1} {
<p>SQLite [version 3.10.1] is a bug-fix release primarily targeting the
fix for the query planner bug
[https://www.sqlite.org/src/info/cb3aa0641d9a4|cb3aa0641d9a4] discovered by
Mapscape.  Also included is a minor API enhancement requested by
the Firefox developers at Mozilla.  The differences from version 
3.10.0 are minimal.
}

newsitem {2016-01-06} {Release 3.10.0} {
<p>SQLite [version 3.10.0] is a regularly scheduled maintenance release.
}

newsitem {2015-11-02} {Release 3.9.2} {
<p>SQLite [version 3.9.2] is a patch release fixing two obscure bugs.

Changes to pages/queryplanner.in.

1
2
3
4




5
6
7
8
9
10
11
<title>Query Planning</title>
<tcl>
hd_keywords {indexing} {indexing tutorial}
proc figure {fignum tag img title} {




  hd_puts "<p><center>\n"
  hd_puts "<img src=\"images/qp/$img\" alt=\"figure $fignum\"><br>\n"
  hd_puts "Figure $fignum: $title\n"
  hd_puts "</center></p>\n"
}
proc code {txt} {
  hd_puts "<center><table><tr><td><pre>\n"




>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<title>Query Planning</title>
<tcl>
hd_keywords {indexing} {indexing tutorial}
proc figure {fignum tag img title} {
  if {$tag!=""} {
    set tag [string trim $tag #]
    hd_puts "<a name='$tag'></a>\n"
  }
  hd_puts "<p><center>\n"
  hd_puts "<img src=\"images/qp/$img\" alt=\"figure $fignum\"><br>\n"
  hd_puts "Figure $fignum: $title\n"
  hd_puts "</center></p>\n"
}
proc code {txt} {
  hd_puts "<center><table><tr><td><pre>\n"
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

<tcl>code {
SELECT price FROM fruitsforsale WHERE rowid=4;
}</tcl>

<p>
Since the information is stored in the table in rowid order, SQLite
can find the correct row using doing a binary search on the rowid.
If the table contains N element, the time required to look up the
desired row is proportional to logN rather than being proportional
to N as in a full table scan.  If the table contains 10 million elements,
that means the query will be on the order of N/logN or about 1 million
times faster!
</p>








|







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137

<tcl>code {
SELECT price FROM fruitsforsale WHERE rowid=4;
}</tcl>

<p>
Since the information is stored in the table in rowid order, SQLite
can find the correct row using a binary search on the rowid.
If the table contains N element, the time required to look up the
desired row is proportional to logN rather than being proportional
to N as in a full table scan.  If the table contains 10 million elements,
that means the query will be on the order of N/logN or about 1 million
times faster!
</p>

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

<p>
To make the original query more efficient, we can add an index on the
"fruit" column of the "fruitsforsale" table like this:
</p>

<tcl>code {
CREATE INDEX idx1 ON fruitsforsale(fruit);
}</tcl>

<p>
An index is another table similar to the original "fruitsforsale" table
but with the content (the fruit column in this case) stored in front of the
rowid and with all rows in content order.
<a href="#fig4">Figure 4</a> gives a logical view of the Idx1 index.







|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

<p>
To make the original query more efficient, we can add an index on the
"fruit" column of the "fruitsforsale" table like this:
</p>

<tcl>code {
CREATE INDEX Idx1 ON fruitsforsale(fruit);
}</tcl>

<p>
An index is another table similar to the original "fruitsforsale" table
but with the content (the fruit column in this case) stored in front of the
rowid and with all rows in content order.
<a href="#fig4">Figure 4</a> gives a logical view of the Idx1 index.
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
</tcl>

<p>
The "state" index works just like the "fruit" index in that it is a
new table with an extra column in front of the rowid and sorted by
that extra column as the primary key.  The only difference is that
in Idx2, the first column is "state" instead of "fruit" as it is with
Idx1.  In our example data set, the is more redundancy in the "state"
column and so they are more duplicate entries.  The ties are still
resolved using the rowid.
</p>

<p>
Using the new Idx2 index on "state", SQLite has another option for
lookup up the price of California oranges:  it can look up every row







|







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
</tcl>

<p>
The "state" index works just like the "fruit" index in that it is a
new table with an extra column in front of the rowid and sorted by
that extra column as the primary key.  The only difference is that
in Idx2, the first column is "state" instead of "fruit" as it is with
Idx1.  In our example data set, there is more redundancy in the "state"
column and so they are more duplicate entries.  The ties are still
resolved using the rowid.
</p>

<p>
Using the new Idx2 index on "state", SQLite has another option for
lookup up the price of California oranges:  it can look up every row
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
<tcl>figure 18 #fig18 obfruitidx1.gif {Sorting With An Index}</tcl>

<p>
The Idx1 index is scanned from top to bottom (or from bottom to top if
"ORDER BY fruit DESC" is used) in order to find the rowids for each item
in order by fruit.  Then for each rowid, a binary search is done to lookup
and output that row.  In this way, the output appears in the requested order
with the need to gather then entire output and sort it using a separate step.
</p>

<p>
But does this really save time?  The number of steps in the 
<a href="#fig16">original indexless sort</a> is proportional to NlogN since
that is how much time it takes to sort N rows.  But when we use Idx1 as
shown here, we have to do N rowid lookups which take logN time each, so







|







549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
<tcl>figure 18 #fig18 obfruitidx1.gif {Sorting With An Index}</tcl>

<p>
The Idx1 index is scanned from top to bottom (or from bottom to top if
"ORDER BY fruit DESC" is used) in order to find the rowids for each item
in order by fruit.  Then for each rowid, a binary search is done to lookup
and output that row.  In this way, the output appears in the requested order
without the need to gather the entire output and sort it using a separate step.
</p>

<p>
But does this really save time?  The number of steps in the 
<a href="#fig16">original indexless sort</a> is proportional to NlogN since
that is how much time it takes to sort N rows.  But when we use Idx1 as
shown here, we have to do N rowid lookups which take logN time each, so
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689

<p>
The same basic algorithm is followed, except this time the matching rows
of the index are scanned from bottom to top instead of from top to bottom,
so that the states will appear in descending order.
</p>

<tcl>hd_fragment {partialsort} {partial sorting by index}</tcl>
<h3>3.2 Partial Sorting Using An Index</h3>

<p>
Sometimes only part of an ORDER BY clause can be satisfied using indexes.
Consider, for example, the following query:
</p>

<tcl>







|
|







678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693

<p>
The same basic algorithm is followed, except this time the matching rows
of the index are scanned from bottom to top instead of from top to bottom,
so that the states will appear in descending order.
</p>

<tcl>hd_fragment {partialsort} {partial sorting by index} {block sorting}</tcl>
<h3>3.2 Partial Sorting Using An Index (a.k.a. Block Sorting)</h3>

<p>
Sometimes only part of an ORDER BY clause can be satisfied using indexes.
Consider, for example, the following query:
</p>

<tcl>

Changes to pages/rescode.in.

320
321
322
323
324
325
326
327

328
329
330
331
332
333
334
335
  SQL statement being prepared is not authorized.
}
RESCODE SQLITE_FORMAT      24   {
  The SQLITE_FORMAT error code is not currently used by SQLite.
}
RESCODE SQLITE_RANGE       25   {
  The SQLITE_RANGE error indices that the parameter number argument
  to one of the [sqlite3_bind_blob|sqlite3_bind] routines is out of

  range.
}
RESCODE SQLITE_NOTADB      26   {
  When attempting to open a file, the SQLITE_NOTADB error indicates that
  the file being opened does not appear to be an SQLite database file.
}
RESCODE SQLITE_NOTICE      27   {
  The SQLITE_NOTICE result code is not returned by any C/C++ interface.







|
>
|







320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
  SQL statement being prepared is not authorized.
}
RESCODE SQLITE_FORMAT      24   {
  The SQLITE_FORMAT error code is not currently used by SQLite.
}
RESCODE SQLITE_RANGE       25   {
  The SQLITE_RANGE error indices that the parameter number argument
  to one of the [sqlite3_bind_blob|sqlite3_bind] routines or the
  column number in one of the [sqlite3_column_int|sqlite3_column]
  routines is out of range.
}
RESCODE SQLITE_NOTADB      26   {
  When attempting to open a file, the SQLITE_NOTADB error indicates that
  the file being opened does not appear to be an SQLite database file.
}
RESCODE SQLITE_NOTICE      27   {
  The SQLITE_NOTICE result code is not returned by any C/C++ interface.

Added pages/sqlanalyze.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
<title>sqlite3_analyzer.exe: Database Size Measurement Utility</title>
<tcl>hd_keywords sqlite3_analyzer sqlite3_analyzer.exe</tcl>
<h1>The sqllite3_analyzer.exe Utility Program</h1>

<p>
The <tt>sqlite3_analyzer.exe</tt> binary is a command-line utility program
that measures and displays how much and how efficiently space is used by 
individual tables and indexes with an SQLite database file.
Example usage:

<blockquote><pre>
sqlite3_analyzer database.sqlite
</pre></blockquote>

<p>
The output is a human-readable ASCII text report that provides information
on the space utilization of the database file.  The report is intended to
be self-explanatory, though there is some 
<a href='#defs'>additional explanation</a> of the
various parameters reported toward the end of the report.

<p>
The output is also valid SQL.  Most of the report text is contained within
a header comment, with various SQL statements that create and initialize
a database at the
<a href="#sqlx">end of the report</a>.  The constructed database contains
the raw data from which the report was extracted.  Hence the original
report can be read into an instance of the [command-line shell] and then
the raw data can be queried to dig deeper into the space utilization of
a particular database file.


<h2>Example Output</h2>

<p>The following is sqlite3_analyzer output for an example
places.sqlite database used by Firefox.

<pre>
/** Disk-Space Utilization Report For &#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;/places.sqlite

Page size in bytes................................ 32768     
Pages in the whole file (measured)................ 221       
Pages in the whole file (calculated).............. 221       
Pages that store data............................. 221        100.0% 
Pages on the freelist (per header)................ 0            0.0% 
Pages on the freelist (calculated)................ 0            0.0% 
Pages of auto-vacuum overhead..................... 0            0.0% 
Number of tables in the database.................. 14        
Number of indices................................. 23        
Number of defined indices......................... 17        
Number of implied indices......................... 6         
Size of the file in bytes......................... 7241728   
Bytes of user payload stored...................... 2503069     34.6% 

*** Page counts for all tables with their indices *****************************

MOZ_PLACES........................................ 142         64.3% 
MOZ_HISTORYVISITS................................. 41          18.6% 
MOZ_FAVICONS...................................... 15           6.8% 
MOZ_BOOKMARKS..................................... 5            2.3% 
MOZ_KEYWORDS...................................... 3            1.4% 
MOZ_ANNO_ATTRIBUTES............................... 2            0.90% 
MOZ_ANNOS......................................... 2            0.90% 
MOZ_BOOKMARKS_ROOTS............................... 2            0.90% 
MOZ_HOSTS......................................... 2            0.90% 
MOZ_INPUTHISTORY.................................. 2            0.90% 
MOZ_ITEMS_ANNOS................................... 2            0.90% 
SQLITE_MASTER..................................... 1            0.45% 
SQLITE_SEQUENCE................................... 1            0.45% 
SQLITE_STAT1...................................... 1            0.45% 

*** Page counts for all tables and indices separately *************************

MOZ_PLACES........................................ 63          28.5% 
MOZ_PLACES_URL_UNIQUEINDEX........................ 37          16.7% 
MOZ_HISTORYVISITS................................. 13           5.9% 
MOZ_FAVICONS...................................... 12           5.4% 
MOZ_HISTORYVISITS_PLACEDATEINDEX.................. 12           5.4% 
MOZ_PLACES_HOSTINDEX.............................. 11           5.0% 
MOZ_HISTORYVISITS_DATEINDEX....................... 10           4.5% 
MOZ_PLACES_GUID_UNIQUEINDEX....................... 9            4.1% 
MOZ_PLACES_LASTVISITDATEINDEX..................... 7            3.2% 
MOZ_HISTORYVISITS_FROMINDEX....................... 6            2.7% 
MOZ_PLACES_FAVICONINDEX........................... 5            2.3% 
MOZ_PLACES_FRECENCYINDEX.......................... 5            2.3% 
MOZ_PLACES_VISITCOUNT............................. 5            2.3% 
SQLITE_AUTOINDEX_MOZ_FAVICONS_1................... 3            1.4% 
MOZ_ANNO_ATTRIBUTES............................... 1            0.45% 
MOZ_ANNOS......................................... 1            0.45% 
MOZ_ANNOS_PLACEATTRIBUTEINDEX..................... 1            0.45% 
MOZ_BOOKMARKS..................................... 1            0.45% 
MOZ_BOOKMARKS_GUID_UNIQUEINDEX.................... 1            0.45% 
MOZ_BOOKMARKS_ITEMINDEX........................... 1            0.45% 
MOZ_BOOKMARKS_ITEMLASTMODIFIEDINDEX............... 1            0.45% 
MOZ_BOOKMARKS_PARENTINDEX......................... 1            0.45% 
MOZ_BOOKMARKS_ROOTS............................... 1            0.45% 
MOZ_HOSTS......................................... 1            0.45% 
MOZ_INPUTHISTORY.................................. 1            0.45% 
MOZ_ITEMS_ANNOS................................... 1            0.45% 
MOZ_ITEMS_ANNOS_ITEMATTRIBUTEINDEX................ 1            0.45% 
MOZ_KEYWORDS...................................... 1            0.45% 
MOZ_KEYWORDS_PLACEPOSTDATA_UNIQUEINDEX............ 1            0.45% 
SQLITE_AUTOINDEX_MOZ_ANNO_ATTRIBUTES_1............ 1            0.45% 
SQLITE_AUTOINDEX_MOZ_BOOKMARKS_ROOTS_1............ 1            0.45% 
SQLITE_AUTOINDEX_MOZ_HOSTS_1...................... 1            0.45% 
SQLITE_AUTOINDEX_MOZ_INPUTHISTORY_1............... 1            0.45% 
SQLITE_AUTOINDEX_MOZ_KEYWORDS_1................... 1            0.45% 
SQLITE_MASTER..................................... 1            0.45% 
SQLITE_SEQUENCE................................... 1            0.45% 
SQLITE_STAT1...................................... 1            0.45% 

*** All tables and indices ****************************************************

Percentage of total database...................... 100.0%    
Number of entries................................. 154969    
Bytes of storage consumed......................... 7241728   
Bytes of payload.................................. 4969404     68.6% 
Average payload per entry......................... 32.07     
Average unused bytes per entry.................... 11.15     
Average fanout.................................... 14.00     
Maximum payload per entry......................... 7640      
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 14        
Primary pages used................................ 207       
Overflow pages used............................... 0         
Total pages used.................................. 221       
Unused bytes on index pages....................... 448010      97.7% 
Unused bytes on primary pages..................... 1280642     18.9% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 1728652     23.9% 

*** All tables ****************************************************************

Percentage of total database......................  44.8%    
Number of entries................................. 28530     
Bytes of storage consumed......................... 3244032   
Bytes of payload.................................. 2508257     77.3% 
Average payload per entry......................... 87.92     
Average unused bytes per entry.................... 20.13     
Average fanout.................................... 28.00     
Maximum payload per entry......................... 7640      
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 3         
Primary pages used................................ 96        
Overflow pages used............................... 0         
Total pages used.................................. 99        
Unused bytes on index pages....................... 97551       99.23% 
Unused bytes on primary pages..................... 476741      15.2% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 574292      17.7% 

*** All indices ***************************************************************

Percentage of total database......................  55.2%    
Number of entries................................. 126439    
Bytes of storage consumed......................... 3997696   
Bytes of payload.................................. 2461147     61.6% 
Average payload per entry......................... 19.47     
Average unused bytes per entry.................... 9.13      
Average fanout.................................... 11.00     
Maximum payload per entry......................... 7259      
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 11        
Primary pages used................................ 111       
Overflow pages used............................... 0         
Total pages used.................................. 122       
Unused bytes on index pages....................... 350459      97.2% 
Unused bytes on primary pages..................... 803901      22.1% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 1154360     28.9% 

*** Table MOZ_ANNO_ATTRIBUTES and all its indices *****************************

Percentage of total database......................   0.90%   
Number of entries................................. 24        
Bytes of storage consumed......................... 65536     
Bytes of payload.................................. 721          1.1% 
Average payload per entry......................... 30.04     
Average unused bytes per entry.................... 2696.46   
Maximum payload per entry......................... 43        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 2         
Overflow pages used............................... 0         
Total pages used.................................. 2         
Unused bytes on primary pages..................... 64715       98.7% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 64715       98.7% 

*** Table MOZ_ANNO_ATTRIBUTES w/o any indices *********************************

Percentage of total database......................   0.45%   
Number of entries................................. 12        
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 355          1.1% 
B-tree depth...................................... 1         
Average payload per entry......................... 29.58     
Average unused bytes per entry.................... 2696.42   
Maximum payload per entry......................... 42        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 32357       98.7% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32357       98.7% 

*** Index SQLITE_AUTOINDEX_MOZ_ANNO_ATTRIBUTES_1 of table MOZ_ANNO_ATTRIBUTES *

Percentage of total database......................   0.45%   
Number of entries................................. 12        
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 366          1.1% 
B-tree depth...................................... 1         
Average payload per entry......................... 30.50     
Average unused bytes per entry.................... 2696.50   
Maximum payload per entry......................... 43        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 32358       98.7% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32358       98.7% 

*** Table MOZ_ANNOS and all its indices ***************************************

Percentage of total database......................   0.90%   
Number of entries................................. 390       
Bytes of storage consumed......................... 65536     
Bytes of payload.................................. 13986       21.3% 
Average payload per entry......................... 35.86     
Average unused bytes per entry.................... 128.22    
Maximum payload per entry......................... 127       
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 2         
Overflow pages used............................... 0         
Total pages used.................................. 2         
Unused bytes on primary pages..................... 50006       76.3% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 50006       76.3% 

*** Table MOZ_ANNOS w/o any indices *******************************************

Percentage of total database......................   0.45%   
Number of entries................................. 195       
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 12115       37.0% 
B-tree depth...................................... 1         
Average payload per entry......................... 62.13     
Average unused bytes per entry.................... 101.04    
Maximum payload per entry......................... 127       
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 19702       60.1% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 19702       60.1% 

*** Index MOZ_ANNOS_PLACEATTRIBUTEINDEX of table MOZ_ANNOS ********************

Percentage of total database......................   0.45%   
Number of entries................................. 195       
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 1871         5.7% 
B-tree depth...................................... 1         
Average payload per entry......................... 9.59      
Average unused bytes per entry.................... 155.41    
Maximum payload per entry......................... 10        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 30304       92.5% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 30304       92.5% 

*** Table MOZ_BOOKMARKS and all its indices ***********************************

Percentage of total database......................   2.3%    
Number of entries................................. 1565      
Bytes of storage consumed......................... 163840    
Bytes of payload.................................. 37104       22.6% 
Average payload per entry......................... 23.71     
Average unused bytes per entry.................... 77.62     
Maximum payload per entry......................... 518       
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 5         
Overflow pages used............................... 0         
Total pages used.................................. 5         
Unused bytes on primary pages..................... 121475      74.1% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 121475      74.1% 

*** Table MOZ_BOOKMARKS w/o any indices ***************************************

Percentage of total database......................   0.45%   
Number of entries................................. 313       
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 21937       66.9% 
B-tree depth...................................... 1         
Average payload per entry......................... 70.09     
Average unused bytes per entry.................... 29.90     
Maximum payload per entry......................... 518       
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 9358        28.6% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 9358        28.6% 

*** Indices of table MOZ_BOOKMARKS ********************************************

Percentage of total database......................   1.8%    
Number of entries................................. 1252      
Bytes of storage consumed......................... 131072    
Bytes of payload.................................. 15167       11.6% 
Average payload per entry......................... 12.11     
Average unused bytes per entry.................... 89.55     
Maximum payload per entry......................... 17        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 4         
Overflow pages used............................... 0         
Total pages used.................................. 4         
Unused bytes on primary pages..................... 112117      85.5% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 112117      85.5% 

*** Index MOZ_BOOKMARKS_GUID_UNIQUEINDEX of table MOZ_BOOKMARKS ***************

Percentage of total database......................   0.45%   
Number of entries................................. 313       
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 5207        15.9% 
B-tree depth...................................... 1         
Average payload per entry......................... 16.64     
Average unused bytes per entry.................... 85.03     
Maximum payload per entry......................... 17        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 26614       81.2% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 26614       81.2% 

*** Index MOZ_BOOKMARKS_ITEMINDEX of table MOZ_BOOKMARKS **********************

Percentage of total database......................   0.45%   
Number of entries................................. 313       
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 2547         7.8% 
B-tree depth...................................... 1         
Average payload per entry......................... 8.14      
Average unused bytes per entry.................... 93.53     
Maximum payload per entry......................... 9         
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 29274       89.3% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 29274       89.3% 

*** Index MOZ_BOOKMARKS_ITEMLASTMODIFIEDINDEX of table MOZ_BOOKMARKS **********

Percentage of total database......................   0.45%   
Number of entries................................. 313       
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 5020        15.3% 
B-tree depth...................................... 1         
Average payload per entry......................... 16.04     
Average unused bytes per entry.................... 85.63     
Maximum payload per entry......................... 17        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 26801       81.8% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 26801       81.8% 

*** Index MOZ_BOOKMARKS_PARENTINDEX of table MOZ_BOOKMARKS ********************

Percentage of total database......................   0.45%   
Number of entries................................. 313       
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 2393         7.3% 
B-tree depth...................................... 1         
Average payload per entry......................... 7.65      
Average unused bytes per entry.................... 94.02     
Maximum payload per entry......................... 9         
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 29428       89.8% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 29428       89.8% 

*** Table MOZ_BOOKMARKS_ROOTS and all its indices *****************************

Percentage of total database......................   0.90%   
Number of entries................................. 10        
Bytes of storage consumed......................... 65536     
Bytes of payload.................................. 94           0.14% 
Average payload per entry......................... 9.40      
Average unused bytes per entry.................... 6539.10   
Maximum payload per entry......................... 11        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 2         
Overflow pages used............................... 0         
Total pages used.................................. 2         
Unused bytes on primary pages..................... 65391       99.78% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 65391       99.78% 

*** Table MOZ_BOOKMARKS_ROOTS w/o any indices *********************************

Percentage of total database......................   0.45%   
Number of entries................................. 5         
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 47           0.14% 
B-tree depth...................................... 1         
Average payload per entry......................... 9.40      
Average unused bytes per entry.................... 6538.60   
Maximum payload per entry......................... 11        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 32693       99.77% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32693       99.77% 

*** Index SQLITE_AUTOINDEX_MOZ_BOOKMARKS_ROOTS_1 of table MOZ_BOOKMARKS_ROOTS *

Percentage of total database......................   0.45%   
Number of entries................................. 5         
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 47           0.14% 
B-tree depth...................................... 1         
Average payload per entry......................... 9.40      
Average unused bytes per entry.................... 6539.60   
Maximum payload per entry......................... 11        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 32698       99.79% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32698       99.79% 

*** Table MOZ_FAVICONS and all its indices ************************************

Percentage of total database......................   6.8%    
Number of entries................................. 941       
Bytes of storage consumed......................... 491520    
Bytes of payload.................................. 332765      67.7% 
Average payload per entry......................... 353.63    
Average unused bytes per entry.................... 164.00    
Average fanout.................................... 7.00      
Maximum payload per entry......................... 7640      
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 2         
Primary pages used................................ 13        
Overflow pages used............................... 0         
Total pages used.................................. 15        
Unused bytes on index pages....................... 65340       99.70% 
Unused bytes on primary pages..................... 88980       20.9% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 154320      31.4% 

*** Table MOZ_FAVICONS w/o any indices ****************************************

Percentage of total database......................   5.4%    
Number of entries................................. 471       
Bytes of storage consumed......................... 393216    
Bytes of payload.................................. 297630      75.7% 
B-tree depth...................................... 2         
Average payload per entry......................... 631.91    
Average unused bytes per entry.................... 196.60    
Average fanout.................................... 11.00     
Non-sequential pages.............................. 6           54.5% 
Maximum payload per entry......................... 7640      
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 11        
Overflow pages used............................... 0         
Total pages used.................................. 12        
Unused bytes on index pages....................... 32676       99.72% 
Unused bytes on primary pages..................... 59923       16.6% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 92599       23.5% 

*** Index SQLITE_AUTOINDEX_MOZ_FAVICONS_1 of table MOZ_FAVICONS ***************

Percentage of total database......................   1.4%    
Number of entries................................. 470       
Bytes of storage consumed......................... 98304     
Bytes of payload.................................. 35135       35.7% 
B-tree depth...................................... 2         
Average payload per entry......................... 74.76     
Average unused bytes per entry.................... 131.32    
Average fanout.................................... 3.00      
Non-sequential pages.............................. 1           50.0% 
Maximum payload per entry......................... 7259      
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 2         
Overflow pages used............................... 0         
Total pages used.................................. 3         
Unused bytes on index pages....................... 32664       99.68% 
Unused bytes on primary pages..................... 29057       44.3% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 61721       62.8% 

*** Table MOZ_HISTORYVISITS and all its indices *******************************

Percentage of total database......................  18.6%    
Number of entries................................. 63470     
Bytes of storage consumed......................... 1343488   
Bytes of payload.................................. 882233      65.7% 
Average payload per entry......................... 13.90     
Average unused bytes per entry.................... 3.76      
Average fanout.................................... 10.00     
Maximum payload per entry......................... 21        
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 4         
Primary pages used................................ 37        
Overflow pages used............................... 0         
Total pages used.................................. 41        
Unused bytes on index pages....................... 130482      99.55% 
Unused bytes on primary pages..................... 108158       8.9% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 238640      17.8% 

*** Table MOZ_HISTORYVISITS w/o any indices ***********************************

Percentage of total database......................   5.9%    
Number of entries................................. 15873     
Bytes of storage consumed......................... 425984    
Bytes of payload.................................. 308447      72.4% 
B-tree depth...................................... 2         
Average payload per entry......................... 19.43     
Average unused bytes per entry.................... 2.40      
Average fanout.................................... 12.00     
Non-sequential pages.............................. 8           66.7% 
Maximum payload per entry......................... 21        
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 12        
Overflow pages used............................... 0         
Total pages used.................................. 13        
Unused bytes on index pages....................... 32668       99.69% 
Unused bytes on primary pages..................... 5435         1.4% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 38103        8.9% 

*** Indices of table MOZ_HISTORYVISITS ****************************************

Percentage of total database......................  12.7%    
Number of entries................................. 47597     
Bytes of storage consumed......................... 917504    
Bytes of payload.................................. 573786      62.5% 
Average payload per entry......................... 12.06     
Average unused bytes per entry.................... 4.21      
Average fanout.................................... 9.00      
Maximum payload per entry......................... 17        
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 3         
Primary pages used................................ 25        
Overflow pages used............................... 0         
Total pages used.................................. 28        
Unused bytes on index pages....................... 97814       99.50% 
Unused bytes on primary pages..................... 102723      12.5% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 200537      21.9% 

*** Index MOZ_HISTORYVISITS_DATEINDEX of table MOZ_HISTORYVISITS **************

Percentage of total database......................   4.5%    
Number of entries................................. 15865     
Bytes of storage consumed......................... 327680    
Bytes of payload.................................. 206221      62.9% 
B-tree depth...................................... 2         
Average payload per entry......................... 13.00     
Average unused bytes per entry.................... 4.65      
Average fanout.................................... 10.00     
Non-sequential pages.............................. 6           66.7% 
Maximum payload per entry......................... 13        
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 9         
Overflow pages used............................... 0         
Total pages used.................................. 10        
Unused bytes on index pages....................... 32596       99.48% 
Unused bytes on primary pages..................... 41128       13.9% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 73724       22.5% 

*** Index MOZ_HISTORYVISITS_FROMINDEX of table MOZ_HISTORYVISITS **************

Percentage of total database......................   2.7%    
Number of entries................................. 15869     
Bytes of storage consumed......................... 196608    
Bytes of payload.................................. 100292      51.0% 
B-tree depth...................................... 2         
Average payload per entry......................... 6.32      
Average unused bytes per entry.................... 3.06      
Average fanout.................................... 6.00      
Non-sequential pages.............................. 4           80.0% 
Maximum payload per entry......................... 7         
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 5         
Overflow pages used............................... 0         
Total pages used.................................. 6         
Unused bytes on index pages....................... 32702       99.80% 
Unused bytes on primary pages..................... 15927        9.7% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 48629       24.7% 

*** Index MOZ_HISTORYVISITS_PLACEDATEINDEX of table MOZ_HISTORYVISITS *********

Percentage of total database......................   5.4%    
Number of entries................................. 15863     
Bytes of storage consumed......................... 393216    
Bytes of payload.................................. 267273      68.0% 
B-tree depth...................................... 2         
Average payload per entry......................... 16.85     
Average unused bytes per entry.................... 4.93      
Average fanout.................................... 12.00     
Non-sequential pages.............................. 8           72.7% 
Maximum payload per entry......................... 17        
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 11        
Overflow pages used............................... 0         
Total pages used.................................. 12        
Unused bytes on index pages....................... 32516       99.23% 
Unused bytes on primary pages..................... 45668       12.7% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 78184       19.9% 

*** Table MOZ_HOSTS and all its indices ***************************************

Percentage of total database......................   0.90%   
Number of entries................................. 1256      
Bytes of storage consumed......................... 65536     
Bytes of payload.................................. 27640       42.2% 
Average payload per entry......................... 22.01     
Average unused bytes per entry.................... 26.18     
Maximum payload per entry......................... 49        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 2         
Overflow pages used............................... 0         
Total pages used.................................. 2         
Unused bytes on primary pages..................... 32888       50.2% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32888       50.2% 

*** Table MOZ_HOSTS w/o any indices *******************************************

Percentage of total database......................   0.45%   
Number of entries................................. 628       
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 14640       44.7% 
B-tree depth...................................... 1         
Average payload per entry......................... 23.31     
Average unused bytes per entry.................... 23.90     
Maximum payload per entry......................... 49        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 15012       45.8% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 15012       45.8% 

*** Index SQLITE_AUTOINDEX_MOZ_HOSTS_1 of table MOZ_HOSTS *********************

Percentage of total database......................   0.45%   
Number of entries................................. 628       
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 13000       39.7% 
B-tree depth...................................... 1         
Average payload per entry......................... 20.70     
Average unused bytes per entry.................... 28.46     
Maximum payload per entry......................... 47        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 17876       54.6% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 17876       54.6% 

*** Table MOZ_INPUTHISTORY and all its indices ********************************

Percentage of total database......................   0.90%   
Number of entries................................. 16        
Bytes of storage consumed......................... 65536     
Bytes of payload.................................. 642          0.98% 
Average payload per entry......................... 40.12     
Average unused bytes per entry.................... 4050.88   
Maximum payload per entry......................... 71        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 2         
Overflow pages used............................... 0         
Total pages used.................................. 2         
Unused bytes on primary pages..................... 64814       98.9% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 64814       98.9% 

*** Table MOZ_INPUTHISTORY w/o any indices ************************************

Percentage of total database......................   0.45%   
Number of entries................................. 8         
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 341          1.0% 
B-tree depth...................................... 1         
Average payload per entry......................... 42.62     
Average unused bytes per entry.................... 4047.38   
Maximum payload per entry......................... 71        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 32379       98.8% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32379       98.8% 

*** Index SQLITE_AUTOINDEX_MOZ_INPUTHISTORY_1 of table MOZ_INPUTHISTORY *******

Percentage of total database......................   0.45%   
Number of entries................................. 8         
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 301          0.92% 
B-tree depth...................................... 1         
Average payload per entry......................... 37.62     
Average unused bytes per entry.................... 4054.38   
Maximum payload per entry......................... 65        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 32435       99.0% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32435       99.0% 

*** Table MOZ_ITEMS_ANNOS and all its indices *********************************

Percentage of total database......................   0.90%   
Number of entries................................. 158       
Bytes of storage consumed......................... 65536     
Bytes of payload.................................. 9211        14.1% 
Average payload per entry......................... 58.30     
Average unused bytes per entry.................... 352.56    
Maximum payload per entry......................... 384       
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 2         
Overflow pages used............................... 0         
Total pages used.................................. 2         
Unused bytes on primary pages..................... 55704       85.0% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 55704       85.0% 

*** Table MOZ_ITEMS_ANNOS w/o any indices *************************************

Percentage of total database......................   0.45%   
Number of entries................................. 79        
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 8649        26.4% 
B-tree depth...................................... 1         
Average payload per entry......................... 109.48    
Average unused bytes per entry.................... 300.54    
Maximum payload per entry......................... 384       
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 23743       72.5% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 23743       72.5% 

*** Index MOZ_ITEMS_ANNOS_ITEMATTRIBUTEINDEX of table MOZ_ITEMS_ANNOS *********

Percentage of total database......................   0.45%   
Number of entries................................. 79        
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 562          1.7% 
B-tree depth...................................... 1         
Average payload per entry......................... 7.11      
Average unused bytes per entry.................... 404.57    
Maximum payload per entry......................... 9         
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 31961       97.5% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 31961       97.5% 

*** Table MOZ_KEYWORDS and all its indices ************************************

Percentage of total database......................   1.4%    
Number of entries................................. 0         
Bytes of storage consumed......................... 98304     
Bytes of payload.................................. 0            0.0% 
Average payload per entry......................... 0.0       
Average unused bytes per entry.................... 0.0       
Maximum payload per entry......................... 0         
Entries that use overflow......................... 0         
Primary pages used................................ 3         
Overflow pages used............................... 0         
Total pages used.................................. 3         
Unused bytes on primary pages..................... 98280       99.976% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 98280       99.976% 

*** Table MOZ_KEYWORDS w/o any indices ****************************************

Percentage of total database......................   0.45%   
Number of entries................................. 0         
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 0            0.0% 
B-tree depth...................................... 1         
Average payload per entry......................... 0.0       
Average unused bytes per entry.................... 0.0       
Maximum payload per entry......................... 0         
Entries that use overflow......................... 0         
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 32760       99.976% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32760       99.976% 

*** Indices of table MOZ_KEYWORDS *********************************************

Percentage of total database......................   0.90%   
Number of entries................................. 0         
Bytes of storage consumed......................... 65536     
Bytes of payload.................................. 0            0.0% 
Average payload per entry......................... 0.0       
Average unused bytes per entry.................... 0.0       
Maximum payload per entry......................... 0         
Entries that use overflow......................... 0         
Primary pages used................................ 2         
Overflow pages used............................... 0         
Total pages used.................................. 2         
Unused bytes on primary pages..................... 65520       99.976% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 65520       99.976% 

*** Index MOZ_KEYWORDS_PLACEPOSTDATA_UNIQUEINDEX of table MOZ_KEYWORDS ********

Percentage of total database......................   0.45%   
Number of entries................................. 0         
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 0            0.0% 
B-tree depth...................................... 1         
Average payload per entry......................... 0.0       
Average unused bytes per entry.................... 0.0       
Maximum payload per entry......................... 0         
Entries that use overflow......................... 0         
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 32760       99.976% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32760       99.976% 

*** Index SQLITE_AUTOINDEX_MOZ_KEYWORDS_1 of table MOZ_KEYWORDS ***************

Percentage of total database......................   0.45%   
Number of entries................................. 0         
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 0            0.0% 
B-tree depth...................................... 1         
Average payload per entry......................... 0.0       
Average unused bytes per entry.................... 0.0       
Maximum payload per entry......................... 0         
Entries that use overflow......................... 0         
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 32760       99.976% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32760       99.976% 

*** Table MOZ_PLACES and all its indices **************************************

Percentage of total database......................  64.3%    
Number of entries................................. 87087     
Bytes of storage consumed......................... 4653056   
Bytes of payload.................................. 3659043     78.6% 
Average payload per entry......................... 42.02     
Average unused bytes per entry.................... 7.93      
Average fanout.................................... 17.00     
Maximum payload per entry......................... 1867      
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 8         
Primary pages used................................ 134       
Overflow pages used............................... 0         
Total pages used.................................. 142       
Unused bytes on index pages....................... 252188      96.2% 
Unused bytes on primary pages..................... 438258      10.0% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 690446      14.8% 

*** Table MOZ_PLACES w/o any indices ******************************************

Percentage of total database......................  28.5%    
Number of entries................................. 10894     
Bytes of storage consumed......................... 2064384   
Bytes of payload.................................. 1838131     89.0% 
B-tree depth...................................... 2         
Average payload per entry......................... 168.73    
Average unused bytes per entry.................... 14.10     
Average fanout.................................... 62.00     
Non-sequential pages.............................. 30          48.4% 
Maximum payload per entry......................... 1867      
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 62        
Overflow pages used............................... 0         
Total pages used.................................. 63        
Unused bytes on index pages....................... 32207       98.3% 
Unused bytes on primary pages..................... 121406       6.0% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 153613       7.4% 

*** Indices of table MOZ_PLACES ***********************************************

Percentage of total database......................  35.7%    
Number of entries................................. 76193     
Bytes of storage consumed......................... 2588672   
Bytes of payload.................................. 1820912     70.3% 
Average payload per entry......................... 23.90     
Average unused bytes per entry.................... 7.05      
Average fanout.................................... 11.00     
Maximum payload per entry......................... 1823      
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 7         
Primary pages used................................ 72        
Overflow pages used............................... 0         
Total pages used.................................. 79        
Unused bytes on index pages....................... 219981      95.9% 
Unused bytes on primary pages..................... 316852      13.4% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 536833      20.7% 

*** Index MOZ_PLACES_FAVICONINDEX of table MOZ_PLACES *************************

Percentage of total database......................   2.3%    
Number of entries................................. 10891     
Bytes of storage consumed......................... 163840    
Bytes of payload.................................. 83178       50.8% 
B-tree depth...................................... 2         
Average payload per entry......................... 7.64      
Average unused bytes per entry.................... 4.40      
Average fanout.................................... 5.00      
Non-sequential pages.............................. 3           75.0% 
Maximum payload per entry......................... 8         
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 4         
Overflow pages used............................... 0         
Total pages used.................................. 5         
Unused bytes on index pages....................... 32711       99.83% 
Unused bytes on primary pages..................... 15213       11.6% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 47924       29.3% 

*** Index MOZ_PLACES_FRECENCYINDEX of table MOZ_PLACES ************************

Percentage of total database......................   2.3%    
Number of entries................................. 10891     
Bytes of storage consumed......................... 163840    
Bytes of payload.................................. 76772       46.9% 
B-tree depth...................................... 2         
Average payload per entry......................... 7.05      
Average unused bytes per entry.................... 4.99      
Average fanout.................................... 5.00      
Non-sequential pages.............................. 3           75.0% 
Maximum payload per entry......................... 9         
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 4         
Overflow pages used............................... 0         
Total pages used.................................. 5         
Unused bytes on index pages....................... 32714       99.84% 
Unused bytes on primary pages..................... 21616       16.5% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 54330       33.2% 

*** Index MOZ_PLACES_GUID_UNIQUEINDEX of table MOZ_PLACES *********************

Percentage of total database......................   4.1%    
Number of entries................................. 10887     
Bytes of storage consumed......................... 294912    
Bytes of payload.................................. 196000      66.5% 
B-tree depth...................................... 2         
Average payload per entry......................... 18.00     
Average unused bytes per entry.................... 6.07      
Average fanout.................................... 9.00      
Non-sequential pages.............................. 5           62.5% 
Maximum payload per entry......................... 18        
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 8         
Overflow pages used............................... 0         
Total pages used.................................. 9         
Unused bytes on index pages....................... 32581       99.43% 
Unused bytes on primary pages..................... 33545       12.8% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 66126       22.4% 

*** Index MOZ_PLACES_HOSTINDEX of table MOZ_PLACES ****************************

Percentage of total database......................   5.0%    
Number of entries................................. 10885     
Bytes of storage consumed......................... 360448    
Bytes of payload.................................. 237383      65.9% 
B-tree depth...................................... 2         
Average payload per entry......................... 21.81     
Average unused bytes per entry.................... 8.29      
Average fanout.................................... 11.00     
Non-sequential pages.............................. 7           70.0% 
Maximum payload per entry......................... 49        
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 10        
Overflow pages used............................... 0         
Total pages used.................................. 11        
Unused bytes on index pages....................... 32473       99.10% 
Unused bytes on primary pages..................... 57782       17.6% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 90255       25.0% 

*** Index MOZ_PLACES_LASTVISITDATEINDEX of table MOZ_PLACES *******************

Percentage of total database......................   3.2%    
Number of entries................................. 10889     
Bytes of storage consumed......................... 229376    
Bytes of payload.................................. 150784      65.7% 
B-tree depth...................................... 2         
Average payload per entry......................... 13.85     
Average unused bytes per entry.................... 4.21      
Average fanout.................................... 7.00      
Non-sequential pages.............................. 4           66.7% 
Maximum payload per entry......................... 14        
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 6         
Overflow pages used............................... 0         
Total pages used.................................. 7         
Unused bytes on index pages....................... 32651       99.64% 
Unused bytes on primary pages..................... 13179        6.7% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 45830       20.0% 

*** Index MOZ_PLACES_URL_UNIQUEINDEX of table MOZ_PLACES **********************

Percentage of total database......................  16.7%    
Number of entries................................. 10859     
Bytes of storage consumed......................... 1212416   
Bytes of payload.................................. 1010666     83.4% 
B-tree depth...................................... 2         
Average payload per entry......................... 93.07     
Average unused bytes per entry.................... 15.42     
Average fanout.................................... 37.00     
Non-sequential pages.............................. 16          44.4% 
Maximum payload per entry......................... 1823      
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 36        
Overflow pages used............................... 0         
Total pages used.................................. 37        
Unused bytes on index pages....................... 24134       73.7% 
Unused bytes on primary pages..................... 143261      12.1% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 167395      13.8% 

*** Index MOZ_PLACES_VISITCOUNT of table MOZ_PLACES ***************************

Percentage of total database......................   2.3%    
Number of entries................................. 10891     
Bytes of storage consumed......................... 163840    
Bytes of payload.................................. 66129       40.4% 
B-tree depth...................................... 2         
Average payload per entry......................... 6.07      
Average unused bytes per entry.................... 5.97      
Average fanout.................................... 5.00      
Non-sequential pages.............................. 3           75.0% 
Maximum payload per entry......................... 8         
Entries that use overflow......................... 0            0.0% 
Index pages used.................................. 1         
Primary pages used................................ 4         
Overflow pages used............................... 0         
Total pages used.................................. 5         
Unused bytes on index pages....................... 32717       99.84% 
Unused bytes on primary pages..................... 32256       24.6% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 64973       39.7% 

*** Table SQLITE_MASTER *******************************************************

Percentage of total database......................   0.45%   
Number of entries................................. 36        
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 5188        15.8% 
B-tree depth...................................... 1         
Average payload per entry......................... 144.11    
Average unused bytes per entry.................... 758.58    
Maximum payload per entry......................... 379       
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 27309       83.3% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 27309       83.3% 

*** Table SQLITE_SEQUENCE *****************************************************

Percentage of total database......................   0.45%   
Number of entries................................. 1         
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 15           0.046% 
B-tree depth...................................... 1         
Average payload per entry......................... 15.00     
Average unused bytes per entry.................... 32741.00  
Maximum payload per entry......................... 15        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 32741       99.918% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 32741       99.918% 

*** Table SQLITE_STAT1 ********************************************************

Percentage of total database......................   0.45%   
Number of entries................................. 15        
Bytes of storage consumed......................... 32768     
Bytes of payload.................................. 762          2.3% 
B-tree depth...................................... 1         
Average payload per entry......................... 50.80     
Average unused bytes per entry.................... 2128.20   
Maximum payload per entry......................... 62        
Entries that use overflow......................... 0            0.0% 
Primary pages used................................ 1         
Overflow pages used............................... 0         
Total pages used.................................. 1         
Unused bytes on primary pages..................... 31923       97.4% 
Unused bytes on overflow pages.................... 0         
Unused bytes on all pages......................... 31923       97.4% 

<a name="defs"></a>*** Definitions ***************************************************************

Page size in bytes

    The number of bytes in a single page of the database file.  
    Usually 1024.

Number of pages in the whole file

    The number of 32768-byte pages that go into forming the complete
    database

Pages that store data

    The number of pages that store data, either as primary B*Tree pages or
    as overflow pages.  The number at the right is the data pages divided by
    the total number of pages in the file.

Pages on the freelist

    The number of pages that are not currently in use but are reserved for
    future use.  The percentage at the right is the number of freelist pages
    divided by the total number of pages in the file.

Pages of auto-vacuum overhead

    The number of pages that store data used by the database to facilitate
    auto-vacuum. This is zero for databases that do not support auto-vacuum.

Number of tables in the database

    The number of tables in the database, including the SQLITE_MASTER table
    used to store schema information.

Number of indices

    The total number of indices in the database.

Number of defined indices

    The number of indices created using an explicit CREATE INDEX statement.

Number of implied indices

    The number of indices used to implement PRIMARY KEY or UNIQUE constraints
    on tables.

Size of the file in bytes

    The total amount of disk space used by the entire database files.

Bytes of user payload stored

    The total number of bytes of user payload stored in the database. The
    schema information in the SQLITE_MASTER table is not counted when
    computing this number.  The percentage at the right shows the payload
    divided by the total file size.

Percentage of total database

    The amount of the complete database file that is devoted to storing
    information described by this category.

Number of entries

    The total number of B-Tree key/value pairs stored under this category.

Bytes of storage consumed

    The total amount of disk space required to store all B-Tree entries
    under this category.  The is the total number of pages used times
    the pages size.

Bytes of payload

    The amount of payload stored under this category.  Payload is the data
    part of table entries and the key part of index entries.  The percentage
    at the right is the bytes of payload divided by the bytes of storage 
    consumed.

Average payload per entry

    The average amount of payload on each entry.  This is just the bytes of
    payload divided by the number of entries.

Average unused bytes per entry

    The average amount of free space remaining on all pages under this
    category on a per-entry basis.  This is the number of unused bytes on
    all pages divided by the number of entries.

Non-sequential pages

    The number of pages in the table or index that are out of sequence.
    Many filesystems are optimized for sequential file access so a small
    number of non-sequential pages might result in faster queries,
    especially for larger database files that do not fit in the disk cache.
    Note that after running VACUUM, the root page of each table or index is
    at the beginning of the database file and all other pages are in a
    separate part of the database file, resulting in a single non-
    sequential page.

Maximum payload per entry

    The largest payload size of any entry.

Entries that use overflow

    The number of entries that user one or more overflow pages.

Total pages used

    This is the number of pages used to hold all information in the current
    category.  This is the sum of index, primary, and overflow pages.

Index pages used

    This is the number of pages in a table B-tree that hold only key (rowid)
    information and no data.

Primary pages used

    This is the number of B-tree pages that hold both key and data.

Overflow pages used

    The total number of overflow pages used for this category.

Unused bytes on index pages

    The total number of bytes of unused space on all index pages.  The
    percentage at the right is the number of unused bytes divided by the
    total number of bytes on index pages.

Unused bytes on primary pages

    The total number of bytes of unused space on all primary pages.  The
    percentage at the right is the number of unused bytes divided by the
    total number of bytes on primary pages.

Unused bytes on overflow pages

    The total number of bytes of unused space on all overflow pages.  The
    percentage at the right is the number of unused bytes divided by the
    total number of bytes on overflow pages.

Unused bytes on all pages

    The total number of bytes of unused space on all primary and overflow 
    pages.  The percentage at the right is the number of unused bytes 
    divided by the total number of bytes.

<a name="sqlx"></a>*******************************************************************************
The entire text of this report can be sourced into any SQL database
engine for further analysis.  All of the text above is an SQL comment.
The data used to generate this report follows:
*/
BEGIN;
CREATE TABLE space_used(
   name clob,        -- Name of a table or index in the database file
   tblname clob,     -- Name of associated table
   is_index boolean, -- TRUE if it is an index, false for a table
   nentry int,       -- Number of entries in the BTree
   leaf_entries int, -- Number of leaf entries
   depth int,        -- Depth of the b-tree
   payload int,      -- Total amount of data stored in this table or index
   ovfl_payload int, -- Total amount of data stored on overflow pages
   ovfl_cnt int,     -- Number of entries that use overflow
   mx_payload int,   -- Maximum payload size
   int_pages int,    -- Number of interior pages used
   leaf_pages int,   -- Number of leaf pages used
   ovfl_pages int,   -- Number of overflow pages used
   int_unused int,   -- Number of unused bytes on interior pages
   leaf_unused int,  -- Number of unused bytes on primary pages
   ovfl_unused int,  -- Number of unused bytes on overflow pages
   gap_cnt int,      -- Number of gaps in the page layout
   compressed_size int  -- Total bytes stored on disk
);
INSERT INTO space_used VALUES('sqlite_master','sqlite_master',0,36,36,1,5188,0,0,379,0,1,0,0,27309,0,0,32768);
INSERT INTO space_used VALUES('moz_places','moz_places',0,10955,10894,2,1838131,0,0,1867,1,62,0,32207,121406,0,30,2064384);
INSERT INTO space_used VALUES('moz_historyvisits','moz_historyvisits',0,15884,15873,2,308447,0,0,21,1,12,0,32668,5435,0,8,425984);
INSERT INTO space_used VALUES('moz_inputhistory','moz_inputhistory',0,8,8,1,341,0,0,71,0,1,0,0,32379,0,0,32768);
INSERT INTO space_used VALUES('sqlite_autoindex_moz_inputhistory_1','moz_inputhistory',1,8,8,1,301,0,0,65,0,1,0,0,32435,0,0,32768);
INSERT INTO space_used VALUES('moz_hosts','moz_hosts',0,628,628,1,14640,0,0,49,0,1,0,0,15012,0,0,32768);
INSERT INTO space_used VALUES('sqlite_autoindex_moz_hosts_1','moz_hosts',1,628,628,1,13000,0,0,47,0,1,0,0,17876,0,0,32768);
INSERT INTO space_used VALUES('moz_bookmarks','moz_bookmarks',0,313,313,1,21937,0,0,518,0,1,0,0,9358,0,0,32768);
INSERT INTO space_used VALUES('moz_bookmarks_roots','moz_bookmarks_roots',0,5,5,1,47,0,0,11,0,1,0,0,32693,0,0,32768);
INSERT INTO space_used VALUES('sqlite_autoindex_moz_bookmarks_roots_1','moz_bookmarks_roots',1,5,5,1,47,0,0,11,0,1,0,0,32698,0,0,32768);
INSERT INTO space_used VALUES('moz_keywords','moz_keywords',0,0,0,1,0,0,0,0,0,1,0,0,32760,0,0,32768);
INSERT INTO space_used VALUES('sqlite_autoindex_moz_keywords_1','moz_keywords',1,0,0,1,0,0,0,0,0,1,0,0,32760,0,0,32768);
INSERT INTO space_used VALUES('sqlite_sequence','sqlite_sequence',0,1,1,1,15,0,0,15,0,1,0,0,32741,0,0,32768);
INSERT INTO space_used VALUES('moz_favicons','moz_favicons',0,481,471,2,297630,0,0,7640,1,11,0,32676,59923,0,6,393216);
INSERT INTO space_used VALUES('sqlite_autoindex_moz_favicons_1','moz_favicons',1,471,470,2,35135,0,0,7259,1,2,0,32664,29057,0,1,98304);
INSERT INTO space_used VALUES('moz_anno_attributes','moz_anno_attributes',0,12,12,1,355,0,0,42,0,1,0,0,32357,0,0,32768);
INSERT INTO space_used VALUES('sqlite_autoindex_moz_anno_attributes_1','moz_anno_attributes',1,12,12,1,366,0,0,43,0,1,0,0,32358,0,0,32768);
INSERT INTO space_used VALUES('moz_annos','moz_annos',0,195,195,1,12115,0,0,127,0,1,0,0,19702,0,0,32768);
INSERT INTO space_used VALUES('moz_items_annos','moz_items_annos',0,79,79,1,8649,0,0,384,0,1,0,0,23743,0,0,32768);
INSERT INTO space_used VALUES('sqlite_stat1','sqlite_stat1',0,15,15,1,762,0,0,62,0,1,0,0,31923,0,0,32768);
INSERT INTO space_used VALUES('moz_places_faviconindex','moz_places',1,10894,10891,2,83178,0,0,8,1,4,0,32711,15213,0,3,163840);
INSERT INTO space_used VALUES('moz_places_hostindex','moz_places',1,10894,10885,2,237383,0,0,49,1,10,0,32473,57782,0,7,360448);
INSERT INTO space_used VALUES('moz_places_visitcount','moz_places',1,10894,10891,2,66129,0,0,8,1,4,0,32717,32256,0,3,163840);
INSERT INTO space_used VALUES('moz_places_frecencyindex','moz_places',1,10894,10891,2,76772,0,0,9,1,4,0,32714,21616,0,3,163840);
INSERT INTO space_used VALUES('moz_places_lastvisitdateindex','moz_places',1,10894,10889,2,150784,0,0,14,1,6,0,32651,13179,0,4,229376);
INSERT INTO space_used VALUES('moz_historyvisits_placedateindex','moz_historyvisits',1,15873,15863,2,267273,0,0,17,1,11,0,32516,45668,0,8,393216);
INSERT INTO space_used VALUES('moz_historyvisits_fromindex','moz_historyvisits',1,15873,15869,2,100292,0,0,7,1,5,0,32702,15927,0,4,196608);
INSERT INTO space_used VALUES('moz_historyvisits_dateindex','moz_historyvisits',1,15873,15865,2,206221,0,0,13,1,9,0,32596,41128,0,6,327680);
INSERT INTO space_used VALUES('moz_bookmarks_itemindex','moz_bookmarks',1,313,313,1,2547,0,0,9,0,1,0,0,29274,0,0,32768);
INSERT INTO space_used VALUES('moz_bookmarks_parentindex','moz_bookmarks',1,313,313,1,2393,0,0,9,0,1,0,0,29428,0,0,32768);
INSERT INTO space_used VALUES('moz_bookmarks_itemlastmodifiedindex','moz_bookmarks',1,313,313,1,5020,0,0,17,0,1,0,0,26801,0,0,32768);
INSERT INTO space_used VALUES('moz_places_url_uniqueindex','moz_places',1,10894,10859,2,1010666,0,0,1823,1,36,0,24134,143261,0,16,1212416);
INSERT INTO space_used VALUES('moz_places_guid_uniqueindex','moz_places',1,10894,10887,2,196000,0,0,18,1,8,0,32581,33545,0,5,294912);
INSERT INTO space_used VALUES('moz_bookmarks_guid_uniqueindex','moz_bookmarks',1,313,313,1,5207,0,0,17,0,1,0,0,26614,0,0,32768);
INSERT INTO space_used VALUES('moz_annos_placeattributeindex','moz_annos',1,195,195,1,1871,0,0,10,0,1,0,0,30304,0,0,32768);
INSERT INTO space_used VALUES('moz_items_annos_itemattributeindex','moz_items_annos',1,79,79,1,562,0,0,9,0,1,0,0,31961,0,0,32768);
INSERT INTO space_used VALUES('moz_keywords_placepostdata_uniqueindex','moz_keywords',1,0,0,1,0,0,0,0,0,1,0,0,32760,0,0,32768);
COMMIT;
</pre>

Changes to pages/sqldiff.in.

1
2
3
4
5
6
7
8
9
10
11
12
13
<title>sqldiff.exe: Database Difference Utility</title>
<tcl>hd_keywords sqldiff sqldiff.exe</tcl>
<h2>The sqldiff.exe Utility Program</h2>

<p>
The <tt>sqldiff.exe</tt> is a command-line utility program that
displays the differences between SQLite databases.  Example
usage:

<blockquote><pre>
sqldiff &#91;options&#93; database1.sqlite database2.sqlite
</pre></blockquote>






|







1
2
3
4
5
6
7
8
9
10
11
12
13
<title>sqldiff.exe: Database Difference Utility</title>
<tcl>hd_keywords sqldiff sqldiff.exe</tcl>
<h2>The sqldiff.exe Utility Program</h2>

<p>
The <tt>sqldiff.exe</tt> binary is a command-line utility program that
displays the differences between SQLite databases.  Example
usage:

<blockquote><pre>
sqldiff &#91;options&#93; database1.sqlite database2.sqlite
</pre></blockquote>

Changes to pages/tclsqlite.in.

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

<dt><b>-readonly</b> <i>BOOLEAN</i></dt>
<dd><p>
If true, then open the database file read-only.  If false, then the
database is opened for both reading and writing if filesystem permissions
allow, or for reading only if filesystem write permission is denied
by the operating system.  The default setting is "false".  Note that
if the previous process to have the database did not exits cleanly
and left behind a [hot journal], then the write permission is required
to recover the database after opening, and the database cannot be
opened read-only.
</p></dd>

<dt><b>-uri</b> <i>BOOLEAN</i></dt>
<dd><p>
If true, then interpret the filename argument as a [URI filename].  If
false, then the argument is a literal filename.  The default value is
"false".
</p></dd>

<dt><b>-vfs</b> <i>VFSNAME</i></dt>
<dd><p>
Use an alternative [VFS] named by the argument.
</p></dd>

</dl>
</blockquote>

<p>
Once an SQLite database is open, it can be controlled using 
methods of the <i>dbcmd</i>.  There are currently 22 methods
defined.</p>

<p>
<ul>

<tcl>
foreach m [lsort {
 authorizer
 backup
 busy
 cache
 changes
 close
 collate







|




















<
<
<
<
<
<
<
<

|







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104








105
106
107
108
109
110
111
112
113

<dt><b>-readonly</b> <i>BOOLEAN</i></dt>
<dd><p>
If true, then open the database file read-only.  If false, then the
database is opened for both reading and writing if filesystem permissions
allow, or for reading only if filesystem write permission is denied
by the operating system.  The default setting is "false".  Note that
if the previous process to have the database did not exit cleanly
and left behind a [hot journal], then the write permission is required
to recover the database after opening, and the database cannot be
opened read-only.
</p></dd>

<dt><b>-uri</b> <i>BOOLEAN</i></dt>
<dd><p>
If true, then interpret the filename argument as a [URI filename].  If
false, then the argument is a literal filename.  The default value is
"false".
</p></dd>

<dt><b>-vfs</b> <i>VFSNAME</i></dt>
<dd><p>
Use an alternative [VFS] named by the argument.
</p></dd>

</dl>
</blockquote>









<tcl>
set method_list [lsort {
 authorizer
 backup
 busy
 cache
 changes
 close
 collate
141
142
143
144
145
146
147
148





















149
150
151
152
153

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
 total_changes
 trace
 transaction
 unlock_notify
 update_hook
 version
 wal_hook
}] {





















 hd_puts "<li><a href=\"#$m\">$m</a></li>"
}
</tcl>
</ul>
</p>


<p>The use of each of these methods will be explained in the sequel, though
not in the order shown above.</p>

<tcl>
##############################################################################
METHOD eval {
<p>
The most useful <i>dbcmd</i> method is "eval".  The eval method is used
to execute SQL on the database.  The syntax of the eval method looks
like this:</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>eval</b>&nbsp;&nbsp;<i>sql</i>
&nbsp;&nbsp;&nbsp;&nbsp;?<i>array-name&nbsp;</i>?&nbsp;?<i>script</i>?
</blockquote>

<p>
The job of the eval method is to execute the SQL statement or statements
given in the second argument.  For example, to create a new table in
a database, you can do this:</p>








|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|


|
|
>














|







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
 total_changes
 trace
 transaction
 unlock_notify
 update_hook
 version
 wal_hook
}]
</tcl>

<p>
Once an SQLite database is open, it can be controlled using 
methods of the <i>dbcmd</i>.
<tcl>
hd_puts "There are currently [llength $method_list] methods\n"
hd_puts "defined.</p>\n"
</tcl>

<table border=0 cellpadding=10 width='100%'>
<tr><td valign='top'><ul>
<tcl>
set nbr [expr {int(([llength $method_list]+2)/3)}]
set i -1
foreach m $method_list {
  incr i
  if {$i==$nbr} {
    hd_puts "</ul></td>\n<td valign='top'><ul>\n"
    set i 0
  }
  hd_puts "<li><a href=\"#$m\">$m</a></li>\n"
}
</tcl>
</ul></td></tr>
</table>


<p>The use of each of these methods will be explained in the sequel, though
not in the order shown above.</p>

<tcl>
##############################################################################
METHOD eval {
<p>
The most useful <i>dbcmd</i> method is "eval".  The eval method is used
to execute SQL on the database.  The syntax of the eval method looks
like this:</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>eval</b>&nbsp;&nbsp;<i>sql</i>
&nbsp;&nbsp;?<i>array-name</i>?&nbsp;&nbsp;?<i>script</i>?
</blockquote>

<p>
The job of the eval method is to execute the SQL statement or statements
given in the second argument.  For example, to create a new table in
a database, you can do this:</p>

279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
</p>

<p>
If the $bigstring variable has both a string and a "bytearray" representation,
then TCL inserts the value as a string.  If it has only a "bytearray"
representation, then the value is inserted as a BLOB.  To force a
value to be inserted as a BLOB even if it also has a text representation,
us a "@" character to in place of the "$".  Like this:
</p>

<blockquote><b>
db1 eval {INSERT INTO t1 VALUES(5,@bigstring)}
</b></blockquote>

<p>







|







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
</p>

<p>
If the $bigstring variable has both a string and a "bytearray" representation,
then TCL inserts the value as a string.  If it has only a "bytearray"
representation, then the value is inserted as a BLOB.  To force a
value to be inserted as a BLOB even if it also has a text representation,
use a "@" character to in place of the "$".  Like this:
</p>

<blockquote><b>
db1 eval {INSERT INTO t1 VALUES(5,@bigstring)}
</b></blockquote>

<p>
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378

<p>
The syntax looks like this:
</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>transaction</b>&nbsp;&nbsp;<i>?transaction-type?</i>
&nbsp;&nbsp;<i>SCRIPT,</i>
</blockquote>


<p>
The <i>transaction-type</i> can be one of <b>deferred</b>,
<b>exclusive</b> or <b>immediate</b>.  The default is deferred.
</p>







|







378
379
380
381
382
383
384
385
386
387
388
389
390
391
392

<p>
The syntax looks like this:
</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>transaction</b>&nbsp;&nbsp;<i>?transaction-type?</i>
&nbsp;&nbsp;<i>script</i>
</blockquote>


<p>
The <i>transaction-type</i> can be one of <b>deferred</b>,
<b>exclusive</b> or <b>immediate</b>.  The default is deferred.
</p>
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
The "copy" method copies data from a file into a table.
It returns the number of rows processed successfully from the file.
The syntax of the copy method looks like this:</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>copy</b>&nbsp;&nbsp;<i>conflict-algorithm</i>
&nbsp;&nbsp;<i>table-name&nbsp;</i>&nbsp;&nbsp;<i>file-name&nbsp;</i>
&nbsp;&nbsp;&nbsp;&nbsp;?<i>column-separator&nbsp;</i>?
&nbsp;&nbsp;?<i>null-indicator</i>?
</blockquote>

<p>Conflict-algorithm must be one of the SQLite conflict algorithms for
the INSERT statement: <i>rollback</i>, <i>abort</i>,
<i>fail</i>,<i>ignore</i>, or <i>replace</i>. See the SQLite Language
section for <a href="lang.html#conflict">ON CONFLICT</a> for more information.







|







446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
The "copy" method copies data from a file into a table.
It returns the number of rows processed successfully from the file.
The syntax of the copy method looks like this:</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>copy</b>&nbsp;&nbsp;<i>conflict-algorithm</i>
&nbsp;&nbsp;<i>table-name&nbsp;</i>&nbsp;&nbsp;<i>file-name&nbsp;</i>
&nbsp;&nbsp;&nbsp;&nbsp;?<i>column-separator</i>?
&nbsp;&nbsp;?<i>null-indicator</i>?
</blockquote>

<p>Conflict-algorithm must be one of the SQLite conflict algorithms for
the INSERT statement: <i>rollback</i>, <i>abort</i>,
<i>fail</i>,<i>ignore</i>, or <i>replace</i>. See the SQLite Language
section for <a href="lang.html#conflict">ON CONFLICT</a> for more information.
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
The default is an empty string.  Note that column-separator and
null-indicator are optional positional arguments; if null-indicator
is specified, a column-separator argument must be specified and
precede the null-indicator argument.</p>

<p>The copy method implements similar functionality to the <b>.import</b>
SQLite shell command. 
The SQLite 2.x <a href="lang.html#copy"><b>COPY</b></a> statement 
(using the PostgreSQL COPY file format)
can be implemented with this method as:</p>

<blockquote>
dbcmd&nbsp;&nbsp;copy&nbsp;&nbsp;$conflictalgo
&nbsp;&nbsp;$tablename&nbsp;&nbsp;&nbsp;$filename&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;\t&nbsp;
&nbsp;&nbsp;\\N
</blockquote>

}

##############################################################################
METHOD timeout {

<p>The "timeout" method is used to control how long the SQLite library
will wait for locks to clear before giving up on a database transaction.







<
<
<
<
<
<
<
<
<
<
<







473
474
475
476
477
478
479











480
481
482
483
484
485
486
The default is an empty string.  Note that column-separator and
null-indicator are optional positional arguments; if null-indicator
is specified, a column-separator argument must be specified and
precede the null-indicator argument.</p>

<p>The copy method implements similar functionality to the <b>.import</b>
SQLite shell command. 











}

##############################################################################
METHOD timeout {

<p>The "timeout" method is used to control how long the SQLite library
will wait for locks to clear before giving up on a database transaction.
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
##############################################################################
METHOD incrblob {

<p>This method opens a TCL channel that can be used to read or write
into a preexisting BLOB in the database.  The syntax is like this:</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>incrblob</b>&nbsp;&nbsp;<b>?-readonly??</b>
&nbsp;&nbsp;<i>?DB?&nbsp;&nbsp;TABLE&nbsp;&nbsp;COLUMN&nbsp;&nbsp;ROWID</i>
</blockquote>

<p>
The command returns a new TCL channel for reading or writing to the BLOB.
The channel is opened using the underlying 
<a href="c3ref/blob_open.html">sqlite3_blob_open()</a> C-language







|







783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
##############################################################################
METHOD incrblob {

<p>This method opens a TCL channel that can be used to read or write
into a preexisting BLOB in the database.  The syntax is like this:</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>incrblob</b>&nbsp;&nbsp;<b>?-readonly?</b>
&nbsp;&nbsp;<i>?DB?&nbsp;&nbsp;TABLE&nbsp;&nbsp;COLUMN&nbsp;&nbsp;ROWID</i>
</blockquote>

<p>
The command returns a new TCL channel for reading or writing to the BLOB.
The channel is opened using the underlying 
<a href="c3ref/blob_open.html">sqlite3_blob_open()</a> C-language
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
written.  <i>Backup-filename</i> does not have to exist ahead of time, but if
it does, it must be a well-formed SQLite database.</p>
}

##############################################################################
METHOD restore {

<p>The "restore" method copies the content a separate database file 
into the current database connection, overwriting any preexisting content.
The command syntax is like this:</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>restore</b>&nbsp;&nbsp;?<i>target-database</i>?&nbsp;&nbsp;<i>source-filename</i>
</blockquote>








|







837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
written.  <i>Backup-filename</i> does not have to exist ahead of time, but if
it does, it must be a well-formed SQLite database.</p>
}

##############################################################################
METHOD restore {

<p>The "restore" method copies the content from a separate database file 
into the current database connection, overwriting any preexisting content.
The command syntax is like this:</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>restore</b>&nbsp;&nbsp;?<i>target-database</i>?&nbsp;&nbsp;<i>source-filename</i>
</blockquote>