]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Update and modernize an obsolete comment associated with VACUUM. No
authordrh <drh@noemail.net>
Mon, 30 Sep 2013 11:01:28 +0000 (11:01 +0000)
committerdrh <drh@noemail.net>
Mon, 30 Sep 2013 11:01:28 +0000 (11:01 +0000)
changes to code.

FossilOrigin-Name: 94c914e3fa632f88a0d0c14537f81aa46759e2be

manifest
manifest.uuid
src/vacuum.c

index 7b9b89807afcd9eb7b5101f81e147378e7ae081a..85d836ffe1a07f2b05f176005ef5690e1ac43927 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\stypo\sin\scomment.\s\sNo\schanges\sto\scode.
-D 2013-09-29T04:56:43.411
+C Update\sand\smodernize\san\sobsolete\scomment\sassociated\swith\sVACUUM.\s\sNo\nchanges\sto\scode.
+D 2013-09-30T11:01:28.709
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -276,7 +276,7 @@ F src/trigger.c 5c0ea9b8755e7c5e1a700f3e27ac4f8d92dd221e
 F src/update.c f5182157f5d0d0a97bc5f5e3c9bdba0dfbe08f08
 F src/utf.c 6fc6c88d50448c469c5c196acf21617a24f90269
 F src/util.c 7f3e35432d6888d1e770c488c35bd98970c44eec
-F src/vacuum.c d9c5759f4c5a438bb43c2086f72c5d2edabc36c8
+F src/vacuum.c f313bc97123a4dd4bfd3f50a00c4d44c08a5b1b7
 F src/vdbe.c 56e648f5ba9a91810caf216857adfed9039cd174
 F src/vdbe.h 4f554b5627f26710c4c36d919110a3fc611ca5c4
 F src/vdbeInt.h ff57f67aee1ba26a3a47e786533dab155ab6dad6
@@ -1115,7 +1115,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P a6cd14effef0a4e5520eea871523e6e7a7d30aef
-R 923b26015823bc3db656197e1ffd675f
-U mistachkin
-Z c90a0fd031634fcd7d5e3ee1883fd10f
+P 0b7bd46825b09c9e46290baee3e239344ca5bf0e
+R 8fdd810817894b7b67859afecaa16e29
+U drh
+Z 2a5599152c5ec584cede2eec05e0bcb2
index e6c6c5614e86d4bedf33599f548050f34a5264c6..1c273be734b6ddeae7bbff3ef0a9104134218a60 100644 (file)
@@ -1 +1 @@
-0b7bd46825b09c9e46290baee3e239344ca5bf0e
\ No newline at end of file
+94c914e3fa632f88a0d0c14537f81aa46759e2be
\ No newline at end of file
index 4ba09fd4d9977799e538692795de0462ec21a424..5d41d93e0dce400bfc3e5bf598dfc8cfadfc65b0 100644 (file)
@@ -72,14 +72,34 @@ static int execExecSql(sqlite3 *db, char **pzErrMsg, const char *zSql){
 }
 
 /*
-** The non-standard VACUUM command is used to clean up the database,
+** The VACUUM command is used to clean up the database,
 ** collapse free space, etc.  It is modelled after the VACUUM command
-** in PostgreSQL.
+** in PostgreSQL.  The VACUUM command works as follows:
 **
-** In version 1.0.x of SQLite, the VACUUM command would call
-** gdbm_reorganize() on all the database tables.  But beginning
-** with 2.0.0, SQLite no longer uses GDBM so this command has
-** become a no-op.
+**   (1)  Create a new transient database file
+**   (2)  Copy all content from the database being vacuumed into
+**        the new transient database file
+**   (3)  Copy content from the transient database back into the
+**        original database.
+**
+** The transient database requires temporary disk space approximately
+** equal to the size of the original database.  The copy operation of
+** step (3) requires additional temporary disk space approximately equal
+** to the size of the original database for the rollback journal.
+** Hence, temporary disk space that is approximately 2x the size of the
+** orginal database is required.  Every page of the database is written
+** approximately 3 times:  Once for step (2) and twice for step (3).
+** Two writes per page are required in step (3) because the original
+** database content must be written into the rollback journal prior to
+** overwriting the database with the vacuumed content.
+**
+** Only 1x temporary space and only 1x writes would be required if
+** the copy of step (3) were replace by deleting the original database
+** and renaming the transient database as the original.  But that will
+** not work if other processes are attached to the original database.
+** And a power loss in between deleting the original and renaming the
+** transient would cause the database file to appear to be deleted
+** following reboot.
 */
 void sqlite3Vacuum(Parse *pParse){
   Vdbe *v = sqlite3GetVdbe(pParse);