I have an inner join like so:
INNER JOIN Area AS area ON (Area.Id = psaLocalityOrCity.AreaId OR Area.Id = psaDbl.AreaId)
psaLocalityOrCity are locations that I need areas for, however there are some records that are duplicated in psaLocalityOrCity. These, and only these, have been extracted into psaDbl as single records. INNER JOIN above is suppose to find me all areas for all localities in both groups, but this OR statement is causing it to run for ages. What would be a reason for that? Is there any fix that would optimize the query to run for 6sec again instead of 3min?