[wp-trac] [WordPress Trac] #29552: Slight tweak to no_found_rows logic in WP_Query
WordPress Trac
noreply at wordpress.org
Sat Sep 6 03:53:32 UTC 2014
#29552: Slight tweak to no_found_rows logic in WP_Query
-------------------------+-----------------------------
Reporter: dmchale | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: trunk
Severity: normal | Keywords:
Focuses: performance |
-------------------------+-----------------------------
It seems that edge cases could introduce times when a query WOULD have
limits but NOT want them (when the query was passed nopaging=true or
post_per_page=-1). When this happened, SQL_CALC_FOUND_ROWS would be
invoked in the query and hinder performance of the query.
Code change still allows for a developer to override no_found_rows with
their own value, but now checks the nopaging and post_per_page variables
to possibly set no_found_rows to true anyway. By using one of those 2
variables to ask for EVERYTHING, we know the developer does not want/need
pagination. This forces the issue so that by the time we get to the
line...
if ( !$q['no_found_rows'] && !empty($limits) )
...we don't find ourselves WITH limits, and a False value for
no_found_rows, in spite of the fact that the developer had asked for
"all".
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29552>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list