Kim Gräsman wrote:
> I would expect SQLite to allocate a page cache per session.

There is typically one page cache instance per connection.
(A connection is what you get from sqlite3_open*(); a session would be
what you get from sqlite3session_create().)

> So if we want to use SQLITE_CONFIG_PAGECACHE to provide a
> preallocated buffer for the page cache, it looks like we have to
> provide it for the worst case, i.e. max(page size) * sum(cache
> requirements for all sessions). Is that the case?

Yes; the SQLITE_CONFIG_PAGECACHE memory is used by all cache instances.

> is SQLITE_CONFIG_PAGECACHE used to specify an arena for page caches,
> or a buffer for pages between all sessions?

A page cache instance is a list of pages; memory for each page is
allocated individually.

> Since we have different page sizes (512 bytes and 4K respectively) I'm
> worried we'll have lots of dead space if SQLITE_CONFIG_PAGECACHE is
> set up for 4K pages and requests for 512-byte pages are served from
> there directly.

If your use case is more complex than the simple mechanism offered by
SQLITE_CONFIG_PAGECACHE, consider using SQLITE_CONFIG_PCACHE2 (or
SQLITE_CONFIG_MALLOC).


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to