[wp-trac] [WordPress Trac] #41278: SQL_CALC_FOUND_ROWS slow query

WordPress Trac noreply at wordpress.org
Wed Jul 19 15:29:56 UTC 2017


#41278: SQL_CALC_FOUND_ROWS slow query
--------------------------+------------------------------
 Reporter:  lubimow       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Database      |     Version:  4.8
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by MaximeCulea):

 @lubimow,

 `SQL_CALC_FOUND_ROWS` is used in most queries in order to implement
 pagination, even when you don’t need pagination at all. It tells to MySQL
 to do additional work for counting the total matching rows.

 Inside `\WP_Query` and `get_posts()` it is done with the arg
 `no_found_rows => false`. So if you set it to `true`, it will improve your
 query speed.

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


More information about the wp-trac mailing list