can this simple SQL query be optimized?
- by ibiza
Hi,
I have the following query :
SELECT COUNT(*) FROM Address adr INNER JOIN Auditable a on adr.UniqueId = a.UniqueId
on a big DB (1.3M adresses, 4M+ auditables)
both UniqueId columns are clustered primary keys
the query is taking quite long to complete...I feel dumb, but is there any way to optimize it? I want to count all the address entries that have an underlying auditable...
thanks!