| 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>Changed PRAGMAs</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="dbsqlbasics.html" title="Chapter 1. Berkeley DB SQL: The Absolute Basics" /> |
| 11 | <link rel="prev" href="unsupportedpragmas.html" title="Unsupported PRAGMAs" /> |
| 12 | <link rel="next" href="addedpragmas.html" title="Added PRAGMAs" /> |
| 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">Changed PRAGMAs</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="unsupportedpragmas.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 1. Berkeley DB SQL: The Absolute Basics</th> |
| 26 | <td width="20%" align="right"> <a accesskey="n" href="addedpragmas.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="changedpragmas"></a>Changed PRAGMAs</h2> |
| 36 | </div> |
| 37 | </div> |
| 38 | </div> |
| 39 | <div class="toc"> |
| 40 | <dl> |
| 41 | <dt> |
| 42 | <span class="sect2"> |
| 43 | <a href="changedpragmas.html#auto_vacuum">PRAGMA auto_vacuum</a> |
| 44 | </span> |
| 45 | </dt> |
| 46 | <dt> |
| 47 | <span class="sect2"> |
| 48 | <a href="changedpragmas.html#incremental_vacuum">PRAGMA incremental_vacuum</a> |
| 49 | </span> |
| 50 | </dt> |
| 51 | <dt> |
| 52 | <span class="sect2"> |
| 53 | <a href="changedpragmas.html#journal_size_limit">PRAGMA journal_size_limit</a> |
| 54 | </span> |
| 55 | </dt> |
| 56 | </dl> |
| 57 | </div> |
| 58 | <p> |
| 59 | The following PRAGMAs are available in the BDB SQL interface, but they |
| 60 | behave differently in some way from standard SQLite. |
| 61 | </p> |
| 62 | <div class="sect2" lang="en" xml:lang="en"> |
| 63 | <div class="titlepage"> |
| 64 | <div> |
| 65 | <div> |
| 66 | <h3 class="title"><a id="auto_vacuum"></a>PRAGMA auto_vacuum</h3> |
| 67 | </div> |
| 68 | </div> |
| 69 | </div> |
| 70 | <p> |
| 71 | The syntax for this PRAGMA is: |
| 72 | </p> |
| 73 | <pre class="programlisting">PRAGMA auto_vacuum |
| 74 | PRAGMA auto_vacuum = 0 | NONE | 1 | FULL | 2 | INCREMENTAL </pre> |
| 75 | <p> |
| 76 | Standard SQLite does not allow you to enable or |
| 77 | disable auto-vacuum after a table has been created. |
| 78 | Berkeley DB, however, allows you to change this at any time. |
| 79 | </p> |
| 80 | <p> |
| 81 | In the previous syntax, <code class="literal">0</code> and |
| 82 | <code class="literal">NONE</code> both turn off auto vacuuming. |
| 83 | </p> |
| 84 | <p> |
| 85 | <code class="literal">1</code> or <code class="literal">FULL</code> causes |
| 86 | full vacuuming to occur. That is, the BDB SQL interface will vacuum |
| 87 | the entire database at each commit using a very low |
| 88 | fill percentage (1%) in order to return emptied pages |
| 89 | to the file system. Because Berkeley DB allows you to call |
| 90 | this PRAGMA at any time, it is recommended that you do |
| 91 | not turn on FULL vacuuming because doing so can result |
| 92 | in a great deal of overhead to your transaction |
| 93 | commits. |
| 94 | </p> |
| 95 | <p> |
| 96 | If <code class="literal">2</code> or <code class="literal">INCREMENTAL</code> |
| 97 | is used, then incremental vacuuming is enabled. The |
| 98 | amount of vacuuming that is performed for incremental |
| 99 | vacuum is controlled using the following PRAGMAs: |
| 100 | </p> |
| 101 | <table class="simplelist" border="0" summary="Simple list"> |
| 102 | <tr> |
| 103 | <td> |
| 104 | <a class="xref" href="addedpragmas.html#bdbsql_vacuum_fillpercent" title="PRAGMA bdbsql_vacuum_fillpercent">PRAGMA bdbsql_vacuum_fillpercent</a> |
| 105 | </td> |
| 106 | </tr> |
| 107 | <tr> |
| 108 | <td> |
| 109 | <a class="xref" href="addedpragmas.html#bdbsql_vacuum_pages" title="PRAGMA bdbsql_vacuum_pages">PRAGMA bdbsql_vacuum_pages</a> |
| 110 | </td> |
| 111 | </tr> |
| 112 | </table> |
| 113 | <p> |
| 114 | Note that you can call |
| 115 | <a class="xref" href="changedpragmas.html#incremental_vacuum" title="PRAGMA incremental_vacuum">PRAGMA incremental_vacuum</a> |
| 116 | to perform an incremental vacuum operation on demand. |
| 117 | </p> |
| 118 | <p> |
| 119 | When performing vacuum operations, Berkeley DB |
| 120 | defragments and repacks individual database pages, |
| 121 | while SQLite only truncates the freelist pages from |
| 122 | the database file. |
| 123 | </p> |
| 124 | <p> |
| 125 | For more information on auto vacuum, see |
| 126 | <a class="ulink" href="http://www.sqlite.org/pragma.html#pragma_auto_vacuum" target="_top">PRAGMA auto_vacuum</a> |
| 127 | in the SQLite documentation. |
| 128 | </p> |
| 129 | </div> |
| 130 | <div class="sect2" lang="en" xml:lang="en"> |
| 131 | <div class="titlepage"> |
| 132 | <div> |
| 133 | <div> |
| 134 | <h3 class="title"><a id="incremental_vacuum"></a>PRAGMA incremental_vacuum</h3> |
| 135 | </div> |
| 136 | </div> |
| 137 | </div> |
| 138 | <p> |
| 139 | Performs incremental vacuum operations on demand. You can cause |
| 140 | incremental vacuum operations to be performed automatically using |
| 141 | <a class="xref" href="changedpragmas.html#auto_vacuum" title="PRAGMA auto_vacuum">PRAGMA auto_vacuum</a>. |
| 142 | </p> |
| 143 | <p> |
| 144 | Note that for SQLite, this PRAGMA is used to specify |
| 145 | the maximum number of pages to be freed during |
| 146 | vacuuming. For Berkeley DB, you use |
| 147 | <code class="literal">PRAGMA bdbsql_vacuum_pages</code> instead. |
| 148 | </p> |
| 149 | </div> |
| 150 | <div class="sect2" lang="en" xml:lang="en"> |
| 151 | <div class="titlepage"> |
| 152 | <div> |
| 153 | <div> |
| 154 | <h3 class="title"><a id="journal_size_limit"></a>PRAGMA journal_size_limit</h3> |
| 155 | </div> |
| 156 | </div> |
| 157 | </div> |
| 158 | <p> |
| 159 | For standard SQLite, this pragma identifies the |
| 160 | maximum size that the journal file is allowed to be. |
| 161 | </p> |
| 162 | <p> |
| 163 | Berkeley DB uses multiple journal files, Berkeley DB journal |
| 164 | files are different to a SQLite journal file in that they |
| 165 | contain information about multiple transactions, rather |
| 166 | than a single transaction (similar to the SQLite WAL |
| 167 | journal file). Over the course |
| 168 | of the database's lifetime, Berkeley DB will probably create |
| 169 | multiple journal files. A new journal file is created when |
| 170 | the current journal file has reached the maximum size |
| 171 | configured using the journal_size_limit pragma. |
| 172 | </p> |
| 173 | <p> |
| 174 | Note that a BDB SQL interface journal file is referred to as a log |
| 175 | file in the Berkeley DB documentation. |
| 176 | </p> |
| 177 | </div> |
| 178 | </div> |
| 179 | <div class="navfooter"> |
| 180 | <hr /> |
| 181 | <table width="100%" summary="Navigation footer"> |
| 182 | <tr> |
| 183 | <td width="40%" align="left"><a accesskey="p" href="unsupportedpragmas.html">Prev</a> </td> |
| 184 | <td width="20%" align="center"> |
| 185 | <a accesskey="u" href="dbsqlbasics.html">Up</a> |
| 186 | </td> |
| 187 | <td width="40%" align="right"> <a accesskey="n" href="addedpragmas.html">Next</a></td> |
| 188 | </tr> |
| 189 | <tr> |
| 190 | <td width="40%" align="left" valign="top">Unsupported PRAGMAs </td> |
| 191 | <td width="20%" align="center"> |
| 192 | <a accesskey="h" href="index.html">Home</a> |
| 193 | </td> |
| 194 | <td width="40%" align="right" valign="top"> Added PRAGMAs</td> |
| 195 | </tr> |
| 196 | </table> |
| 197 | </div> |
| 198 | </body> |
| 199 | </html> |