Hi.
I have a query which when it's first run takes a long time, more than 60 sec. On subsequent runs its very fast (< 1 sec) since the tables are already in memory. However after some time the same problem happens.
The problem is the 2 tables i use are quite large, 30mb / >1100K rows and 50mb / > 140K rows, and i can't do anything about it. The queries are also optimized.
SELECT count(i.ProductNumber) FROM tbl2 as i, tbl1 as c WHERE i.ProductNumber = c.ProductNumber AND c.CategoryNumber = $cat
This is used to count the rows so that i can paginate.
SELECT ii.a, ii.b, ii.c, ii.d, ii.e FROM db2 as ii, db1 as cr WHERE (ii.e = cr.e) AND (cr.a = $cat) ORDER BY ii.a DESC, ii.b ASC LIMIT $offset, $results_per_page
This is used to get the results.
I can't use the same query because of the LIMIT in the 2nd query.
Any suggestions please?
Thanks,
John