[wp-trac] [WordPress Trac] #29178: Using WP_Query only for result of SQL_CALC_FOUND_ROWS

WordPress Trac noreply at wordpress.org
Mon Aug 11 15:56:33 UTC 2014


#29178: Using WP_Query only for result of SQL_CALC_FOUND_ROWS
-----------------------------+------------------------------------------
 Reporter:  danielbachhuber  |      Owner:
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Future Release
Component:  Query            |    Version:
 Severity:  normal           |   Keywords:  needs-patch needs-unit-tests
  Focuses:                   |
-----------------------------+------------------------------------------
 For certain web hosts who reject direct SQL queries and push for use of
 `WP_Query` everywhere, it would be nice if you could use `WP_Query` only
 for the result of `SQL_CALC_FOUND_ROWS`

 My use case is that I'm added limited faceting support to a search
 interface. For each facet, I'd like to indicate the number of matching
 results. Using `update_post_meta_cache => false` and
 `update_post_term_cache => false` means using `WP_Query` still produces
 two queries.

 Also, it would be interesting to compare the performance of
 `SQL_CALC_FOUND_ROWS` vs `COUNT(*)` when all you care about is the total
 count.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29178>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list