Hello I have following table with around 100'000 rows / ~10MB on a embedded device:
CREATE TABLE 'fs_main' ( 'fs_recid' INTEGER PRIMARY KEY NOT NULL, 'fs_contenttype' INTEGER, 'fs_itemtype' INTEGER, 'fs_job' INTEGER, 'fs_textid' TEXT, <- ~5 chars per Record 'fs_flag1' INTEGER, 'fs_object' BLOB <- ~100 Bytes per Record ); Indexed by: CREATE INDEX 'index_fs_itemjobcontent' ON fs_main ( fs_itemtype ASC, fs_job ASC, fs_contenttype ASC, fs_recid ASC ); I need to count different result sets and i'm doing that this way: SELECT COUNT(fs_recid) AS num FROM fs_main WHERE ( fs_itemtype=18 ) AND fs_contenttype=2 AND fs_job=1 ...which takes around 4 sec. EXPLAIN QUERY PLAN tells me: TABLE fs_main WITH INDEX index_fs_itemjobcontent Why does it take so long? Is SQLite fetching the whole table even if COUNT() is applied on the primary key? Regards Daniel _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users