I don't know what's the best value for chunk size. I'm not even sure that it's useful to set it to any value at all. So let your test results guide you. The only thought I have is the chunk size should be a multiple of page size (don't know if SQLite's code rounds up to such multiple internally).
Pavel On Tue, Feb 22, 2011 at 10:14 AM, Sven L <larvpo...@hotmail.se> wrote: > > What I meant is this: > Database size = 1 MB. When opening connection, set chunk to ~100 kB. > Database size = 100 MB. When opening connection, set chunk to ~10 MB. > Database size = 1 GB. When opening connection, set chunk to ~100 MB. > > I guess SQLITE_FCNTL_CHUNK_SIZE should be a 2^n value, so this gives me this > algorithm: > > unsigned int v = databaseSizeBytes / 10; > // Round up to the next highest power of 2 (well-known bit trick ;) > --v; > v |= v >> 1; > v |= v >> 2; > v |= v >> 4; > v |= v >> 8; > v |= v >> 16; > ++v; > > // A minimum of 32 kB is desirable? > chunkSize = max(32768, v); > > > Thoughts? > > >> From: paiva...@gmail.com >> Date: Tue, 22 Feb 2011 10:01:03 -0500 >> Subject: Re: [sqlite] Auto-grow setting? >> To: sqlite-users@sqlite.org >> CC: larvpo...@hotmail.se >> >> Please reply to the list, not to me only. >> >> It's impossible to set chunk size to percentage of the database size, >> you can only set a constant value. >> >> >> Pavel >> >> On Tue, Feb 22, 2011 at 9:13 AM, Sven L <larvpo...@hotmail.se> wrote: >> > Thanks a lot! :D >> > >> > What do you think of setting the chunk size to approximately 10% of the >> > database file size? Or is it better to use a constant? >> > >> >> From: paiva...@gmail.com >> >> Date: Tue, 22 Feb 2011 08:30:54 -0500 >> >> Subject: Re: [sqlite] Auto-grow setting? >> >> To: sqlite-users@sqlite.org >> >> CC: larvpo...@hotmail.se >> >> >> >> Is SQLITE_FCNTL_CHUNK_SIZE what you are looking for? See more >> >> information about it here: >> >> http://www.sqlite.org/c3ref/c_fcntl_chunk_size.html. Notice that this >> >> feature appeared only in recent version of SQLite, so if you have some >> >> earlier version you won't be able to control it and SQLite will >> >> grow/shrink database page-by-page (maximum page size is 32Kb). >> >> >> >> >> >> Pavel >> >> >> >> On Tue, Feb 22, 2011 at 7:28 AM, Sven L <larvpo...@hotmail.se> wrote: >> >> > >> >> > Can't seem to find a setting to control how the database file grows when >> >> > full. Is there such a setting? >> >> > It looks like the file increases by some < 100 kB when it is full. I >> >> > want to change this to around 10 MB (or even more) to avoid file >> >> > fragmentation. >> >> > >> >> > Any ideas? >> >> > >> >> > Thanks >> >> > _______________________________________________ >> >> > 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 > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users