On Jul 21, 2008, at 2:10 AM, [EMAIL PROTECTED] wrote:

>
> Hello,
>
> to answer the following question:
>
> Amount of memory for caching one page with x byte page size?
>
> I found in the Draft 3.6.0 Doc the following information:
>
>
> PRAGMA page_size = bytes;
>
> Query or set the page size of the database.
> The page size may only be set if the database has not yet been  
> created.
> The page size must be a power of two greater than or equal to 512 and
> less than or equal to SQLITE_MAX_PAGE_SIZE.
> The maximum value for SQLITE_MAX_PAGE_SIZE is 32768.
>
>
>
> PRAGMA default_cache_size = Number-of-pages;
>
> Query or change the maximum number of database disk pages that SQLite
> will hold in memory at once.
> Each page uses 1K on disk and about 1.5K in memory. .......
>
>
> Obviously you have an overhand per page-size to calculate the memory
> requirement for caching on page.
>
> Do I understand this right?

Right. When a page is loaded into the cache, SQLite allocates memory
for the page data (1024 bytes, or whatever size you are using) and also
memory for a structure full of other variables required by each cached
page (page number, dirty flag, is-journalled flag, various pointers
for linked lists, lots of stuff). The overhead probably isn't quite
512 bytes, but as a rule of thumb this formula works Ok.

Dan.

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

Reply via email to