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

buddypress-trac noreply at wordpress.org
Fri Jun 24 04:53:34 UTC 2016


#4041: Use SELECT FOUND_ROWS() for 'total' queries instead of a second query
--------------------------+-----------------------------
 Reporter:  boonebgorges  |       Owner:
     Type:  enhancement   |      Status:  assigned
 Priority:  normal        |   Milestone:  Future Release
Component:  Performance   |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+-----------------------------
Changes (by r-a-y):

 * type:  defect (bug) => enhancement
 * component:  Core => Performance


Comment:

 > The second one is unnecessary; we should be using SELECT FOUND_ROWS()
 instead, to avoid a second, potentially costly, query.

 WP already does a count of sorts with `$wpdb->num_rows` for the last
 query:
 https://codex.wordpress.org/Class_Reference/wpdb#Class_Variables

 If this works, this sounds like a good performance enhancement!

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


More information about the buddypress-trac mailing list