[buddypress-trac] [BuddyPress Trac] #7332: Use `WHERE 1=1` instead of eliminating `WHERE` clause

buddypress-trac noreply at wordpress.org
Mon Nov 7 03:13:15 UTC 2016


#7332: Use `WHERE 1=1` instead of eliminating `WHERE` clause
--------------------------+----------------------------------------
 Reporter:  boonebgorges  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Future Release
Component:  Core          |    Version:
 Severity:  normal        |   Keywords:  needs-patch good-first-bug
--------------------------+----------------------------------------
 Following some discussion with @ninjew in #7290: It would make our query
 SQL clauses easier to debug and modify if they always contained a `WHERE`
 clause. So the minimal query would be, eg, `SELECT * FROM wp_bp_groups
 WHERE 1=1` instead of `SELECT * FROM wp_bp_groups`.

 A bit of research suggests that any performance issues should be
 negligible - it adds a very small amount of overhead to the query planning
 stage, and is totally ignored during query execution.

 For reference, `WP_Query` does something similar (though other WP query
 classes do not).

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


More information about the buddypress-trac mailing list