summaryrefslogtreecommitdiff
path: root/docs/programmer_reference/am_conf.html
blob: c041c004824415d6cd29232e57cc1a0b841675c7 (plain)
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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Chapter 2.  Access Method Configuration</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
    <link rel="up" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
    <link rel="prev" href="intro_products.html" title="The Berkeley DB products" />
    <link rel="next" href="am_conf_select.html" title="Selecting an access method" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 12.1.6.1</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Chapter 2.  Access Method Configuration </th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="intro_products.html">Prev</a> </td>
          <th width="60%" align="center"> </th>
          <td width="20%" align="right"> <a accesskey="n" href="am_conf_select.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="chapter" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title"><a id="am_conf"></a>Chapter 2.  Access Method Configuration </h2>
          </div>
        </div>
      </div>
      <div class="toc">
        <p>
          <b>Table of Contents</b>
        </p>
        <dl>
          <dt>
            <span class="sect1">
              <a href="am_conf.html#am_conf_intro"> What are the available access
        methods? </a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="sect2">
                  <a href="am_conf.html#idm2727912">Btree</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="am_conf.html#idm1674312">Hash</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="am_conf.html#idm1985432">Heap</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="am_conf.html#idm1872368">Queue</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="am_conf.html#idm1924872">Recno</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="sect1">
              <a href="am_conf_select.html">Selecting an access method</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="sect2">
                  <a href="am_conf_select.html#idm2274400">Btree or Heap?</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="am_conf_select.html#idm2915784">Hash or Btree?</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="am_conf_select.html#idm2732704">Queue or Recno?</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="sect1">
              <a href="am_conf_logrec.html">Logical record numbers</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="general_am_conf.html">General access method configuration</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="sect2">
                  <a href="general_am_conf.html#am_conf_pagesize">Selecting a page size</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="general_am_conf.html#am_conf_cachesize">Selecting a cache size</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="general_am_conf.html#am_conf_byteorder">Selecting a byte order</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="general_am_conf.html#am_conf_dup">Duplicate data items</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="general_am_conf.html#am_conf_malloc">Non-local memory
        allocation</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="sect1">
              <a href="bt_conf.html">Btree access method specific configuration</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="sect2">
                  <a href="bt_conf.html#am_conf_bt_compare">Btree comparison</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="bt_conf.html#am_conf_bt_prefix">Btree prefix
        comparison</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="bt_conf.html#am_conf_bt_minkey">Minimum keys per page</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="bt_conf.html#am_conf_bt_recnum">Retrieving Btree records by logical record number</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="bt_conf.html#am_conf_bt_compress">Compression</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="sect1">
              <a href="hash_conf.html">Hash access method specific
        configuration</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="sect2">
                  <a href="hash_conf.html#am_conf_h_ffactor">Page fill factor</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="hash_conf.html#am_conf_h_hash">Specifying a database hash</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="hash_conf.html#am_conf_h_nelem">Hash table size</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="sect1">
              <a href="heap_conf.html">Heap access method specific
        configuration</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="rq_conf.html">Queue and Recno access method specific configuration</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="sect2">
                  <a href="rq_conf.html#am_conf_recno">Managing record-based
        databases</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="rq_conf.html#am_conf_extentsize">Selecting a Queue extent
        size</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="rq_conf.html#am_conf_re_source">Flat-text backing
        files</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="rq_conf.html#am_conf_renumber">Logically renumbering
        records</a>
                </span>
              </dt>
            </dl>
          </dd>
        </dl>
      </div>
      <div class="sect1" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title" style="clear: both"><a id="am_conf_intro"></a> What are the available access
        methods? </h2>
            </div>
          </div>
        </div>
        <div class="toc">
          <dl>
            <dt>
              <span class="sect2">
                <a href="am_conf.html#idm2727912">Btree</a>
              </span>
            </dt>
            <dt>
              <span class="sect2">
                <a href="am_conf.html#idm1674312">Hash</a>
              </span>
            </dt>
            <dt>
              <span class="sect2">
                <a href="am_conf.html#idm1985432">Heap</a>
              </span>
            </dt>
            <dt>
              <span class="sect2">
                <a href="am_conf.html#idm1872368">Queue</a>
              </span>
            </dt>
            <dt>
              <span class="sect2">
                <a href="am_conf.html#idm1924872">Recno</a>
              </span>
            </dt>
          </dl>
        </div>
        <p> 
        Berkeley DB currently offers five access methods: Btree,
        Hash, Heap, Queue and Recno.
    </p>
        <div class="sect2" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="idm2727912"></a>Btree</h3>
              </div>
            </div>
          </div>
          <p> 
            The Btree access method is an implementation of a
            sorted, balanced tree structure. Searches, insertions, and
            deletions in the tree all take
            <span class="emphasis"><em>O(height)</em></span> time, where
            <span class="emphasis"><em>height</em></span> is the number of levels in
            the Btree from the root to the leaf pages. The upper bound
            on the height is <span class="emphasis"><em>log base_b N</em></span>, where
            <span class="emphasis"><em>base_b</em></span> is the smallest number of
            keys on a page, and <span class="emphasis"><em>N</em></span> is the total
            number of keys stored. 
        </p>
          <p> 
            Inserting unordered data into a Btree can result in
            pages that are only half-full. DB makes ordered (or
            inverse ordered) insertion the best case, resulting in
            nearly full-page space utilization.
        </p>
        </div>
        <div class="sect2" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="idm1674312"></a>Hash</h3>
              </div>
            </div>
          </div>
          <p>
            The Hash access method data structure is an
            implementation of Extended Linear Hashing, as described in
            "Linear Hashing: A New Tool for File and Table
            Addressing", Witold Litwin, <span class="emphasis"><em>Proceedings of the
            6th International Conference on Very Large Databases
            (VLDB)</em></span>, 1980. 
        </p>
        </div>
        <div class="sect2" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="idm1985432"></a>Heap</h3>
              </div>
            </div>
          </div>
          <p>
            The Heap access method stores records in a heap file.
            Records are referenced solely by the page and offset at
            which they are written. Because records are written in a
            heap file, compaction is not necessary when deleting
            records, which allows for more efficient use of space than
            if Btree is in use. The Heap access method is intended for
            platforms with constrained disk space, especially if those
            systems are performing a great many record creation and
            deletions.
        </p>
        </div>
        <div class="sect2" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="idm1872368"></a>Queue</h3>
              </div>
            </div>
          </div>
          <p> 
            The Queue access method stores fixed-length records
            with logical record numbers as keys. It is designed for
            fast inserts at the tail and has a special cursor consume
            operation that deletes and returns a record from the head
            of the queue. The Queue access method uses record level
            locking.
        </p>
        </div>
        <div class="sect2" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="idm1924872"></a>Recno</h3>
              </div>
            </div>
          </div>
          <p>
            The Recno access method stores both fixed and
            variable-length records with logical record numbers as
            keys, optionally backed by a flat text (byte stream) file.
        </p>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="intro_products.html">Prev</a> </td>
          <td width="20%" align="center"> </td>
          <td width="40%" align="right"> <a accesskey="n" href="am_conf_select.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">The Berkeley DB products </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Selecting an access method</td>
        </tr>
      </table>
    </div>
  </body>
</html>