/ Check-in [4f00e27f]
Login

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

Overview
Comment:Perpare to fork SQLite2.0 develop into a separate tree (CVS 184)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:4f00e27f17a15504543c5bbb8765c88bacd7257e
User & Date: drh 2001-02-11 16:58:22
Context
2001-02-11
17:00
Version 1.0.20 (CVS 484) check-in: eb0a523c user: drh tags: trunk
16:58
Perpare to fork SQLite2.0 develop into a separate tree (CVS 184) check-in: 4f00e27f user: drh tags: trunk
16:56
Perpare to fork SQLite2.0 develop into a separate tree (CVS 183) check-in: 6adb6078 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added src/ex/sizes.tcl.



















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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

set sizes {1024 2048 4096 8192 16384 32768}
set fmt { %-8s}

puts -nonewline "page size: "
foreach s $sizes {
  puts -nonewline [format $fmt $s]
}
puts ""

puts -nonewline "on leaf:   "
foreach s $sizes {
  set x [expr {$s - 18*4}]
  set p($s) $x
  puts -nonewline [format $fmt $x]
}
puts ""

puts -nonewline "direct:    "
foreach s $sizes {
  set x [expr {$p($s) + 10*$s}]
  set p($s) $x
  puts -nonewline [format $fmt $x]
}
puts ""

puts -nonewline "indirect:  "
foreach s $sizes {
  set x [expr {$p($s) + ($s/4.0)*$s}]
  set p($s) $x
  puts -nonewline [format $fmt $x]
}
puts ""

puts -nonewline "dbl indir: "
foreach s $sizes {
  set x [expr {$p($s) + ($s/4.0)*($s/4)*$s}]
  set p($s) $x
  puts -nonewline [format $fmt $x]
}
puts ""

Added tool/report1.txt.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
The SQL database used for ACD contains 113 tables and indices implemented
in GDBM.  The following are statistics on the sizes of keys and data
within these tables and indices.

Entries:      962080
Size:         45573853
Avg Size:     48
Key Size:     11045299
Avg Key Size: 12
Max Key Size: 99


 Size of key              Cummulative
  and data     Instances  Percentage
------------  ----------  -----------
    0..8            266    0%
    9..12          5485    0%
   13..16         73633    8%
   17..24        180918   27%
   25..32        209823   48%
   33..40        148995   64%
   41..48         76304   72%
   49..56         14346   73%
   57..64         15725   75%
   65..80         44916   80%
   81..96        127815   93%
   97..112        34769   96%
  113..128        13314   98%
  129..144         8098   99%
  145..160         3355   99%
  161..176         1159   99%
  177..192          629   99%
  193..208          221   99%
  209..224          210   99%
  225..240          129   99%
  241..256           57   99%
  257..288          496   99%
  289..320           60   99%
  321..352           37   99%
  353..384           46   99%
  385..416           22   99%
  417..448           24   99%
  449..480           26   99%
  481..512           27   99%
  513..1024         471   99%
 1025..2048         389   99%
 2049..4096         182   99%
 4097..8192          74   99%
 8193..16384         34   99%
16385..32768         17   99%
32769..65536          5   99%
65537..131073         3  100%


This information is gathered to help design the new built-in
backend for sqlite 2.0.  Note in particular that 99% of all
database entries have a combined key and data size of less than
144 bytes.  So if a leaf node in the new database is able to
store 144 bytes of combined key and data, only 1% of the leaves
will require overflow pages.  Furthermore, note that no key
is larger than 99 bytes, so if the key will never be on an
overflow page.

The average combined size of key+data is 48.  Add in 16 bytes of
overhead for a total of 64.  That means that a 1K page will
store (on average) about 16 entries.

Added www/dynload.tcl.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#
# Run this Tcl script to generate the dynload.html file.
#
set rcsid {$Id: dynload.tcl,v 1.1 2001/02/11 16:58:22 drh Exp $}

puts {<html>
<head>
  <title>How to build a dynamically loaded Tcl extension for SQLite</title>
</head>
<body bgcolor=white>
<h1 align=center>
How To Build A Dynamically Loaded Tcl Extension
</h1>}
puts {<p>
<i>This note was contributed by 
<a href="bsaunder@tampabay.rr.com.nospam">Bill Saunders</a>.  Thanks, Bill!</i>

<p>
To compile the SQLite Tcl extension into a dynamically loaded module 
I did the following:
</p>

<ol>
<li><p>Do a standard compile
(I had a dir called bld at the same level as sqlite  ie
        /root/bld
        /root/sqlite
I followed the directions and did a standard build in the bld
directory)</p></li>

<li><p>
Now do the following in the bld directory
<blockquote><pre>
gcc -shared -I. -lgdbm ../sqlite/src/tclsqlite.c libsqlite.a -o sqlite.so
</pre></blockquote></p></li>

<li><p>
This should produce the file sqlite.so in the bld directory</p></li>

<li><p>
Create a pkgIndex.tcl file that contains this line

<blockquote><pre>
package ifneeded sqlite 1.0 [list load [file join $dir sqlite.so]]
</pre></blockquote></p></li>

<li><p>
To use this put sqlite.so and pkgIndex.tcl in the same directory</p></li>

<li><p>
From that directory start wish</p></li>

<li><p>
Execute the following tcl command (tells tcl where to fine loadable
modules)
<blockquote><pre>
lappend auto_path [exec pwd]
</pre></blockquote></p></li>

<li><p>
Load the package 
<blockquote><pre>
package require sqlite
</pre></blockquote></p></li>

<li><p>
Have fun....</p></li>
</ul>

</body></html>}