>> Is there any
>> reliable method to determine the minimum page-cache allocation size
>> needed for a given page_size?
>>
>
>sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, ...)

Unfortunately, there is extra overhead involved which is not handled by the 
page cache but is allocated by malloc() if I understand correctly.

 From reading the sources (some weeks ago, the exact numbers might have 
changed) I determined an extra of at least 152 bytes are allocated for each 
page. 

Reference is nByteHdr in pager.c, plus an extra 4 byte (on 32 bit) for the slot 
the page hash (probably a little more to accommodate for empty slots). 
Interestingly, the page cache overhead size can differ between SQLite versions 
and also depends on SQLITE_OMIT_... compiler settings.

152 bytes might not seem much but this is nearly 15% for a page cache size of 
1024 bytes, and nearly 30% for a 512 byte page cache. So you safe overhead by 
choosing a larger page size.

Concluding, memory requirements are much higher than just 

  pragma page_size * pragma cache_size

This can sum up to lots of RAM when using page_size = 100000 or more to speed 
up indexing of very large databases.

Users should be aware of this when running SQLite on extreme (low RAM or high 
size database) scenarios.

Ralf 

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

Reply via email to