Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

What is the extra load time when COUNTing number of questions vs. using the cached value?

+2 votes
asked Oct 27, 2013 in Q2A Core by q2apro

I could count all questions with:

SELECT COUNT(*) FROM qa_posts WHERE type="Q"

or I could use the written value from the database (cached):



What is the speed difference? Is it really that immense?

1 Answer

0 votes
answered Jul 20, 2015 by steven2
Although the field 'type' is indexed, it is still a db query, and depending on the size of your posts table, it takes time.  You can use phpmyadmin to see exactly how much time it takes - noting that if you use this query multiple times, the results get cached in mysql.

What is the reason not use cache_qcount?