DRH, Many thanks.
I learned something new everyday thanks to Sqlite !!! Regards, Ken --- On Wed, 9/10/08, D. Richard Hipp <[EMAIL PROTECTED]> wrote: From: D. Richard Hipp <[EMAIL PROTECTED]> Subject: Re: [sqlite] Memory suggestion for DRH To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> Date: Wednesday, September 10, 2008, 1:21 PM On Sep 10, 2008, at 2:02 PM, Ken wrote: > > My suggestion for a future enhancement: > Provide a temporary storage pool of memory. > If the temporary pool overflows then go to disk based temp store. > > That way order by query results can generally be quickly satisfied > by the average case memory consumption and Large order by queries > will eventually spill to disk. > > Just a thought.... for your consideration. > Most modern operating systems will do this for you automatically. When SQLite creates a temporary database file, it does so using flags and settings that let the OS know that the content of the file is not important, does not require fsync(), and can be deleted when the file is closed or the process dies. As a result, the data that is "written to disk" by SQLite never really goes to disk, unless the system is under extreme memory pressure. Instead, the data is stored in the OS disk cache. No actual disk I/O occurs. This approach has the advantage that the OS can reclaim the memory space for other purposes once the temporary file is closed (something that will not normally happen if free() is used to release memory internally). And, under severe memory pressure, the OS can choose to really write the data to disk to free up memory - thus trading off performance for avoiding a crash. If you are running on an embedded device that does not support a good disk cache, then you can emulate the disk cache behavior in the VFS layer. SQLite passes sufficient flag information into the "open" method of the VFS to let it know when the file can be a memory cache versus a real file. D. Richard Hipp [EMAIL PROTECTED] _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users