aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/sqlite/unix/sqlite-3.5.1/www/speed.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/www/speed.tcl')
-rw-r--r--libraries/sqlite/unix/sqlite-3.5.1/www/speed.tcl495
1 files changed, 495 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/www/speed.tcl b/libraries/sqlite/unix/sqlite-3.5.1/www/speed.tcl
new file mode 100644
index 0000000..b60cfe1
--- /dev/null
+++ b/libraries/sqlite/unix/sqlite-3.5.1/www/speed.tcl
@@ -0,0 +1,495 @@
1#
2# Run this Tcl script to generate the speed.html file.
3#
4set rcsid {$Id: speed.tcl,v 1.17 2005/03/12 15:55:11 drh Exp $ }
5source common.tcl
6header {SQLite Database Speed Comparison}
7
8puts {
9<h2>Database Speed Comparison</h2>
10
11<font color="red"><b>
12Note: This document is old. It describes a speed comparison between
13an older version of SQLite against archaic versions of MySQL and PostgreSQL.
14Readers are invited to contribute more up-to-date speed comparisons
15on the <a href="http://www.sqlite.org/cvstrac/wiki">SQLite Wiki</a>.
16<p>
17The numbers here are old enough to be nearly meaningless. Until it is
18updated, use this document only as proof that SQLite is not a
19sluggard.
20</b></font>
21
22<h3>Executive Summary</h3>
23
24<p>A series of tests were run to measure the relative performance of
25SQLite 2.7.6, PostgreSQL 7.1.3, and MySQL 3.23.41.
26The following are general
27conclusions drawn from these experiments:
28</p>
29
30<ul>
31<li><p>
32 SQLite 2.7.6 is significantly faster (sometimes as much as 10 or
33 20 times faster) than the default PostgreSQL 7.1.3 installation
34 on RedHat 7.2 for most common operations.
35</p></li>
36<li><p>
37 SQLite 2.7.6 is often faster (sometimes
38 more than twice as fast) than MySQL 3.23.41
39 for most common operations.
40</p></li>
41<li><p>
42 SQLite does not execute CREATE INDEX or DROP TABLE as fast as
43 the other databases. But this is not seen as a problem because
44 those are infrequent operations.
45</p></li>
46<li><p>
47 SQLite works best if you group multiple operations together into
48 a single transaction.
49</p></li>
50</ul>
51
52<p>
53The results presented here come with the following caveats:
54</p>
55
56<ul>
57<li><p>
58 These tests did not attempt to measure multi-user performance or
59 optimization of complex queries involving multiple joins and subqueries.
60</p></li>
61<li><p>
62 These tests are on a relatively small (approximately 14 megabyte) database.
63 They do not measure how well the database engines scale to larger problems.
64</p></li>
65</ul>
66
67<h3>Test Environment</h3>
68
69<p>
70The platform used for these tests is a 1.6GHz Athlon with 1GB or memory
71and an IDE disk drive. The operating system is RedHat Linux 7.2 with
72a stock kernel.
73</p>
74
75<p>
76The PostgreSQL and MySQL servers used were as delivered by default on
77RedHat 7.2. (PostgreSQL version 7.1.3 and MySQL version 3.23.41.)
78No effort was made to tune these engines. Note in particular
79the the default MySQL configuration on RedHat 7.2 does not support
80transactions. Not having to support transactions gives MySQL a
81big speed advantage, but SQLite is still able to hold its own on most
82tests.
83</p>
84
85<p>
86I am told that the default PostgreSQL configuration in RedHat 7.3
87is unnecessarily conservative (it is designed to
88work on a machine with 8MB of RAM) and that PostgreSQL could
89be made to run a lot faster with some knowledgeable configuration
90tuning.
91Matt Sergeant reports that he has tuned his PostgreSQL installation
92and rerun the tests shown below. His results show that
93PostgreSQL and MySQL run at about the same speed. For Matt's
94results, visit
95</p>
96
97<blockquote>
98<a href="http://www.sergeant.org/sqlite_vs_pgsync.html">
99http://www.sergeant.org/sqlite_vs_pgsync.html</a>
100</blockquote>
101
102<p>
103SQLite was tested in the same configuration that it appears
104on the website. It was compiled with -O6 optimization and with
105the -DNDEBUG=1 switch which disables the many "assert()" statements
106in the SQLite code. The -DNDEBUG=1 compiler option roughly doubles
107the speed of SQLite.
108</p>
109
110<p>
111All tests are conducted on an otherwise quiescent machine.
112A simple Tcl script was used to generate and run all the tests.
113A copy of this Tcl script can be found in the SQLite source tree
114in the file <b>tools/speedtest.tcl</b>.
115</p>
116
117<p>
118The times reported on all tests represent wall-clock time
119in seconds. Two separate time values are reported for SQLite.
120The first value is for SQLite in its default configuration with
121full disk synchronization turned on. With synchronization turned
122on, SQLite executes
123an <b>fsync()</b> system call (or the equivalent) at key points
124to make certain that critical data has
125actually been written to the disk drive surface. Synchronization
126is necessary to guarantee the integrity of the database if the
127operating system crashes or the computer powers down unexpectedly
128in the middle of a database update. The second time reported for SQLite is
129when synchronization is turned off. With synchronization off,
130SQLite is sometimes much faster, but there is a risk that an
131operating system crash or an unexpected power failure could
132damage the database. Generally speaking, the synchronous SQLite
133times are for comparison against PostgreSQL (which is also
134synchronous) and the asynchronous SQLite times are for
135comparison against the asynchronous MySQL engine.
136</p>
137
138<h3>Test 1: 1000 INSERTs</h3>
139<blockquote>
140CREATE TABLE t1(a INTEGER, b INTEGER, c VARCHAR(100));<br>
141INSERT INTO t1 VALUES(1,13153,'thirteen thousand one hundred fifty three');<br>
142INSERT INTO t1 VALUES(2,75560,'seventy five thousand five hundred sixty');<br>
143<i>... 995 lines omitted</i><br>
144INSERT INTO t1 VALUES(998,66289,'sixty six thousand two hundred eighty nine');<br>
145INSERT INTO t1 VALUES(999,24322,'twenty four thousand three hundred twenty two');<br>
146INSERT INTO t1 VALUES(1000,94142,'ninety four thousand one hundred forty two');<br>
147
148</blockquote><table border=0 cellpadding=0 cellspacing=0>
149<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;4.373</td></tr>
150<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;0.114</td></tr>
151<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;13.061</td></tr>
152<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;0.223</td></tr>
153</table>
154
155<p>
156Because it does not have a central server to coordinate access,
157SQLite must close and reopen the database file, and thus invalidate
158its cache, for each transaction. In this test, each SQL statement
159is a separate transaction so the database file must be opened and closed
160and the cache must be flushed 1000 times. In spite of this, the asynchronous
161version of SQLite is still nearly as fast as MySQL. Notice how much slower
162the synchronous version is, however. SQLite calls <b>fsync()</b> after
163each synchronous transaction to make sure that all data is safely on
164the disk surface before continuing. For most of the 13 seconds in the
165synchronous test, SQLite was sitting idle waiting on disk I/O to complete.</p>
166
167
168<h3>Test 2: 25000 INSERTs in a transaction</h3>
169<blockquote>
170BEGIN;<br>
171CREATE TABLE t2(a INTEGER, b INTEGER, c VARCHAR(100));<br>
172INSERT INTO t2 VALUES(1,59672,'fifty nine thousand six hundred seventy two');<br>
173<i>... 24997 lines omitted</i><br>
174INSERT INTO t2 VALUES(24999,89569,'eighty nine thousand five hundred sixty nine');<br>
175INSERT INTO t2 VALUES(25000,94666,'ninety four thousand six hundred sixty six');<br>
176COMMIT;<br>
177
178</blockquote><table border=0 cellpadding=0 cellspacing=0>
179<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;4.900</td></tr>
180<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;2.184</td></tr>
181<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;0.914</td></tr>
182<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;0.757</td></tr>
183</table>
184
185<p>
186When all the INSERTs are put in a transaction, SQLite no longer has to
187close and reopen the database or invalidate its cache between each statement.
188It also does not
189have to do any fsync()s until the very end. When unshackled in
190this way, SQLite is much faster than either PostgreSQL and MySQL.
191</p>
192
193<h3>Test 3: 25000 INSERTs into an indexed table</h3>
194<blockquote>
195BEGIN;<br>
196CREATE TABLE t3(a INTEGER, b INTEGER, c VARCHAR(100));<br>
197CREATE INDEX i3 ON t3(c);<br>
198<i>... 24998 lines omitted</i><br>
199INSERT INTO t3 VALUES(24999,88509,'eighty eight thousand five hundred nine');<br>
200INSERT INTO t3 VALUES(25000,84791,'eighty four thousand seven hundred ninety one');<br>
201COMMIT;<br>
202
203</blockquote><table border=0 cellpadding=0 cellspacing=0>
204<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;8.175</td></tr>
205<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;3.197</td></tr>
206<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;1.555</td></tr>
207<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;1.402</td></tr>
208</table>
209
210<p>
211There were reports that SQLite did not perform as well on an indexed table.
212This test was recently added to disprove those rumors. It is true that
213SQLite is not as fast at creating new index entries as the other engines
214(see Test 6 below) but its overall speed is still better.
215</p>
216
217<h3>Test 4: 100 SELECTs without an index</h3>
218<blockquote>
219BEGIN;<br>
220SELECT count(*), avg(b) FROM t2 WHERE b>=0 AND b<1000;<br>
221SELECT count(*), avg(b) FROM t2 WHERE b>=100 AND b<1100;<br>
222<i>... 96 lines omitted</i><br>
223SELECT count(*), avg(b) FROM t2 WHERE b>=9800 AND b<10800;<br>
224SELECT count(*), avg(b) FROM t2 WHERE b>=9900 AND b<10900;<br>
225COMMIT;<br>
226
227</blockquote><table border=0 cellpadding=0 cellspacing=0>
228<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;3.629</td></tr>
229<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;2.760</td></tr>
230<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;2.494</td></tr>
231<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;2.526</td></tr>
232</table>
233
234
235<p>
236This test does 100 queries on a 25000 entry table without an index,
237thus requiring a full table scan. Prior versions of SQLite used to
238be slower than PostgreSQL and MySQL on this test, but recent performance
239enhancements have increased its speed so that it is now the fastest
240of the group.
241</p>
242
243<h3>Test 5: 100 SELECTs on a string comparison</h3>
244<blockquote>
245BEGIN;<br>
246SELECT count(*), avg(b) FROM t2 WHERE c LIKE '%one%';<br>
247SELECT count(*), avg(b) FROM t2 WHERE c LIKE '%two%';<br>
248<i>... 96 lines omitted</i><br>
249SELECT count(*), avg(b) FROM t2 WHERE c LIKE '%ninety nine%';<br>
250SELECT count(*), avg(b) FROM t2 WHERE c LIKE '%one hundred%';<br>
251COMMIT;<br>
252
253</blockquote><table border=0 cellpadding=0 cellspacing=0>
254<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;13.409</td></tr>
255<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;4.640</td></tr>
256<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;3.362</td></tr>
257<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;3.372</td></tr>
258</table>
259
260<p>
261This test still does 100 full table scans but it uses
262uses string comparisons instead of numerical comparisons.
263SQLite is over three times faster than PostgreSQL here and about 30%
264faster than MySQL.
265</p>
266
267<h3>Test 6: Creating an index</h3>
268<blockquote>
269CREATE INDEX i2a ON t2(a);<br>CREATE INDEX i2b ON t2(b);
270</blockquote><table border=0 cellpadding=0 cellspacing=0>
271<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;0.381</td></tr>
272<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;0.318</td></tr>
273<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;0.777</td></tr>
274<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;0.659</td></tr>
275</table>
276
277<p>
278SQLite is slower at creating new indices. This is not a huge problem
279(since new indices are not created very often) but it is something that
280is being worked on. Hopefully, future versions of SQLite will do better
281here.
282</p>
283
284<h3>Test 7: 5000 SELECTs with an index</h3>
285<blockquote>
286SELECT count(*), avg(b) FROM t2 WHERE b>=0 AND b<100;<br>
287SELECT count(*), avg(b) FROM t2 WHERE b>=100 AND b<200;<br>
288SELECT count(*), avg(b) FROM t2 WHERE b>=200 AND b<300;<br>
289<i>... 4994 lines omitted</i><br>
290SELECT count(*), avg(b) FROM t2 WHERE b>=499700 AND b<499800;<br>
291SELECT count(*), avg(b) FROM t2 WHERE b>=499800 AND b<499900;<br>
292SELECT count(*), avg(b) FROM t2 WHERE b>=499900 AND b<500000;<br>
293
294</blockquote><table border=0 cellpadding=0 cellspacing=0>
295<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;4.614</td></tr>
296<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;1.270</td></tr>
297<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;1.121</td></tr>
298<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;1.162</td></tr>
299</table>
300
301<p>
302All three database engines run faster when they have indices to work with.
303But SQLite is still the fastest.
304</p>
305
306<h3>Test 8: 1000 UPDATEs without an index</h3>
307<blockquote>
308BEGIN;<br>
309UPDATE t1 SET b=b*2 WHERE a>=0 AND a<10;<br>
310UPDATE t1 SET b=b*2 WHERE a>=10 AND a<20;<br>
311<i>... 996 lines omitted</i><br>
312UPDATE t1 SET b=b*2 WHERE a>=9980 AND a<9990;<br>
313UPDATE t1 SET b=b*2 WHERE a>=9990 AND a<10000;<br>
314COMMIT;<br>
315
316</blockquote><table border=0 cellpadding=0 cellspacing=0>
317<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;1.739</td></tr>
318<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;8.410</td></tr>
319<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;0.637</td></tr>
320<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;0.638</td></tr>
321</table>
322
323<p>
324For this particular UPDATE test, MySQL is consistently
325five or ten times
326slower than PostgreSQL and SQLite. I do not know why. MySQL is
327normally a very fast engine. Perhaps this problem has been addressed
328in later versions of MySQL.
329</p>
330
331<h3>Test 9: 25000 UPDATEs with an index</h3>
332<blockquote>
333BEGIN;<br>
334UPDATE t2 SET b=468026 WHERE a=1;<br>
335UPDATE t2 SET b=121928 WHERE a=2;<br>
336<i>... 24996 lines omitted</i><br>
337UPDATE t2 SET b=35065 WHERE a=24999;<br>
338UPDATE t2 SET b=347393 WHERE a=25000;<br>
339COMMIT;<br>
340
341</blockquote><table border=0 cellpadding=0 cellspacing=0>
342<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;18.797</td></tr>
343<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;8.134</td></tr>
344<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;3.520</td></tr>
345<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;3.104</td></tr>
346</table>
347
348<p>
349As recently as version 2.7.0, SQLite ran at about the same speed as
350MySQL on this test. But recent optimizations to SQLite have more
351than doubled speed of UPDATEs.
352</p>
353
354<h3>Test 10: 25000 text UPDATEs with an index</h3>
355<blockquote>
356BEGIN;<br>
357UPDATE t2 SET c='one hundred forty eight thousand three hundred eighty two' WHERE a=1;<br>
358UPDATE t2 SET c='three hundred sixty six thousand five hundred two' WHERE a=2;<br>
359<i>... 24996 lines omitted</i><br>
360UPDATE t2 SET c='three hundred eighty three thousand ninety nine' WHERE a=24999;<br>
361UPDATE t2 SET c='two hundred fifty six thousand eight hundred thirty' WHERE a=25000;<br>
362COMMIT;<br>
363
364</blockquote><table border=0 cellpadding=0 cellspacing=0>
365<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;48.133</td></tr>
366<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;6.982</td></tr>
367<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;2.408</td></tr>
368<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;1.725</td></tr>
369</table>
370
371<p>
372Here again, version 2.7.0 of SQLite used to run at about the same speed
373as MySQL. But now version 2.7.6 is over two times faster than MySQL and
374over twenty times faster than PostgreSQL.
375</p>
376
377<p>
378In fairness to PostgreSQL, it started thrashing on this test. A
379knowledgeable administrator might be able to get PostgreSQL to run a lot
380faster here by tweaking and tuning the server a little.
381</p>
382
383<h3>Test 11: INSERTs from a SELECT</h3>
384<blockquote>
385BEGIN;<br>INSERT INTO t1 SELECT b,a,c FROM t2;<br>INSERT INTO t2 SELECT b,a,c FROM t1;<br>COMMIT;
386</blockquote><table border=0 cellpadding=0 cellspacing=0>
387<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;61.364</td></tr>
388<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;1.537</td></tr>
389<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;2.787</td></tr>
390<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;1.599</td></tr>
391</table>
392
393<p>
394The asynchronous SQLite is just a shade slower than MySQL on this test.
395(MySQL seems to be especially adept at INSERT...SELECT statements.)
396The PostgreSQL engine is still thrashing - most of the 61 seconds it used
397were spent waiting on disk I/O.
398</p>
399
400<h3>Test 12: DELETE without an index</h3>
401<blockquote>
402DELETE FROM t2 WHERE c LIKE '%fifty%';
403</blockquote><table border=0 cellpadding=0 cellspacing=0>
404<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;1.509</td></tr>
405<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;0.975</td></tr>
406<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;4.004</td></tr>
407<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;0.560</td></tr>
408</table>
409
410<p>
411The synchronous version of SQLite is the slowest of the group in this test,
412but the asynchronous version is the fastest.
413The difference is the extra time needed to execute fsync().
414</p>
415
416<h3>Test 13: DELETE with an index</h3>
417<blockquote>
418DELETE FROM t2 WHERE a>10 AND a<20000;
419</blockquote><table border=0 cellpadding=0 cellspacing=0>
420<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;1.316</td></tr>
421<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;2.262</td></tr>
422<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;2.068</td></tr>
423<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;0.752</td></tr>
424</table>
425
426<p>
427This test is significant because it is one of the few where
428PostgreSQL is faster than MySQL. The asynchronous SQLite is,
429however, faster then both the other two.
430</p>
431
432<h3>Test 14: A big INSERT after a big DELETE</h3>
433<blockquote>
434INSERT INTO t2 SELECT * FROM t1;
435</blockquote><table border=0 cellpadding=0 cellspacing=0>
436<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;13.168</td></tr>
437<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;1.815</td></tr>
438<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;3.210</td></tr>
439<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;1.485</td></tr>
440</table>
441
442<p>
443Some older versions of SQLite (prior to version 2.4.0)
444would show decreasing performance after a
445sequence of DELETEs followed by new INSERTs. As this test shows, the
446problem has now been resolved.
447</p>
448
449<h3>Test 15: A big DELETE followed by many small INSERTs</h3>
450<blockquote>
451BEGIN;<br>
452DELETE FROM t1;<br>
453INSERT INTO t1 VALUES(1,10719,'ten thousand seven hundred nineteen');<br>
454<i>... 11997 lines omitted</i><br>
455INSERT INTO t1 VALUES(11999,72836,'seventy two thousand eight hundred thirty six');<br>
456INSERT INTO t1 VALUES(12000,64231,'sixty four thousand two hundred thirty one');<br>
457COMMIT;<br>
458
459</blockquote><table border=0 cellpadding=0 cellspacing=0>
460<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;4.556</td></tr>
461<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;1.704</td></tr>
462<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;0.618</td></tr>
463<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;0.406</td></tr>
464</table>
465
466<p>
467SQLite is very good at doing INSERTs within a transaction, which probably
468explains why it is so much faster than the other databases at this test.
469</p>
470
471<h3>Test 16: DROP TABLE</h3>
472<blockquote>
473DROP TABLE t1;<br>DROP TABLE t2;<br>DROP TABLE t3;
474</blockquote><table border=0 cellpadding=0 cellspacing=0>
475<tr><td>PostgreSQL:</td><td align="right">&nbsp;&nbsp;&nbsp;0.135</td></tr>
476<tr><td>MySQL:</td><td align="right">&nbsp;&nbsp;&nbsp;0.015</td></tr>
477<tr><td>SQLite 2.7.6:</td><td align="right">&nbsp;&nbsp;&nbsp;0.939</td></tr>
478<tr><td>SQLite 2.7.6 (nosync):</td><td align="right">&nbsp;&nbsp;&nbsp;0.254</td></tr>
479</table>
480
481<p>
482SQLite is slower than the other databases when it comes to dropping tables.
483This probably is because when SQLite drops a table, it has to go through and
484erase the records in the database file that deal with that table. MySQL and
485PostgreSQL, on the other hand, use separate files to represent each table
486so they can drop a table simply by deleting a file, which is much faster.
487</p>
488
489<p>
490On the other hand, dropping tables is not a very common operation
491so if SQLite takes a little longer, that is not seen as a big problem.
492</p>
493
494}
495footer $rcsid