| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <title>Chapter 2. Access Method Configuration</title> |
| 7 | <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> |
| 10 | <link rel="up" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> |
| 11 | <link rel="prev" href="intro_products.html" title="The Berkeley DB products" /> |
| 12 | <link rel="next" href="am_conf_select.html" title="Selecting an access method" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">Chapter 2. |
| 22 | Access Method Configuration |
| 23 | </th> |
| 24 | </tr> |
| 25 | <tr> |
| 26 | <td width="20%" align="left"><a accesskey="p" href="intro_products.html">Prev</a> </td> |
| 27 | <th width="60%" align="center"> </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="am_conf_select.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="chapter" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title"><a id="am_conf"></a>Chapter 2. |
| 38 | Access Method Configuration |
| 39 | </h2> |
| 40 | </div> |
| 41 | </div> |
| 42 | </div> |
| 43 | <div class="toc"> |
| 44 | <p> |
| 45 | <b>Table of Contents</b> |
| 46 | </p> |
| 47 | <dl> |
| 48 | <dt> |
| 49 | <span class="sect1"> |
| 50 | <a href="am_conf.html#am_conf_intro"> |
| 51 | What are the available access methods? |
| 52 | </a> |
| 53 | </span> |
| 54 | </dt> |
| 55 | <dd> |
| 56 | <dl> |
| 57 | <dt> |
| 58 | <span class="sect2"> |
| 59 | <a href="am_conf.html#idp50599376">Btree</a> |
| 60 | </span> |
| 61 | </dt> |
| 62 | <dt> |
| 63 | <span class="sect2"> |
| 64 | <a href="am_conf.html#idp50705400">Hash</a> |
| 65 | </span> |
| 66 | </dt> |
| 67 | <dt> |
| 68 | <span class="sect2"> |
| 69 | <a href="am_conf.html#idp50708952">Heap</a> |
| 70 | </span> |
| 71 | </dt> |
| 72 | <dt> |
| 73 | <span class="sect2"> |
| 74 | <a href="am_conf.html#idm1385000">Queue</a> |
| 75 | </span> |
| 76 | </dt> |
| 77 | <dt> |
| 78 | <span class="sect2"> |
| 79 | <a href="am_conf.html#idp50715336">Recno</a> |
| 80 | </span> |
| 81 | </dt> |
| 82 | </dl> |
| 83 | </dd> |
| 84 | <dt> |
| 85 | <span class="sect1"> |
| 86 | <a href="am_conf_select.html">Selecting an access method</a> |
| 87 | </span> |
| 88 | </dt> |
| 89 | <dd> |
| 90 | <dl> |
| 91 | <dt> |
| 92 | <span class="sect2"> |
| 93 | <a href="am_conf_select.html#idp50702528">Btree or Heap?</a> |
| 94 | </span> |
| 95 | </dt> |
| 96 | <dt> |
| 97 | <span class="sect2"> |
| 98 | <a href="am_conf_select.html#idp50755552">Hash or Btree?</a> |
| 99 | </span> |
| 100 | </dt> |
| 101 | <dt> |
| 102 | <span class="sect2"> |
| 103 | <a href="am_conf_select.html#idp50569200">Queue or Recno?</a> |
| 104 | </span> |
| 105 | </dt> |
| 106 | </dl> |
| 107 | </dd> |
| 108 | <dt> |
| 109 | <span class="sect1"> |
| 110 | <a href="am_conf_logrec.html">Logical record numbers</a> |
| 111 | </span> |
| 112 | </dt> |
| 113 | <dt> |
| 114 | <span class="sect1"> |
| 115 | <a href="general_am_conf.html">General access method configuration</a> |
| 116 | </span> |
| 117 | </dt> |
| 118 | <dd> |
| 119 | <dl> |
| 120 | <dt> |
| 121 | <span class="sect2"> |
| 122 | <a href="general_am_conf.html#am_conf_pagesize">Selecting a page size</a> |
| 123 | </span> |
| 124 | </dt> |
| 125 | <dt> |
| 126 | <span class="sect2"> |
| 127 | <a href="general_am_conf.html#am_conf_cachesize">Selecting a cache size</a> |
| 128 | </span> |
| 129 | </dt> |
| 130 | <dt> |
| 131 | <span class="sect2"> |
| 132 | <a href="general_am_conf.html#am_conf_byteorder">Selecting a byte order</a> |
| 133 | </span> |
| 134 | </dt> |
| 135 | <dt> |
| 136 | <span class="sect2"> |
| 137 | <a href="general_am_conf.html#am_conf_dup">Duplicate data items</a> |
| 138 | </span> |
| 139 | </dt> |
| 140 | <dt> |
| 141 | <span class="sect2"> |
| 142 | <a href="general_am_conf.html#am_conf_malloc">Non-local memory allocation</a> |
| 143 | </span> |
| 144 | </dt> |
| 145 | </dl> |
| 146 | </dd> |
| 147 | <dt> |
| 148 | <span class="sect1"> |
| 149 | <a href="bt_conf.html">Btree access method specific configuration</a> |
| 150 | </span> |
| 151 | </dt> |
| 152 | <dd> |
| 153 | <dl> |
| 154 | <dt> |
| 155 | <span class="sect2"> |
| 156 | <a href="bt_conf.html#am_conf_bt_compare">Btree comparison</a> |
| 157 | </span> |
| 158 | </dt> |
| 159 | <dt> |
| 160 | <span class="sect2"> |
| 161 | <a href="bt_conf.html#am_conf_bt_prefix">Btree prefix comparison</a> |
| 162 | </span> |
| 163 | </dt> |
| 164 | <dt> |
| 165 | <span class="sect2"> |
| 166 | <a href="bt_conf.html#am_conf_bt_minkey">Minimum keys per page</a> |
| 167 | </span> |
| 168 | </dt> |
| 169 | <dt> |
| 170 | <span class="sect2"> |
| 171 | <a href="bt_conf.html#am_conf_bt_recnum">Retrieving Btree records by logical record number</a> |
| 172 | </span> |
| 173 | </dt> |
| 174 | <dt> |
| 175 | <span class="sect2"> |
| 176 | <a href="bt_conf.html#am_conf_bt_compress">Compression</a> |
| 177 | </span> |
| 178 | </dt> |
| 179 | </dl> |
| 180 | </dd> |
| 181 | <dt> |
| 182 | <span class="sect1"> |
| 183 | <a href="hash_conf.html">Hash access method specific configuration</a> |
| 184 | </span> |
| 185 | </dt> |
| 186 | <dd> |
| 187 | <dl> |
| 188 | <dt> |
| 189 | <span class="sect2"> |
| 190 | <a href="hash_conf.html#am_conf_h_ffactor">Page fill factor</a> |
| 191 | </span> |
| 192 | </dt> |
| 193 | <dt> |
| 194 | <span class="sect2"> |
| 195 | <a href="hash_conf.html#am_conf_h_hash">Specifying a database hash</a> |
| 196 | </span> |
| 197 | </dt> |
| 198 | <dt> |
| 199 | <span class="sect2"> |
| 200 | <a href="hash_conf.html#am_conf_h_nelem">Hash table size</a> |
| 201 | </span> |
| 202 | </dt> |
| 203 | </dl> |
| 204 | </dd> |
| 205 | <dt> |
| 206 | <span class="sect1"> |
| 207 | <a href="heap_conf.html">Heap access method specific configuration</a> |
| 208 | </span> |
| 209 | </dt> |
| 210 | <dt> |
| 211 | <span class="sect1"> |
| 212 | <a href="rq_conf.html">Queue and Recno access method specific configuration</a> |
| 213 | </span> |
| 214 | </dt> |
| 215 | <dd> |
| 216 | <dl> |
| 217 | <dt> |
| 218 | <span class="sect2"> |
| 219 | <a href="rq_conf.html#am_conf_recno">Managing record-based databases</a> |
| 220 | </span> |
| 221 | </dt> |
| 222 | <dt> |
| 223 | <span class="sect2"> |
| 224 | <a href="rq_conf.html#am_conf_extentsize">Selecting a Queue extent size</a> |
| 225 | </span> |
| 226 | </dt> |
| 227 | <dt> |
| 228 | <span class="sect2"> |
| 229 | <a href="rq_conf.html#am_conf_re_source">Flat-text backing files</a> |
| 230 | </span> |
| 231 | </dt> |
| 232 | <dt> |
| 233 | <span class="sect2"> |
| 234 | <a href="rq_conf.html#am_conf_renumber">Logically renumbering records</a> |
| 235 | </span> |
| 236 | </dt> |
| 237 | </dl> |
| 238 | </dd> |
| 239 | </dl> |
| 240 | </div> |
| 241 | <div class="sect1" lang="en" xml:lang="en"> |
| 242 | <div class="titlepage"> |
| 243 | <div> |
| 244 | <div> |
| 245 | <h2 class="title" style="clear: both"><a id="am_conf_intro"></a> |
| 246 | What are the available access methods? |
| 247 | </h2> |
| 248 | </div> |
| 249 | </div> |
| 250 | </div> |
| 251 | <div class="toc"> |
| 252 | <dl> |
| 253 | <dt> |
| 254 | <span class="sect2"> |
| 255 | <a href="am_conf.html#idp50599376">Btree</a> |
| 256 | </span> |
| 257 | </dt> |
| 258 | <dt> |
| 259 | <span class="sect2"> |
| 260 | <a href="am_conf.html#idp50705400">Hash</a> |
| 261 | </span> |
| 262 | </dt> |
| 263 | <dt> |
| 264 | <span class="sect2"> |
| 265 | <a href="am_conf.html#idp50708952">Heap</a> |
| 266 | </span> |
| 267 | </dt> |
| 268 | <dt> |
| 269 | <span class="sect2"> |
| 270 | <a href="am_conf.html#idm1385000">Queue</a> |
| 271 | </span> |
| 272 | </dt> |
| 273 | <dt> |
| 274 | <span class="sect2"> |
| 275 | <a href="am_conf.html#idp50715336">Recno</a> |
| 276 | </span> |
| 277 | </dt> |
| 278 | </dl> |
| 279 | </div> |
| 280 | <p> |
| 281 | Berkeley DB currently offers five access methods: Btree, Hash, Heap, Queue and Recno. |
| 282 | </p> |
| 283 | <div class="sect2" lang="en" xml:lang="en"> |
| 284 | <div class="titlepage"> |
| 285 | <div> |
| 286 | <div> |
| 287 | <h3 class="title"><a id="idp50599376"></a>Btree</h3> |
| 288 | </div> |
| 289 | </div> |
| 290 | </div> |
| 291 | <p> |
| 292 | The Btree access method is an implementation of a sorted, balanced |
| 293 | tree structure. Searches, insertions, and deletions in the tree |
| 294 | all take <span class="emphasis"><em>O(height)</em></span> time, where |
| 295 | <span class="emphasis"><em>height</em></span> is the number of levels in the |
| 296 | Btree from the root to the leaf pages. The upper bound on the |
| 297 | height is <span class="emphasis"><em>log base_b N</em></span>, where |
| 298 | <span class="emphasis"><em>base_b</em></span> is the smallest number of keys on a |
| 299 | page, and <span class="emphasis"><em>N</em></span> is the total number of keys |
| 300 | stored. |
| 301 | </p> |
| 302 | <p> |
| 303 | Inserting unordered data into a Btree can result in pages that |
| 304 | are only half-full. DB makes ordered (or inverse ordered) |
| 305 | insertion the best case, resulting in nearly full-page space |
| 306 | utilization. |
| 307 | </p> |
| 308 | </div> |
| 309 | <div class="sect2" lang="en" xml:lang="en"> |
| 310 | <div class="titlepage"> |
| 311 | <div> |
| 312 | <div> |
| 313 | <h3 class="title"><a id="idp50705400"></a>Hash</h3> |
| 314 | </div> |
| 315 | </div> |
| 316 | </div> |
| 317 | <p> |
| 318 | The Hash access method data structure is an implementation of |
| 319 | Extended Linear Hashing, as described in "Linear Hashing: A New |
| 320 | Tool for File and Table Addressing", Witold Litwin, |
| 321 | <span class="emphasis"><em>Proceedings of the 6th International Conference on Very |
| 322 | Large Databases (VLDB)</em></span>, 1980. |
| 323 | </p> |
| 324 | </div> |
| 325 | <div class="sect2" lang="en" xml:lang="en"> |
| 326 | <div class="titlepage"> |
| 327 | <div> |
| 328 | <div> |
| 329 | <h3 class="title"><a id="idp50708952"></a>Heap</h3> |
| 330 | </div> |
| 331 | </div> |
| 332 | </div> |
| 333 | <p> |
| 334 | The Heap access method stores records in a heap file. Records |
| 335 | are referenced solely by the page and offset at which they are |
| 336 | written. Because records are written in a heap file, compaction |
| 337 | is not necessary when deleting records, which allows for more |
| 338 | efficient use of space than if Btree is in use. The Heap access |
| 339 | method is intended for platforms with constrained disk space, |
| 340 | especially if those systems are performing a great many record |
| 341 | creation and deletions. |
| 342 | </p> |
| 343 | </div> |
| 344 | <div class="sect2" lang="en" xml:lang="en"> |
| 345 | <div class="titlepage"> |
| 346 | <div> |
| 347 | <div> |
| 348 | <h3 class="title"><a id="idm1385000"></a>Queue</h3> |
| 349 | </div> |
| 350 | </div> |
| 351 | </div> |
| 352 | <p> |
| 353 | The Queue access method stores fixed-length records with logical |
| 354 | record numbers as keys. It is designed for fast inserts at the |
| 355 | tail and has a special cursor consume operation that deletes and |
| 356 | returns a record from the head of the queue. The Queue access |
| 357 | method uses record level locking. |
| 358 | </p> |
| 359 | </div> |
| 360 | <div class="sect2" lang="en" xml:lang="en"> |
| 361 | <div class="titlepage"> |
| 362 | <div> |
| 363 | <div> |
| 364 | <h3 class="title"><a id="idp50715336"></a>Recno</h3> |
| 365 | </div> |
| 366 | </div> |
| 367 | </div> |
| 368 | <p> |
| 369 | The Recno access method stores both fixed and variable-length |
| 370 | records with logical record numbers as keys, optionally backed by a |
| 371 | flat text (byte stream) file. |
| 372 | </p> |
| 373 | </div> |
| 374 | </div> |
| 375 | </div> |
| 376 | <div class="navfooter"> |
| 377 | <hr /> |
| 378 | <table width="100%" summary="Navigation footer"> |
| 379 | <tr> |
| 380 | <td width="40%" align="left"><a accesskey="p" href="intro_products.html">Prev</a> </td> |
| 381 | <td width="20%" align="center"> </td> |
| 382 | <td width="40%" align="right"> <a accesskey="n" href="am_conf_select.html">Next</a></td> |
| 383 | </tr> |
| 384 | <tr> |
| 385 | <td width="40%" align="left" valign="top">The Berkeley DB products </td> |
| 386 | <td width="20%" align="center"> |
| 387 | <a accesskey="h" href="index.html">Home</a> |
| 388 | </td> |
| 389 | <td width="40%" align="right" valign="top"> Selecting an access method</td> |
| 390 | </tr> |
| 391 | </table> |
| 392 | </div> |
| 393 | </body> |
| 394 | </html> |