| 1 |
<!DOCTYPE html> |
| 2 |
<html><head> |
| 3 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 4 |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| 5 |
<link href="../sqlite.css" rel="stylesheet"> |
| 6 |
<title>Status Parameters for database connections</title> |
| 7 |
<!-- path=../ --> |
| 8 |
</head> |
| 9 |
<body> |
| 10 |
<div class=nosearch> |
| 11 |
<a href="../index.html"> |
| 12 |
<img class="logo" src="../images/sqlite370_banner.svg" alt="SQLite" border="0"> |
| 13 |
</a> |
| 14 |
<div><!-- IE hack to prevent disappearing logo --></div> |
| 15 |
<div class="tagline desktoponly"> |
| 16 |
Small. Fast. Reliable.<br>Choose any three. |
| 17 |
</div> |
| 18 |
<div class="menu mainmenu"> |
| 19 |
<ul> |
| 20 |
<li><a href="../index.html">Home</a> |
| 21 |
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> |
| 22 |
<li class='wideonly'><a href='../about.html'>About</a> |
| 23 |
<li class='desktoponly'><a href="../docs.html">Documentation</a> |
| 24 |
<li class='desktoponly'><a href="../download.html">Download</a> |
| 25 |
<li class='wideonly'><a href='../copyright.html'>License</a> |
| 26 |
<li class='desktoponly'><a href="../support.html">Support</a> |
| 27 |
<li class='desktoponly'><a href="../prosupport.html">Purchase</a> |
| 28 |
<li class='search' id='search_menubutton'> |
| 29 |
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> |
| 30 |
</ul> |
| 31 |
</div> |
| 32 |
<div class="menu submenu" id="submenu"> |
| 33 |
<ul> |
| 34 |
<li><a href='../about.html'>About</a> |
| 35 |
<li><a href='../docs.html'>Documentation</a> |
| 36 |
<li><a href='../download.html'>Download</a> |
| 37 |
<li><a href='../support.html'>Support</a> |
| 38 |
<li><a href='../prosupport.html'>Purchase</a> |
| 39 |
</ul> |
| 40 |
</div> |
| 41 |
<div class="searchmenu" id="searchmenu"> |
| 42 |
<form method="GET" action="../search"> |
| 43 |
<select name="s" id="searchtype"> |
| 44 |
<option value="d">Search Documentation</option> |
| 45 |
<option value="c">Search Changelog</option> |
| 46 |
</select> |
| 47 |
<input type="text" name="q" id="searchbox" value=""> |
| 48 |
<input type="submit" value="Go"> |
| 49 |
</form> |
| 50 |
</div> |
| 51 |
</div> |
| 52 |
<script> |
| 53 |
function toggle_div(nm) { |
| 54 |
var w = document.getElementById(nm); |
| 55 |
if( w.style.display=="block" ){ |
| 56 |
w.style.display = "none"; |
| 57 |
}else{ |
| 58 |
w.style.display = "block"; |
| 59 |
} |
| 60 |
} |
| 61 |
function toggle_search() { |
| 62 |
var w = document.getElementById("searchmenu"); |
| 63 |
if( w.style.display=="block" ){ |
| 64 |
w.style.display = "none"; |
| 65 |
} else { |
| 66 |
w.style.display = "block"; |
| 67 |
setTimeout(function(){ |
| 68 |
document.getElementById("searchbox").focus() |
| 69 |
}, 30); |
| 70 |
} |
| 71 |
} |
| 72 |
function div_off(nm){document.getElementById(nm).style.display="none";} |
| 73 |
window.onbeforeunload = function(e){div_off("submenu");} |
| 74 |
/* Disable the Search feature if we are not operating from CGI, since */ |
| 75 |
/* Search is accomplished using CGI and will not work without it. */ |
| 76 |
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ |
| 77 |
document.getElementById("search_menubutton").style.display = "none"; |
| 78 |
} |
| 79 |
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ |
| 80 |
function hideorshow(btn,obj){ |
| 81 |
var x = document.getElementById(obj); |
| 82 |
var b = document.getElementById(btn); |
| 83 |
if( x.style.display!='none' ){ |
| 84 |
x.style.display = 'none'; |
| 85 |
b.innerHTML='show'; |
| 86 |
}else{ |
| 87 |
x.style.display = ''; |
| 88 |
b.innerHTML='hide'; |
| 89 |
} |
| 90 |
return false; |
| 91 |
} |
| 92 |
var antiRobot = 0; |
| 93 |
function antiRobotGo(){ |
| 94 |
if( antiRobot!=3 ) return; |
| 95 |
antiRobot = 7; |
| 96 |
var j = document.getElementById("mtimelink"); |
| 97 |
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); |
| 98 |
} |
| 99 |
function antiRobotDefense(){ |
| 100 |
document.body.onmousedown=function(){ |
| 101 |
antiRobot |= 2; |
| 102 |
antiRobotGo(); |
| 103 |
document.body.onmousedown=null; |
| 104 |
} |
| 105 |
document.body.onmousemove=function(){ |
| 106 |
antiRobot |= 2; |
| 107 |
antiRobotGo(); |
| 108 |
document.body.onmousemove=null; |
| 109 |
} |
| 110 |
setTimeout(function(){ |
| 111 |
antiRobot |= 1; |
| 112 |
antiRobotGo(); |
| 113 |
}, 100) |
| 114 |
antiRobotGo(); |
| 115 |
} |
| 116 |
antiRobotDefense(); |
| 117 |
</script> |
| 118 |
<!-- keywords: {SQLITE_DBSTATUS options} SQLITE_DBSTATUS_CACHE_HIT SQLITE_DBSTATUS_CACHE_MISS SQLITE_DBSTATUS_CACHE_SPILL SQLITE_DBSTATUS_CACHE_USED SQLITE_DBSTATUS_CACHE_USED_SHARED SQLITE_DBSTATUS_CACHE_WRITE SQLITE_DBSTATUS_DEFERRED_FKS SQLITE_DBSTATUS_LOOKASIDE_HIT SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE SQLITE_DBSTATUS_LOOKASIDE_USED SQLITE_DBSTATUS_MAX SQLITE_DBSTATUS_SCHEMA_USED SQLITE_DBSTATUS_STMT_USED SQLITE_DBSTATUS_TEMPBUF_SPILL --> |
| 119 |
<div class=nosearch> |
| 120 |
<a href="../c3ref/intro.html"><h2>SQLite C Interface</h2></a> |
| 121 |
<h2>Status Parameters for database connections</h2> |
| 122 |
</div> |
| 123 |
<blockquote><pre> |
| 124 |
#define SQLITE_DBSTATUS_LOOKASIDE_USED 0 |
| 125 |
#define SQLITE_DBSTATUS_CACHE_USED 1 |
| 126 |
#define SQLITE_DBSTATUS_SCHEMA_USED 2 |
| 127 |
#define SQLITE_DBSTATUS_STMT_USED 3 |
| 128 |
#define SQLITE_DBSTATUS_LOOKASIDE_HIT 4 |
| 129 |
#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5 |
| 130 |
#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 |
| 131 |
#define SQLITE_DBSTATUS_CACHE_HIT 7 |
| 132 |
#define SQLITE_DBSTATUS_CACHE_MISS 8 |
| 133 |
#define SQLITE_DBSTATUS_CACHE_WRITE 9 |
| 134 |
#define SQLITE_DBSTATUS_DEFERRED_FKS 10 |
| 135 |
#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 |
| 136 |
#define SQLITE_DBSTATUS_CACHE_SPILL 12 |
| 137 |
#define SQLITE_DBSTATUS_TEMPBUF_SPILL 13 |
| 138 |
#define SQLITE_DBSTATUS_MAX 13 /* Largest defined DBSTATUS */ |
| 139 |
</pre></blockquote> |
| 140 |
<p> |
| 141 |
These constants are the available integer "verbs" that can be passed as |
| 142 |
the second argument to the <a href="../c3ref/db_status.html">sqlite3_db_status()</a> interface.</p> |
| 143 |
|
| 144 |
<p>New verbs may be added in future releases of SQLite. Existing verbs |
| 145 |
might be discontinued. Applications should check the return code from |
| 146 |
<a href="../c3ref/db_status.html">sqlite3_db_status()</a> to make sure that the call worked. |
| 147 |
The <a href="../c3ref/db_status.html">sqlite3_db_status()</a> interface will return a non-zero error code |
| 148 |
if a discontinued or unsupported verb is invoked.</p> |
| 149 |
|
| 150 |
<p><dl> |
| 151 |
<a name="sqlitedbstatuslookasideused"></a> |
| 152 |
<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt> |
| 153 |
<dd>This parameter returns the number of lookaside memory slots currently |
| 154 |
checked out.</dd></p> |
| 155 |
|
| 156 |
<p><a name="sqlitedbstatuslookasidehit"></a> |
| 157 |
<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt> |
| 158 |
<dd>This parameter returns the number of malloc attempts that were |
| 159 |
satisfied using lookaside memory. Only the high-water value is meaningful; |
| 160 |
the current value is always zero.</dd></p> |
| 161 |
|
| 162 |
<p><a name="sqlitedbstatuslookasidemisssize"></a> |
| 163 |
|
| 164 |
<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt> |
| 165 |
<dd>This parameter returns the number of malloc attempts that might have |
| 166 |
been satisfied using lookaside memory but failed due to the amount of |
| 167 |
memory requested being larger than the lookaside slot size. |
| 168 |
Only the high-water value is meaningful; |
| 169 |
the current value is always zero.</dd></p> |
| 170 |
|
| 171 |
<p><a name="sqlitedbstatuslookasidemissfull"></a> |
| 172 |
|
| 173 |
<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt> |
| 174 |
<dd>This parameter returns the number of malloc attempts that might have |
| 175 |
been satisfied using lookaside memory but failed due to all lookaside |
| 176 |
memory already being in use. |
| 177 |
Only the high-water value is meaningful; |
| 178 |
the current value is always zero.</dd></p> |
| 179 |
|
| 180 |
<p><a name="sqlitedbstatuscacheused"></a> |
| 181 |
<dt>SQLITE_DBSTATUS_CACHE_USED</dt> |
| 182 |
<dd>This parameter returns the approximate number of bytes of heap |
| 183 |
memory used by all pager caches associated with the database connection. |
| 184 |
The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0. |
| 185 |
</dd></p> |
| 186 |
|
| 187 |
<p><a name="sqlitedbstatuscacheusedshared"></a> |
| 188 |
|
| 189 |
<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt> |
| 190 |
<dd>This parameter is similar to DBSTATUS_CACHE_USED, except that if a |
| 191 |
pager cache is shared between two or more connections the bytes of heap |
| 192 |
memory used by that pager cache is divided evenly between the attached |
| 193 |
connections. In other words, if none of the pager caches associated |
| 194 |
with the database connection are shared, this request returns the same |
| 195 |
value as DBSTATUS_CACHE_USED. Or, if one or more of the pager caches are |
| 196 |
shared, the value returned by this call will be smaller than that returned |
| 197 |
by DBSTATUS_CACHE_USED. The highwater mark associated with |
| 198 |
SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.</dd></p> |
| 199 |
|
| 200 |
<p><a name="sqlitedbstatusschemaused"></a> |
| 201 |
<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt> |
| 202 |
<dd>This parameter returns the approximate number of bytes of heap |
| 203 |
memory used to store the schema for all databases associated |
| 204 |
with the connection - main, temp, and any <a href="../lang_attach.html">ATTACH</a>-ed databases. |
| 205 |
The full amount of memory used by the schemas is reported, even if the |
| 206 |
schema memory is shared with other database connections due to |
| 207 |
<a href="../sharedcache.html">shared cache mode</a> being enabled. |
| 208 |
The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0. |
| 209 |
</dd></p> |
| 210 |
|
| 211 |
<p><a name="sqlitedbstatusstmtused"></a> |
| 212 |
<dt>SQLITE_DBSTATUS_STMT_USED</dt> |
| 213 |
<dd>This parameter returns the approximate number of bytes of heap |
| 214 |
and lookaside memory used by all prepared statements associated with |
| 215 |
the database connection. |
| 216 |
The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0. |
| 217 |
</dd></p> |
| 218 |
|
| 219 |
<p><a name="sqlitedbstatuscachehit"></a> |
| 220 |
<dt>SQLITE_DBSTATUS_CACHE_HIT</dt> |
| 221 |
<dd>This parameter returns the number of pager cache hits that have |
| 222 |
occurred. The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT |
| 223 |
is always 0. |
| 224 |
</dd></p> |
| 225 |
|
| 226 |
<p><a name="sqlitedbstatuscachemiss"></a> |
| 227 |
<dt>SQLITE_DBSTATUS_CACHE_MISS</dt> |
| 228 |
<dd>This parameter returns the number of pager cache misses that have |
| 229 |
occurred. The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS |
| 230 |
is always 0. |
| 231 |
</dd></p> |
| 232 |
|
| 233 |
<p><a name="sqlitedbstatuscachewrite"></a> |
| 234 |
<dt>SQLITE_DBSTATUS_CACHE_WRITE</dt> |
| 235 |
<dd>This parameter returns the number of dirty cache entries that have |
| 236 |
been written to disk. Specifically, the number of pages written to the |
| 237 |
wal file in wal mode databases, or the number of pages written to the |
| 238 |
database file in rollback mode databases. Any pages written as part of |
| 239 |
transaction rollback or database recovery operations are not included. |
| 240 |
If an IO or other error occurs while writing a page to disk, the effect |
| 241 |
on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined. The |
| 242 |
highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0. |
| 243 |
<p> |
| 244 |
There is overlap between the quantities measured by this parameter |
| 245 |
(SQLITE_DBSTATUS_CACHE_WRITE) and SQLITE_DBSTATUS_TEMPBUF_SPILL. |
| 246 |
Resetting one will reduce the other. |
| 247 |
</dd></p> |
| 248 |
|
| 249 |
<p><a name="sqlitedbstatuscachespill"></a> |
| 250 |
<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt> |
| 251 |
<dd>This parameter returns the number of dirty cache entries that have |
| 252 |
been written to disk in the middle of a transaction due to the page |
| 253 |
cache overflowing. Transactions are more efficient if they are written |
| 254 |
to disk all at once. When pages spill mid-transaction, that introduces |
| 255 |
additional overhead. This parameter can be used to help identify |
| 256 |
inefficiencies that can be resolved by increasing the cache size. |
| 257 |
</dd></p> |
| 258 |
|
| 259 |
<p><a name="sqlitedbstatusdeferredfks"></a> |
| 260 |
<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt> |
| 261 |
<dd>This parameter returns zero for the current value if and only if |
| 262 |
all foreign key constraints (deferred or immediate) have been |
| 263 |
resolved. The highwater mark is always 0.</p> |
| 264 |
|
| 265 |
<p><a href="../c3ref/c_dbstatus_options.html">[SQLITE_DBSTATUS_TEMPBUF_SPILL</a> <dt>SQLITE_DBSTATUS_TEMPBUF_SPILL</dt> |
| 266 |
<dd>This parameter returns the number of bytes written to temporary |
| 267 |
files on disk that could have been kept in memory had sufficient memory |
| 268 |
been available. This value includes writes to intermediate tables that |
| 269 |
are part of complex queries, external sorts that spill to disk, and |
| 270 |
writes to TEMP tables. |
| 271 |
The highwater mark is always 0. |
| 272 |
<p> |
| 273 |
There is overlap between the quantities measured by this parameter |
| 274 |
(SQLITE_DBSTATUS_TEMPBUF_SPILL) and SQLITE_DBSTATUS_CACHE_WRITE. |
| 275 |
Resetting one will reduce the other. |
| 276 |
</dd> |
| 277 |
</dl> |
| 278 |
</p><p>See also lists of |
| 279 |
<a href="../c3ref/objlist.html">Objects</a>, |
| 280 |
<a href="../c3ref/constlist.html">Constants</a>, and |
| 281 |
<a href="../c3ref/funclist.html">Functions</a>.</p> |
| 282 |
|