Bug #6606 Add safe_join setting to prevent cartesian products
Submitted: 13 Nov 2004 14:50 Modified: 17 Jul 2008 22:17
Reporter: Arjen Lentz Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: General Severity:S4 (Feature request)
Version:6.0 OS:Any (any)
Assigned to: CPU Architecture:Any
Tags: cartesian product, join, safe_join

[13 Nov 2004 14:50] Arjen Lentz
- MySQL has for a long time had a safe_update setting (aka i-am-a-dummy) to prevent using UPDATE or DELETE without a key.
- MySQL 5.0 has a query_timeout setting.

New feature request:
A safe_joins setting, which would return an error if the server detects cartesian products.
This can't be found by the parser I suppose, but it should be detectable in/after the optimizer and before query execution.
The error could be "Table %s joined without a join condition"

This would be helpful to users.

How to repeat:
See description
[13 Nov 2004 20:27] Arjen Lentz
Hmm I misread something, 5.0 does not have a query_timeout.
I do believe there were some ideas for this though.
But anyway... the idea stands.
[9 Feb 2006 11:58] Valeriy Kravchuk
Thank you for a resonable feature request. But even with this feature in place, nobody will prevent users from joins on condition that is true for all rows in both tables. I think, some kind of resources profiles support, that limits disk and CPU usage will serve users better.
[17 Jul 2008 22:17] Arjen Lentz
Updated for 6.0 since it's obviously not going into an earlier version (since 2004...)
[31 Aug 2010 22:31] Bill Adams
I would like to vote for this feature as well. I have a vary large database that occasionally gets locked up because someone who is not SQL savvy writes a bad query that skips needed table joins.