G
Guest
I'm struggling to make a complex query as fast as possible.
If I have nested queries does the nested query run in full before the query that reads it runs or does some optimization take place?. For example:
Lets say I have a table of 50,000 rows of which 100 records are 'open'.
I need to display the open rows but only where the user = 'XYZ'. To determine the user requires a join with another table.
Is it more efficient to have 2 queries where the first query selects just the open records and the second query does the join (thus the join only applying to 100 records), or is it more efficient to do it with one query.
If I have nested queries does the nested query run in full before the query that reads it runs or does some optimization take place?. For example:
Lets say I have a table of 50,000 rows of which 100 records are 'open'.
I need to display the open rows but only where the user = 'XYZ'. To determine the user requires a join with another table.
Is it more efficient to have 2 queries where the first query selects just the open records and the second query does the join (thus the join only applying to 100 records), or is it more efficient to do it with one query.