Lack of interest Finder::join() should permit a SqlJoin like Finder::where() permits an SqlExpression

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

Xon

Well-known member
Due to MySQL subquery handling, sometimes a subquery in the where clause causes significant performance issues compared the semantically identical join with a subquery.

Consider these two semantically equivalent queries;
SQL:
select *
from table
where id in (select id from table2)
vs
SQL:
select *
from table
join (select id from table2) a on a.id = table.id

Currently I'm exploiting that you can stick arbitrary SQL into Finder::$indexHints to implement this. The existing Finder::$joins can't be used due to the escaping around `$join[table]` which prevents an arbitrary SQL blob to be added.

In my particular case, converting from a subquery in the where clause to a join drops a complex query from 0.2 seconds to 0.07 seconds.
 
Upvote 1
This suggestion has been closed. Votes are no longer accepted.
Back
Top Bottom