Skip to:
Content

BuddyPress.org

Opened 3 years ago

Last modified 3 years ago

#7332 new enhancement

Use `WHERE 1=1` instead of eliminating `WHERE` clause

Reported by: boonebgorges Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version:
Component: Core Keywords: needs-patch good-first-bug
Cc:

Description

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).

Attachments (2)

7332.01.patch (1.2 KB) - added by slaFFik 3 years ago.
7332.02.patch (1.1 KB) - added by slaFFik 3 years ago.
Activity

Download all attachments as: .zip

Change History (5)

#1 @slaFFik
3 years ago

  • Milestone changed from Future Release to 2.8

#2 @slaffik
3 years ago

In 11376:

BP_User_Query: add 1=1 to WHERE clause.

See the discussion in #7290. It would make our query SQL clauses easier to debug and modify if they always contained a WHERE clause.

See #7332.

@slaFFik
3 years ago

@slaFFik
3 years ago

Activity

#3 @DJPaul
3 years ago

  • Milestone changed from 2.8 to Future Release
Note: See TracTickets for help on using tickets.