Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.7k views
in Q2A Core by

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):

qa_opt('cache_qcount')

 

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

1 Answer

0 votes
by
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?
...