[buddypress-trac] [BuddyPress] #4041: Use SELECT FOUND_ROWS() for 'total' queries instead of a second query

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Thu Feb 23 11:48:21 UTC 2012


#4041: Use SELECT FOUND_ROWS() for 'total' queries instead of a second query
--------------------------+-----------------
 Reporter:  boonebgorges  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  1.6
Component:  Core          |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------
 Throughout BP, we do two queries for content loops: one that is paginated
 (LIMIT) and one that does COUNT(*) for a total count. The second one is
 unnecessary; we should be using SELECT FOUND_ROWS() instead, to avoid a
 second, potentially costly, query.

 Note that this will cause backpat problems in the case of filters on
 _total_ queries. I recommend the following course of action:
 - Remove the _total_ filters altogether
 - Mark the _paged_ filters as deprecated (in the inline docs)
 - Add new filters that make no reference to _paged_ or _total_ since it
 will no longer be relevant.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4041>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list