Hello.

Several months ago I ported the "free pages" code from sqlite v2 to v3. I found the original at [1]. My copy is at [2]. I unsuccessfully tried to contact the original author.

This code simply computes the amount of "slack space" in the database. Our database will sometimes grow quite large and then most of the rows will be deleted. We want to reclaim the space, but due to the way our application works, it is not efficient to vacuum the database right after we delete the rows in question. So, we periodically call the "free space" routine and vacuum our database if the amount of slack space exceeds a certain threshold. Good, bad or ugly, that is what we do :)

I would like to see this code ultimately merged into the official sqlite database distribution (so that we are not distributing a "hacked" version). However, I am not an sqlite genius. I would very much appreciate some peer-review. (For example, I removed all of the database integrity checks b/c the v2 code failed on a v3 system. I also had to copy many struct definitions from other files as these structures were not exposed via header files. These hacks seem ugly to me but I'm not sure what to do about it).

I grant my code to the community. I can be licensed under the current sqlite license. Your comments are appreciated. Thank you.


[1] http://web.utk.edu/~jplyon/sqlite/code/freepages.c

[2] http://unwg.no-ip.com/freepages.c

Reply via email to