This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello - Is there anyway to specify to use a JOIN over an EXISTS for queries? The following code:
produces the following query:
When testing this against a lot of records performance is very inefficient... Writing my own SQL which produces the same result set using JOIN is significantly faster:
Would be great to specify to use JOIN over EXISTS... I know there is an option to use query object syntax FindBySql Thoughts? Thanks, Chris |
|
|
The query above was generated by an eager/lazy load of the association so you cannot influence the SQL which is generated here. If you wanted to generate a query like that you would need to structure a specific query to fetch those results which contains those explicit joins. e.g.
But practically this isnt going to help in this situation because it is an association load. Can you elaborate on the performance difference you are seeing between the two queries (what is the difference in query plan for these)? We have not seen this as being a problem provided you have appropriate indexes in place.
|
|