>       I use sqlite3 on resource limited embedded devices, and  it
> provide only 250K memory for sqlite.
> Now, I have a table named test_tab,whose size is 300K bytes.
> If I want to copy this big table to another table, this operation will fail
> because of limitde memory.

The first thing I would try to do is to reduce the SQLite page cache. 
By default, it is set for 2000 pages.  At about 1.5K RAM each, that is a 
peak of 3MB.  When you copy the big table, it may exceed your 250KB 
allocation limit by trying to cache the whole table into RAM.

In your case, you might reduce the page cache to 100 pages or so.  (Of 
course, this may have a performance impact.)  This can be done via the 
pragma cache_size directive.  In addition, you will probably want to 
ensure that your temp_store (for temporary tables, etc) is set to FILE. 
  See http://www.sqlite.org/pragma.html for more info.

Finally, take a look at the lookaside memory allocator.  By default, it 
creates a working buffer of 50KB per connection.  Reducing this buffer 
may make more room for page cache (above).  You'll have to find a good 
balance that works for your system.  See http://www.sqlite.org/malloc.html .

Hope this helps,
  Eric
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to