On Mon, 18 Aug 2008 13:57:16 +0200, Richard wrote:

>Hi,
>
>What is the right time to do a vacuum?
>Is it useful to do it every time you start or stop your application?

Not necessarily. Depends on the dynamics of the application.

>Or can you take a look at the pages that have been used? 

That would be a good idea.

>If so how do you do that exactly?

Get total number of pages in the database:
PRAGMA page_count;

Get number of free pages in the database:
PRAGMA freelist_count;

You could vacuum if freelist_count reaches a certain
threshold, for example 40%. Alternatively, you can use

PRAGMA auto_vacuum =
        0 | none | 1 | full | 2 | incremental;
PRAGMA incremental_vacuum(N);

http://www.sqlite.org/pragma.html#pragma_incremental_vacuum

>Thanks,
>Richard
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to