RE: [sqlite] Can the memory usage of SQLite be adjusted?
<[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > <[EMAIL PROTECTED]> wrote: > > > I completed my analysis of the SQLite database memory usage and I was > > > surprised to find that SQLite consumes so much memory. I ran my test > > > case (creates 31 tables) and found that SQLite consumed 545,231 bytes > > > of malloced memory before it started giving it back. > > > > > > > 100K? yes. 20K? no. > > > What is the set of commands to do this? > Ray > > There is no "command" to make SQLite use less memory. > Rather you have to use careful engineering to keep > the memory usage to a minimum. Start with this: > > PRAGMA default_cache_size=10; > > Then close your connection and reopen it and do this: > > PRAGMA cache_size; > > Verify that you got a "10" back so that the change took. > > When you compile, you will want to leave out as much stuff > as you do not need using SQLITE_OMIT_* flags. You will > want to take care in your use of SQL so that you do not > specify SQL statements that inherently require a lot of > memory. You'll probably want to make use of > sqlite3_soft_heap_limit() and sqlite3_release_memory(). > Stay far, far away from sqlite3_get_table(). And so > forth. Do we need to close the database connection and reopen it for the setting of cache_size to be effective? How do we reduce the memory by setting the cache_size? Will there be any freeing up of memory in case where cache_size is reduced? Regards, Phani - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Can the memory usage of SQLite be adjusted?
[EMAIL PROTECTED] wrote: > <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > <[EMAIL PROTECTED]> wrote: > > > > I completed my analysis of the SQLite database memory usage and I was > > > > surprised to find that SQLite consumes so much memory. I ran my test > > > > case (creates 31 tables) and found that SQLite consumed 545,231 bytes > > > > of malloced memory before it started giving it back. > > > > > > > > > > 100K? yes. 20K? no. > > > > > What is the set of commands to do this? > > Ray > > > > There is no "command" to make SQLite use less memory. > Rather you have to use careful engineering to keep > the memory usage to a minimum. Start with this: > > PRAGMA default_cache_size=10; > > Then close your connection and reopen it and do this: > > PRAGMA cache_size; > > Verify that you got a "10" back so that the change took. > > When you compile, you will want to leave out as much stuff > as you do not need using SQLITE_OMIT_* flags. You will > want to take care in your use of SQL so that you do not > specify SQL statements that inherently require a lot of > memory. You'll probably want to make use of > sqlite3_soft_heap_limit() and sqlite3_release_memory(). > Stay far, far away from sqlite3_get_table(). And so > forth. > > -- > D. Richard Hipp <[EMAIL PROTECTED]> > > > - > To unsubscribe, send email to [EMAIL PROTECTED] > - > Thanks for the info. Ray - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Can the memory usage of SQLite be adjusted?
<[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > <[EMAIL PROTECTED]> wrote: > > > I completed my analysis of the SQLite database memory usage and I was > > > surprised to find that SQLite consumes so much memory. I ran my test > > > case (creates 31 tables) and found that SQLite consumed 545,231 bytes > > > of malloced memory before it started giving it back. > > > > > > > 100K? yes. 20K? no. > > > What is the set of commands to do this? > Ray > There is no "command" to make SQLite use less memory. Rather you have to use careful engineering to keep the memory usage to a minimum. Start with this: PRAGMA default_cache_size=10; Then close your connection and reopen it and do this: PRAGMA cache_size; Verify that you got a "10" back so that the change took. When you compile, you will want to leave out as much stuff as you do not need using SQLITE_OMIT_* flags. You will want to take care in your use of SQL so that you do not specify SQL statements that inherently require a lot of memory. You'll probably want to make use of sqlite3_soft_heap_limit() and sqlite3_release_memory(). Stay far, far away from sqlite3_get_table(). And so forth. -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Can the memory usage of SQLite be adjusted?
[EMAIL PROTECTED] wrote: > <[EMAIL PROTECTED]> wrote: > > I completed my analysis of the SQLite database memory usage and I was > > surprised to find that SQLite consumes so much memory. I ran my test > > case (creates 31 tables) and found that SQLite consumed 545,231 bytes of > > malloced memory before it started giving it back. > > > > I tried setting the pragma cached_pages to 10 thinking that would set > > the amount of memory consumed to around 10K. It didn't work. > > > > Is there a way to set the amount of memory consumed by SQLite to around > > 20K? > > Ray > > > > 100K? yes. 20K? no. > -- > D. Richard Hipp <[EMAIL PROTECTED]> > > > - > To unsubscribe, send email to [EMAIL PROTECTED] > - > What is the set of commands to do this? Ray - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Can the memory usage of SQLite be adjusted?
<[EMAIL PROTECTED]> wrote: > I completed my analysis of the SQLite database memory usage and I was > surprised to find that SQLite consumes so much memory. I ran my test > case (creates 31 tables) and found that SQLite consumed 545,231 bytes of > malloced memory before it started giving it back. > > I tried setting the pragma cached_pages to 10 thinking that would set > the amount of memory consumed to around 10K. It didn't work. > > Is there a way to set the amount of memory consumed by SQLite to around 20K? > Ray > 100K? yes. 20K? no. -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] -