I have sqlite db on embedded ARM platform with Linux with limited resources. Storage device - microSD card. Sqlite version is 3.7.7.1. The application that accesses sqlite is written in C ++.
I want to know the number of rows in several tables evenly. I am currently using
select count(*) from TABLENAME;
to get this information. I'm having performance issues: when the table sizes reach a certain point (~ 200 thousand rows), I have many system and iowait loads every time I check the table sizes.
When I wrote this, I, although finding the number of rows in a table would be quick, since it is probably stored somewhere. But now I suspect that sqlite is actually looking at all the rows, and when I pass in the point where the data no longer fits in the disk cache, I get a lot of io-loading. This roughly corresponds to db size and available memory.
Can someone tell me if sqlite works as I suspect?
Is there a way to get the number of rows of a table without creating this amount of load?
EDIT : plaes asked a question about the location of the table:
CREATE TABLE %s (timestamp INTEGER PRIMARY KEY, offset INTEGER, value NUMERIC);
source share