[wp-trac] [WordPress Trac] #47280: SQL_CALC_FOUND_ROWS is deprecated as of MySQL 8.0.17

WordPress Trac noreply at wordpress.org
Sun Aug 14 01:31:49 UTC 2022


#47280: SQL_CALC_FOUND_ROWS is deprecated as of MySQL 8.0.17
--------------------------------------------+-----------------------------
 Reporter:  javorszky                       |       Owner:  johnbillion
     Type:  enhancement                     |      Status:  reviewing
 Priority:  normal                          |   Milestone:  Future Release
Component:  Database                        |     Version:
 Severity:  normal                          |  Resolution:
 Keywords:  has-patch has-unit-tests early  |     Focuses:  performance
--------------------------------------------+-----------------------------

Comment (by johnbillion):

 @akramipro I've pushed some more commits to [https://github.com/WordPress
 /wordpress-develop/pull/2119 the pull request] which accounts for the
 `GROUP BY` clause using a field name or names other than `wp_posts.ID`.
 Thanks.

 @rjasdfiii The point that @akramipro was trying to make is that if the
 original query contains a `GROUP BY` clause then the subsequent
 `COUNT(...)` query needs to contain a `DISTINCT` clause in order to
 account for rows that were grouped in the main query. This can be seen
 when performing a meta query with the `relation` field set to `OR` and a
 result set that contains posts that match both the meta clauses. Without
 the `COUNT(DISTINCT ...)` clause the count will not be correct.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47280#comment:48>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list