let's say I've got two queries:
select top 20 idField, field1, field2 from table1
where idField in
(
select idField from table1 where field3 like '...'
union
select idField from table2 where field4 like '...'
)
order by sortfield1
select top 20 idField, field1, field2 from table1
where field3 like '...'
or idfield in
(select idField from table2 where field4 like '...')
order by sortfield1
let's say that both tables are rather large (table2 larger than table1), average range of results number is 0-400, but I always want max 20 results.
Is it possible to say with big probability which statement would be more performant and/or what would the choice of statement depend on? Thank you