On 2 Nov 2009, at 6:39pm, chen jia wrote:

> Thanks for your replies, Simon and Dair.
>
> Yes, it is probably a bug in sqlite version 3.6.10.  After I upgraded
> to version 3.6.12, I ran vacuum again and had no problems.

That's good news.

> I do have more questions.
>
> I want to clean fragmentation in the database with vacuum command.
>
> When I ran a combination of '.dump' and '.read' commands to create a
> new database, for example, $sqlite3 hq.db '.dump' | sqlite3 hq_new.db,
> does it achieve the same thing as vacuum does?

I don't think there would be much difference between the two resulting  
database files.

> If yes, what's the
> advantage of vaccum? Thanks.

You can call VACUUM from your own program, as a SQL command.  It would  
be much faster than dumping to text and reading the text file again.   
There is no easy way to dump a database to a text file inside your own  
program unless you can call the sqlite3 command-line tool.

On the other hand, if you are trying to ensure that your data is  
readable by many applications, or to compress your data to the  
smallest file, the ability of the command-line tool to produce a text  
file is extremely useful.  And just in case your database is corrupt  
in some way, dumping the data as text is more likely to get rid of  
corruption.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to