Debian Codegraph @

docs/bdb-sql/selectpage_size.html

raw symbols SCIP
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>Selecting the Page Size</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="Getting Started with the Oracle Berkeley DB SQL APIs" />
10 <link rel="up" href="dbfeatures.html" title="Chapter 3. Berkeley DB Features" />
11 <link rel="prev" href="mvcc.html" title="Using Multiversion Concurrency Control" />
12 <link rel="next" href="sqlrep.html" title="Chapter 4. Using Replication with the SQL API" />
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">Selecting the Page Size</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="mvcc.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 3. Berkeley DB Features</th>
26 <td width="20%" align="right"> <a accesskey="n" href="sqlrep.html">Next</a></td>
27 </tr>
28 </table>
29 <hr />
30 </div>
31 <div class="sect1" lang="en" xml:lang="en">
32 <div class="titlepage">
33 <div>
34 <div>
35 <h2 class="title" style="clear: both"><a id="selectpage_size"></a>Selecting the Page Size</h2>
36 </div>
37 </div>
38 </div>
39 <p>
40 When using the BDB SQL interface, you configure your database page size in
41 exactly the same way as you do when using
42 SQLite. That is, use <code class="literal">PRAGMA page_size</code>
43 to report and set the page size. This PRAGMA must be called
44 before you create your first SQLite table. See the
45 <a class="ulink" href="http://www.sqlite.org/pragma.html#pragma_page_size" target="_top">PRAGMA page_size</a>
46 documentation for more information.
47 </p>
48 <p>
49 When you use
50 <code class="literal">PRAGMA cache_size</code> to size your in-memory
51 cache, you provide the cache size in terms of a number of
52 pages. Therefore, your database page size influences how large your
53 cache is, and so determines how much of your
54 database will fit into memory.
55 </p>
56 <p>
57 The size of your pages can also affect how efficient your
58 application is at performing disk I/O. It will also
59 determine just how fine-grained the fine-grained locking
60 actually is. This is because Berkeley DB locks database pages
61 when it acquires a lock.
62 </p>
63 <p>
64 Note that the default value for your page size is
65 probably correct for the physical hardware that you are using. In
66 almost all situations, the default page size value will
67 give your application the best possible I/O performance. For
68 this reason, tuning the page size should rarely, if
69 ever, be attempted.
70 </p>
71 <p>
72 That said, when using the BDB SQL interface, the page size affects
73 how much of your tables are locked when read and/or
74 write locks are acquired. (See
75 <a class="xref" href="lockingnotes.html#dbusage" title="Internal Database Usage">Internal Database Usage</a>
76 for more information.)
77 Increasing your page size will typically improve the
78 bandwidth you get accessing the disk, but it also may
79 increase contention if too many key data pairs are on
80 the same page. Decreasing your page size frequently
81 improves concurrency, but may increase the number of
82 locks you need to acquire and may decrease your disk
83 bandwidth.
84 </p>
85 <p>
86 When changing your page size, make sure the value you
87 select is a power of 2 that is greater than 512 and
88 less than or equal to 64KB. (Note that the standard
89 SQLite <code class="literal">MAX_PAGE_SIZE</code> limit is not
90 examined for this upper bound.)
91 </p>
92 <p>
93 Beyond that, there are some additional things
94 that you need to consider when selecting your page
95 size. For a thorough treatment of selecting your page size,
96 see the section on <span><a href="../programmer_reference/general_am_conf.html#am_conf_pagesize" class="olink">Selecting a page size</a></span>
97 in the
98 <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.
99 </p>
100 </div>
101 <div class="navfooter">
102 <hr />
103 <table width="100%" summary="Navigation footer">
104 <tr>
105 <td width="40%" align="left"><a accesskey="p" href="mvcc.html">Prev</a> </td>
106 <td width="20%" align="center">
107 <a accesskey="u" href="dbfeatures.html">Up</a>
108 </td>
109 <td width="40%" align="right"> <a accesskey="n" href="sqlrep.html">Next</a></td>
110 </tr>
111 <tr>
112 <td width="40%" align="left" valign="top">Using Multiversion Concurrency Control </td>
113 <td width="20%" align="center">
114 <a accesskey="h" href="index.html">Home</a>
115 </td>
116 <td width="40%" align="right" valign="top"> Chapter 4. Using Replication with the SQL API</td>
117 </tr>
118 </table>
119 </div>
120 </body>
121 </html>