diff options
author | dan miller | 2007-10-21 08:36:32 +0000 |
---|---|---|
committer | dan miller | 2007-10-21 08:36:32 +0000 |
commit | 2f8d7092bc2c9609fa98d6888106b96f38b22828 (patch) | |
tree | da6c37579258cc965b52a75aee6135fe44237698 /libraries/sqlite/unix/sqlite-3.5.1/www/whentouse.tcl | |
parent | * Committing new PolicyManager based on an ACL system. (diff) | |
download | opensim-SC-2f8d7092bc2c9609fa98d6888106b96f38b22828.zip opensim-SC-2f8d7092bc2c9609fa98d6888106b96f38b22828.tar.gz opensim-SC-2f8d7092bc2c9609fa98d6888106b96f38b22828.tar.bz2 opensim-SC-2f8d7092bc2c9609fa98d6888106b96f38b22828.tar.xz |
libraries moved to opensim-libs, a new repository
Diffstat (limited to '')
-rw-r--r-- | libraries/sqlite/unix/sqlite-3.5.1/www/whentouse.tcl | 254 |
1 files changed, 0 insertions, 254 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/www/whentouse.tcl b/libraries/sqlite/unix/sqlite-3.5.1/www/whentouse.tcl deleted file mode 100644 index bb4378b..0000000 --- a/libraries/sqlite/unix/sqlite-3.5.1/www/whentouse.tcl +++ /dev/null | |||
@@ -1,254 +0,0 @@ | |||
1 | # | ||
2 | # Run this TCL script to generate HTML for the goals.html file. | ||
3 | # | ||
4 | set rcsid {$Id: whentouse.tcl,v 1.7 2007/04/14 12:04:39 drh Exp $} | ||
5 | source common.tcl | ||
6 | header {Appropriate Uses For SQLite} | ||
7 | |||
8 | puts { | ||
9 | <p> | ||
10 | SQLite is different from most other SQL database engines in that its | ||
11 | primary design goal is to be simple: | ||
12 | </p> | ||
13 | |||
14 | <ul> | ||
15 | <li>Simple to administer</li> | ||
16 | <li>Simple to operate</li> | ||
17 | <li>Simple to embed in a larger program</li> | ||
18 | <li>Simple to maintain and customize</li> | ||
19 | </ul> | ||
20 | |||
21 | <p> | ||
22 | Many people like SQLite because it is small and fast. But those | ||
23 | qualities are just happy accidents. | ||
24 | Users also find that SQLite is very reliable. Reliability is | ||
25 | a consequence of simplicity. With less complication, there is | ||
26 | less to go wrong. So, yes, SQLite is small, fast, and reliable, | ||
27 | but first and foremost, SQLite strives to be simple. | ||
28 | </p> | ||
29 | |||
30 | <p> | ||
31 | Simplicity in a database engine can be either a strength or a | ||
32 | weakness, depending on what you are trying to do. In order to | ||
33 | achieve simplicity, SQLite has had to sacrifice other characteristics | ||
34 | that some people find useful, such as high concurrency, fine-grained | ||
35 | access control, a rich set of built-in functions, stored procedures, | ||
36 | esoteric SQL language features, XML and/or Java extensions, | ||
37 | tera- or peta-byte scalability, and so forth. If you need some of these | ||
38 | features and do not mind the added complexity that they | ||
39 | bring, then SQLite is probably not the database for you. | ||
40 | SQLite is not intended to be an enterprise database engine. It | ||
41 | not designed to compete with Oracle or PostgreSQL. | ||
42 | </p> | ||
43 | |||
44 | <p> | ||
45 | The basic rule of thumb for when it is appropriate to use SQLite is | ||
46 | this: Use SQLite in situations where simplicity of administration, | ||
47 | implementation, and maintenance are more important than the countless | ||
48 | complex features that enterprise database engines provide. | ||
49 | As it turns out, situations where simplicity is the better choice | ||
50 | are more common than many people realize. | ||
51 | </p> | ||
52 | |||
53 | <h2>Situations Where SQLite Works Well</h2> | ||
54 | |||
55 | <ul> | ||
56 | <li><p><b>Websites</b></p> | ||
57 | |||
58 | <p>SQLite usually will work great as the database engine for low to | ||
59 | medium traffic websites (which is to say, 99.9% of all websites). | ||
60 | The amount of web traffic that SQLite can handle depends, of course, | ||
61 | on how heavily the website uses its database. Generally | ||
62 | speaking, any site that gets fewer than a 100000 hits/day should work | ||
63 | fine with SQLite. | ||
64 | The 100000 hits/day figure is a conservative estimate, not a | ||
65 | hard upper bound. | ||
66 | SQLite has been demonstrated to work with 10 times that amount | ||
67 | of traffic.</p> | ||
68 | </li> | ||
69 | |||
70 | <li><p><b>Embedded devices and applications</b></p> | ||
71 | |||
72 | <p>Because an SQLite database requires little or no administration, | ||
73 | SQLite is a good choice for devices or services that must work | ||
74 | unattended and without human support. SQLite is a good fit for | ||
75 | use in cellphones, PDAs, set-top boxes, and/or appliances. It also | ||
76 | works well as an embedded database in downloadable consumer applications. | ||
77 | </p> | ||
78 | </li> | ||
79 | |||
80 | <li><p><b>Application File Format</b></p> | ||
81 | |||
82 | <p> | ||
83 | SQLite has been used with great success as the on-disk file format | ||
84 | for desktop applications such as financial analysis tools, CAD | ||
85 | packages, record keeping programs, and so forth. The traditional | ||
86 | File/Open operation does an sqlite3_open() and executes a | ||
87 | BEGIN TRANSACTION to get exclusive access to the content. File/Save | ||
88 | does a COMMIT followed by another BEGIN TRANSACTION. The use | ||
89 | of transactions guarantees that updates to the application file are atomic, | ||
90 | durable, isolated, and consistent. | ||
91 | </p> | ||
92 | |||
93 | <p> | ||
94 | Temporary triggers can be added to the database to record all | ||
95 | changes into a (temporary) undo/redo log table. These changes can then | ||
96 | be played back when the user presses the Undo and Redo buttons. Using | ||
97 | this technique, a unlimited depth undo/redo implementation can be written | ||
98 | in surprising little code. | ||
99 | </p> | ||
100 | </li> | ||
101 | |||
102 | <li><p><b>Replacement for <i>ad hoc</i> disk files</b></p> | ||
103 | |||
104 | <p>Many programs use fopen(), fread(), and fwrite() to create and | ||
105 | manage files of data in home-grown formats. SQLite works | ||
106 | particularly well as a | ||
107 | replacement for these <i>ad hoc</i> data files.</p> | ||
108 | </li> | ||
109 | |||
110 | <li><p><b>Internal or temporary databases</b></p> | ||
111 | |||
112 | <p> | ||
113 | For programs that have a lot of data that must be sifted and sorted | ||
114 | in diverse ways, it is often easier and quicker to load the data into | ||
115 | an in-memory SQLite database and use queries with joins and ORDER BY | ||
116 | clauses to extract the data in the form and order needed rather than | ||
117 | to try to code the same operations manually. | ||
118 | Using an SQL database internally in this way also gives the program | ||
119 | greater flexibility since new columns and indices can be added without | ||
120 | having to recode every query. | ||
121 | </p> | ||
122 | </li> | ||
123 | |||
124 | <li><p><b>Command-line dataset analysis tool</b></p> | ||
125 | |||
126 | <p> | ||
127 | Experienced SQL users can employ | ||
128 | the command-line <b>sqlite</b> program to analyze miscellaneous | ||
129 | datasets. Raw data can be imported from CSV files, then that | ||
130 | data can be sliced and diced to generate a myriad of summary | ||
131 | reports. Possible uses include website log analysis, sports | ||
132 | statistics analysis, compilation of programming metrics, and | ||
133 | analysis of experimental results. | ||
134 | </p> | ||
135 | |||
136 | <p> | ||
137 | You can also do the same thing with a enterprise client/server | ||
138 | database, of course. The advantages to using SQLite in this situation | ||
139 | are that SQLite is much easier to set up and the resulting database | ||
140 | is a single file that you can store on a floppy disk or flash-memory stick | ||
141 | or email to a colleague. | ||
142 | </p> | ||
143 | </li> | ||
144 | |||
145 | <li><p><b>Stand-in for an enterprise database during demos or testing</b></p> | ||
146 | |||
147 | <p> | ||
148 | If you are writing a client application for an enterprise database engine, | ||
149 | it makes sense to use a generic database backend that allows you to connect | ||
150 | to many different kinds of SQL database engines. It makes even better | ||
151 | sense to | ||
152 | go ahead and include SQLite in the mix of supported database and to statically | ||
153 | link the SQLite engine in with the client. That way the client program | ||
154 | can be used standalone with an SQLite data file for testing or for | ||
155 | demonstrations. | ||
156 | </p> | ||
157 | </li> | ||
158 | |||
159 | <li><p><b>Database Pedagogy</b></p> | ||
160 | |||
161 | <p> | ||
162 | Because it is simple to setup and use (installation is trivial: just | ||
163 | copy the <b>sqlite</b> or <b>sqlite.exe</b> executable to the target machine | ||
164 | and run it) SQLite makes a good database engine for use in teaching SQL. | ||
165 | Students can easily create as many databases as they like and can | ||
166 | email databases to the instructor for comments or grading. For more | ||
167 | advanced students who are interested in studying how an RDBMS is | ||
168 | implemented, the modular and well-commented and documented SQLite code | ||
169 | can serve as a good basis. This is not to say that SQLite is an accurate | ||
170 | model of how other database engines are implemented, but rather a student who | ||
171 | understands how SQLite works can more quickly comprehend the operational | ||
172 | principles of other systems. | ||
173 | </p> | ||
174 | </li> | ||
175 | |||
176 | <li><p><b>Experimental SQL language extensions</b></p> | ||
177 | |||
178 | <p>The simple, modular design of SQLite makes it a good platform for | ||
179 | prototyping new, experimental database language features or ideas. | ||
180 | </p> | ||
181 | </li> | ||
182 | |||
183 | |||
184 | </ul> | ||
185 | |||
186 | <h2>Situations Where Another RDBMS May Work Better</h2> | ||
187 | |||
188 | <ul> | ||
189 | <li><p><b>Client/Server Applications</b><p> | ||
190 | |||
191 | <p>If you have many client programs accessing a common database | ||
192 | over a network, you should consider using a client/server database | ||
193 | engine instead of SQLite. SQLite will work over a network filesystem, | ||
194 | but because of the latency associated with most network filesystems, | ||
195 | performance will not be great. Also, the file locking logic of | ||
196 | many network filesystems implementation contains bugs (on both Unix | ||
197 | and windows). If file locking does not work like it should, | ||
198 | it might be possible for two or more client programs to modify the | ||
199 | same part of the same database at the same time, resulting in | ||
200 | database corruption. Because this problem results from bugs in | ||
201 | the underlying filesystem implementation, there is nothing SQLite | ||
202 | can do to prevent it.</p> | ||
203 | |||
204 | <p>A good rule of thumb is that you should avoid using SQLite | ||
205 | in situations where the same database will be accessed simultaneously | ||
206 | from many computers over a network filesystem.</p> | ||
207 | </li> | ||
208 | |||
209 | <li><p><b>High-volume Websites</b></p> | ||
210 | |||
211 | <p>SQLite will normally work fine as the database backend to a website. | ||
212 | But if you website is so busy that your are thinking of splitting the | ||
213 | database component off onto a separate machine, then you should | ||
214 | definitely consider using an enterprise-class client/server database | ||
215 | engine instead of SQLite.</p> | ||
216 | </li> | ||
217 | |||
218 | <li><p><b>Very large datasets</b></p> | ||
219 | |||
220 | <p>When you start a transaction in SQLite (which happens automatically | ||
221 | before any write operation that is not within an explicit BEGIN...COMMIT) | ||
222 | the engine has to allocate a bitmap of dirty pages in the disk file to | ||
223 | help it manage its rollback journal. SQLite needs 256 bytes of RAM for | ||
224 | every 1MiB of database (assuming a 1024-byte page size: less memory is | ||
225 | used with larger page sizes, of course). | ||
226 | For smaller databases, the amount of memory | ||
227 | required is not a problem, but when database begin to grow into the | ||
228 | multi-gigabyte range, the size of the bitmap can get quite large. If | ||
229 | you need to store and modify more than a few dozen GB of data, you should | ||
230 | consider using a different database engine. | ||
231 | </p> | ||
232 | </li> | ||
233 | |||
234 | <li><p><b>High Concurrency</b></p> | ||
235 | |||
236 | <p> | ||
237 | SQLite uses reader/writer locks on the entire database file. That means | ||
238 | if any process is reading from any part of the database, all other | ||
239 | processes are prevented from writing any other part of the database. | ||
240 | Similarly, if any one process is writing to the database, | ||
241 | all other processes are prevented from reading any other part of the | ||
242 | database. | ||
243 | For many situations, this is not a problem. Each application | ||
244 | does its database work quickly and moves on, and no lock lasts for more | ||
245 | than a few dozen milliseconds. But there are some applications that require | ||
246 | more concurrency, and those applications may need to seek a different | ||
247 | solution. | ||
248 | </p> | ||
249 | </li> | ||
250 | |||
251 | </ul> | ||
252 | |||
253 | } | ||
254 | footer $rcsid | ||