By far, Wordpress, Implements pagination by means of
SQL_CALC_ROWS_FOUND. But my benchmark have shown that this implementation is 1.1 Million % slower than my queries without it. So I am thinking of replacing it and implement a faster rows_counting method. The problem is, how do we integrate that in Wordpress?
Approach to Solution
I found a blog post that could be a solution. Its an old post however that same issue is still standing as it is today. The post benchmarks
Ordinary SQL + Count, and it was found out that ordinary query (without
sql_calc_rows_fount) to get your requests followed by
COUNT to determine the number of results was magnitude times faster than the existing implementation
We can disable, the
as indicated in this blog, so when Wordpress runs its usual queries we get the same results as usual, but without paginations! All results were there but no page numbers! Fast but partially useful, since pagination depends on the calculated results found, but we just disabled that calculations. We can get that by Implementing
SELECT Count, however, how do we pass the results to wordpress so it can do the Paginations?
Apache 2.4 (fpm), php7, mysql5.7, MyIsam, 8 Core Intel Xeon, 24Gb Ram, SSD.