Hi there,
What's a common/best practice for database design when it comes to improving performance on count(1) queries? (Im currently using SQLite)
I've normalized my data, it exists on multiple tables, and for simple things I want to do on a single table with a good index -- queries are acceptably quick for my purposes.
eg:
SELECT count(1) from actions where type='3' and area='5' and employee='2533';
But when i start getting into multiple table queries, things get too slow (> 1 second).
SELECT count(1) from(SELECT SID from actions where type='3' and employee='2533' INTERSECT SELECT SID from transactions where currency='USD')
How should I cache my results? What is a good design? My natural reaction is to add a table solely for storing rows of cached results per employee?
Thanks!