I have a SQLite database that contains several tables. We are writing a maintenance tool that removes "obsolete" data from a table until the size of this table is determined as a percentage of the total database file or less.
I know how to determine the size of a database file - I do this by doing
PRAGMA PAGE_SIZE;
and
PRAGMA PAGE_COUNT;
in two separate queries and multiplying these two to get the file size in bytes. Yes, I know that I can just take the file size in bytes, but this is similar to how I did it in other databases, and I want to stick with it, at least for now.
My problem is that I don't know how to get the TABLE size. There must be some way to do this. Can someone point me in the right direction?
source
share