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
|
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>EXPLAIN</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
EXPLAIN
</div>
</div>
<h1 id="syntax"><span>1. </span>Syntax</h1>
<p><b><a href="syntax/sql-stmt.html">sql-stmt:</a></b></p><div class='imgcontainer'>
<div style="max-width:716px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 716.88 1017.36">
<circle cx="5" cy="17" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L125,70A15 15 0 0 0 140 55L140,55A15 15 0 0 0 125 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXPLAIN</text>
<polygon points="176,55 165,59 165,50" style="fill:rgb(0,0,0)"/>
<path d="M140,55L170,55" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,70L235,70A15 15 0 0 0 250 55L250,55A15 15 0 0 0 235 39L191,39A15 15 0 0 0 176 55L176,55A15 15 0 0 0 191 70Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">QUERY</text>
<polygon points="267,55 255,59 255,50" style="fill:rgb(0,0,0)"/>
<path d="M250,55L261,55" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M282,70L311,70A15 15 0 0 0 327 55L327,55A15 15 0 0 0 311 39L282,39A15 15 0 0 0 267 55L267,55A15 15 0 0 0 282 70Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PLAN</text>
<polygon points="368,17 357,21 357,12" style="fill:rgb(0,0,0)"/>
<path d="M327,55 L 334,55 Q 342,55 342,40 L 342,32 Q 342,17 352,17 L 362,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="182,17 170,21 170,12" style="fill:rgb(0,0,0)"/>
<path d="M140,55 L 148,55 Q 155,55 155,40 L 155,32 Q 155,17 166,17 L 176,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,17L357,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M9,17L170,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="410,17 398,21 398,12" style="fill:rgb(0,0,0)"/>
<path d="M368,17L404,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,32L552,32L552,2L410,2Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alter-table-stmt</text>
<polygon points="666,17 654,21 654,12" style="fill:rgb(0,0,0)"/>
<path d="M552,17L660,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="707,17 696,21 696,12" style="fill:rgb(0,0,0)"/>
<path d="M666,17L701,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="711" cy="17" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,70L528,70L528,39L410,39Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">analyze-stmt</text>
<polygon points="410,55 398,59 398,50" style="fill:rgb(0,0,0)"/>
<path d="M383,39 L 383,47 Q 383,55 393,55 L 404,55" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,55 654,59 654,50" style="fill:rgb(0,0,0)"/>
<path d="M528,55L660,55" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,55 L 673,55 Q 681,55 681,47 L 681,40" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,108L517,108L517,77L410,77Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">attach-stmt</text>
<polygon points="410,92 398,97 398,88" style="fill:rgb(0,0,0)"/>
<path d="M383,77 L 383,85 Q 383,92 393,92 L 404,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,92 654,97 654,88" style="fill:rgb(0,0,0)"/>
<path d="M517,92L660,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,92 L 673,92 Q 681,92 681,85 L 681,77" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,145L511,145L511,115L410,115Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="460" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">begin-stmt</text>
<polygon points="410,130 398,135 398,126" style="fill:rgb(0,0,0)"/>
<path d="M383,115 L 383,123 Q 383,130 393,130 L 404,130" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,130 654,135 654,126" style="fill:rgb(0,0,0)"/>
<path d="M511,130L660,130" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,130 L 673,130 Q 681,130 681,123 L 681,115" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,183L527,183L527,153L410,153Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">commit-stmt</text>
<polygon points="410,168 398,172 398,164" style="fill:rgb(0,0,0)"/>
<path d="M383,153 L 383,160 Q 383,168 393,168 L 404,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,168 654,172 654,164" style="fill:rgb(0,0,0)"/>
<path d="M527,168L660,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,168 L 673,168 Q 681,168 681,160 L 681,153" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,221L569,221L569,191L410,191Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-index-stmt</text>
<polygon points="410,206 398,210 398,201" style="fill:rgb(0,0,0)"/>
<path d="M383,191 L 383,198 Q 383,206 393,206 L 404,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,206 654,210 654,201" style="fill:rgb(0,0,0)"/>
<path d="M569,206L660,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,206 L 673,206 Q 681,206 681,198 L 681,191" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,259L566,259L566,228L410,228Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-table-stmt</text>
<polygon points="410,244 398,248 398,239" style="fill:rgb(0,0,0)"/>
<path d="M383,228 L 383,236 Q 383,244 393,244 L 404,244" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,244 654,248 654,239" style="fill:rgb(0,0,0)"/>
<path d="M566,244L660,244" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,244 L 673,244 Q 681,244 681,236 L 681,229" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,297L582,297L582,266L410,266Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-trigger-stmt</text>
<polygon points="410,281 398,286 398,277" style="fill:rgb(0,0,0)"/>
<path d="M383,266 L 383,274 Q 383,281 393,281 L 404,281" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,281 654,286 654,277" style="fill:rgb(0,0,0)"/>
<path d="M582,281L660,281" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,281 L 673,281 Q 681,281 681,274 L 681,266" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,334L561,334L561,304L410,304Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-view-stmt</text>
<polygon points="410,319 398,324 398,315" style="fill:rgb(0,0,0)"/>
<path d="M383,304 L 383,312 Q 383,319 393,319 L 404,319" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,319 654,324 654,315" style="fill:rgb(0,0,0)"/>
<path d="M561,319L660,319" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,319 L 673,319 Q 681,319 681,312 L 681,304" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,372L626,372L626,342L410,342Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-virtual-table-stmt</text>
<polygon points="410,357 398,361 398,353" style="fill:rgb(0,0,0)"/>
<path d="M383,342 L 383,349 Q 383,357 393,357 L 404,357" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,357 654,361 654,353" style="fill:rgb(0,0,0)"/>
<path d="M626,357L660,357" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,357 L 673,357 Q 681,357 681,349 L 681,342" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,410L516,410L516,380L410,380Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt</text>
<polygon points="410,395 398,399 398,390" style="fill:rgb(0,0,0)"/>
<path d="M383,380 L 383,387 Q 383,395 393,395 L 404,395" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,395 654,399 654,390" style="fill:rgb(0,0,0)"/>
<path d="M516,395L660,395" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,395 L 673,395 Q 681,395 681,387 L 681,380" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,448L581,448L581,417L410,417Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt-limited</text>
<polygon points="410,433 398,437 398,428" style="fill:rgb(0,0,0)"/>
<path d="M383,417 L 383,425 Q 383,433 393,433 L 404,433" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,433 654,437 654,428" style="fill:rgb(0,0,0)"/>
<path d="M581,433L660,433" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,433 L 673,433 Q 681,433 681,425 L 681,418" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,486L521,486L521,455L410,455Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="465" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">detach-stmt</text>
<polygon points="410,470 398,475 398,466" style="fill:rgb(0,0,0)"/>
<path d="M383,455 L 383,463 Q 383,470 393,470 L 404,470" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,470 654,475 654,466" style="fill:rgb(0,0,0)"/>
<path d="M521,470L660,470" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,470 L 673,470 Q 681,470 681,463 L 681,455" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,523L555,523L555,493L410,493Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="508" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-index-stmt</text>
<polygon points="410,508 398,513 398,504" style="fill:rgb(0,0,0)"/>
<path d="M383,493 L 383,501 Q 383,508 393,508 L 404,508" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,508 654,513 654,504" style="fill:rgb(0,0,0)"/>
<path d="M555,508L660,508" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,508 L 673,508 Q 681,508 681,501 L 681,493" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,561L551,561L551,531L410,531Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="480" y="546" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-table-stmt</text>
<polygon points="410,546 398,550 398,542" style="fill:rgb(0,0,0)"/>
<path d="M383,531 L 383,538 Q 383,546 393,546 L 404,546" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,546 654,550 654,542" style="fill:rgb(0,0,0)"/>
<path d="M551,546L660,546" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,546 L 673,546 Q 681,546 681,538 L 681,531" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,599L568,599L568,569L410,569Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="584" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-trigger-stmt</text>
<polygon points="410,584 398,588 398,579" style="fill:rgb(0,0,0)"/>
<path d="M383,569 L 383,576 Q 383,584 393,584 L 404,584" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,584 654,588 654,579" style="fill:rgb(0,0,0)"/>
<path d="M568,584L660,584" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,584 L 673,584 Q 681,584 681,576 L 681,569" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,637L547,637L547,606L410,606Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="622" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-view-stmt</text>
<polygon points="410,622 398,626 398,617" style="fill:rgb(0,0,0)"/>
<path d="M383,606 L 383,614 Q 383,622 393,622 L 404,622" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,622 654,626 654,617" style="fill:rgb(0,0,0)"/>
<path d="M547,622L660,622" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,622 L 673,622 Q 681,622 681,614 L 681,607" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,675L513,675L513,644L410,644Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="659" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">insert-stmt</text>
<polygon points="410,659 398,664 398,655" style="fill:rgb(0,0,0)"/>
<path d="M383,644 L 383,652 Q 383,659 393,659 L 404,659" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,659 654,664 654,655" style="fill:rgb(0,0,0)"/>
<path d="M513,659L660,659" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,659 L 673,659 Q 681,659 681,652 L 681,644" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,712L529,712L529,682L410,682Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="697" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-stmt</text>
<polygon points="410,697 398,702 398,693" style="fill:rgb(0,0,0)"/>
<path d="M383,682 L 383,690 Q 383,697 393,697 L 404,697" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,697 654,702 654,693" style="fill:rgb(0,0,0)"/>
<path d="M529,697L660,697" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,697 L 673,697 Q 681,697 681,690 L 681,682" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,750L528,750L528,720L410,720Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="735" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">reindex-stmt</text>
<polygon points="410,735 398,739 398,731" style="fill:rgb(0,0,0)"/>
<path d="M383,720 L 383,727 Q 383,735 393,735 L 404,735" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,735 654,739 654,731" style="fill:rgb(0,0,0)"/>
<path d="M528,735L660,735" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,735 L 673,735 Q 681,735 681,727 L 681,720" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,788L526,788L526,758L410,758Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="773" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">release-stmt</text>
<polygon points="410,773 398,777 398,768" style="fill:rgb(0,0,0)"/>
<path d="M383,758 L 383,765 Q 383,773 393,773 L 404,773" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,773 654,777 654,768" style="fill:rgb(0,0,0)"/>
<path d="M526,773L660,773" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,773 L 673,773 Q 681,773 681,765 L 681,758" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,826L533,826L533,795L410,795Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="811" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">rollback-stmt</text>
<polygon points="410,811 398,815 398,806" style="fill:rgb(0,0,0)"/>
<path d="M383,795 L 383,803 Q 383,811 393,811 L 404,811" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,811 654,815 654,806" style="fill:rgb(0,0,0)"/>
<path d="M533,811L660,811" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,811 L 673,811 Q 681,811 681,803 L 681,796" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,864L545,864L545,833L410,833Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="848" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-stmt</text>
<polygon points="410,848 398,853 398,844" style="fill:rgb(0,0,0)"/>
<path d="M383,833 L 383,841 Q 383,848 393,848 L 404,848" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,848 654,853 654,844" style="fill:rgb(0,0,0)"/>
<path d="M545,848L660,848" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,848 L 673,848 Q 681,848 681,841 L 681,833" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,901L514,901L514,871L410,871Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="462" y="886" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="410,886 398,891 398,882" style="fill:rgb(0,0,0)"/>
<path d="M383,871 L 383,879 Q 383,886 393,886 L 404,886" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,886 654,891 654,882" style="fill:rgb(0,0,0)"/>
<path d="M514,886L660,886" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,886 L 673,886 Q 681,886 681,879 L 681,871" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,939L522,939L522,909L410,909Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="466" y="924" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt</text>
<polygon points="410,924 398,928 398,920" style="fill:rgb(0,0,0)"/>
<path d="M383,909 L 383,916 Q 383,924 393,924 L 404,924" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,924 654,928 654,920" style="fill:rgb(0,0,0)"/>
<path d="M522,924L660,924" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,924 L 673,924 Q 681,924 681,916 L 681,909" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,977L587,977L587,947L410,947Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="498" y="962" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt-limited</text>
<polygon points="410,962 398,966 398,957" style="fill:rgb(0,0,0)"/>
<path d="M383,947 L 383,954 Q 383,962 393,962 L 404,962" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,962 654,966 654,957" style="fill:rgb(0,0,0)"/>
<path d="M587,962L660,962" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,962 L 673,962 Q 681,962 681,954 L 681,947" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,1015L529,1015L529,984L410,984Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="1000" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">vacuum-stmt</text>
<polygon points="410,1000 398,1004 398,995" style="fill:rgb(0,0,0)"/>
<path d="M368,17 L 376,17 Q 383,17 383,32 L 383,985 Q 383,1000 393,1000 L 404,1000" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,1000 654,1004 654,995" style="fill:rgb(0,0,0)"/>
<path d="M529,1000L660,1000" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,1000 L 673,1000 Q 681,1000 681,985 L 681,32 Q 681,17 688,17 L 696,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<h1 id="description"><span>2. </span>Description</h1>
<p>An SQL statement can be preceded by the keyword "EXPLAIN" or
by the phrase "EXPLAIN QUERY PLAN". Either modification causes the
SQL statement to behave as a query and to return information about
how the SQL statement would have operated if the EXPLAIN keyword or
phrase had been omitted.</p>
<p>The output from EXPLAIN and EXPLAIN QUERY PLAN is intended for
interactive analysis and troubleshooting only. The details of the
output format are subject to change from one release of SQLite to the next.
Applications should not use EXPLAIN or EXPLAIN QUERY PLAN since
their exact behavior is variable and only partially documented.</p>
<p>When the EXPLAIN keyword appears by itself it causes the statement
to behave as a query that returns the sequence of
<a href="opcode.html">virtual machine instructions</a> it would have used to execute the command had
the EXPLAIN keyword not been present. When the EXPLAIN QUERY PLAN phrase
appears, the statement returns high-level information regarding the query
plan that would have been used.
</p><p>The EXPLAIN QUERY PLAN command is described in
<a href="eqp.html">more detail here</a>.
</p><h2 id="explain_operates_at_run_time_not_at_prepare_time"><span>2.1. </span>EXPLAIN operates at run-time, not at prepare-time</h2>
<p>The EXPLAIN and EXPLAIN QUERY PLAN prefixes affect the behavior of
running a <a href="c3ref/stmt.html">prepared statement</a> using <a href="c3ref/step.html">sqlite3_step()</a>. The process of
generating a new prepared statement using <a href="c3ref/prepare.html">sqlite3_prepare()</a> or similar
is (mostly) unaffected by EXPLAIN. (The exception to the previous sentence
is that some special opcodes used by EXPLAIN QUERY PLAN are omitted when
building an EXPLAIN QUERY PLAN prepared statement, as a performance
optimization.)
</p><p>This means that actions that occur during sqlite3_prepare() are
unaffected by EXPLAIN.
</p><ul>
<li><p>
Some <a href="pragma.html#syntax">PRAGMA</a> statements do their work during sqlite3_prepare() rather
than during sqlite3_step(). Those PRAGMA statements are unaffected
by EXPLAIN. They operate the same with or without the EXPLAIN prefix.
The set of PRAGMA statements that are unaffected by EXPLAIN can vary
from one release to the next. Some PRAGMA statements operate during
sqlite3_prepare() depending on their arguments. For consistent
results, avoid using EXPLAIN on PRAGMA statements.
</p></li><li><p>
The <a href="c3ref/set_authorizer.html">authorizer callback</a> is invoked regardless of the presence of
EXPLAIN or EXPLAIN QUERY PLAN.
</p></li></ul>
<p align="center"><small><i>This page last modified on <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink" data-href="https://sqlite.org/docsrc/finfo/pages/lang_explain.in?m=7122ecf5f68ffd8ff">2020-02-10 20:33:26</a> UTC </small></i></p>
|