can this simple SQL query be optimized?

Posted by ibiza on Stack Overflow See other posts from Stack Overflow or by ibiza
Published on 2010-05-12T13:15:18Z Indexed on 2010/05/12 13:24 UTC
Read the original article Hit count: 224

Filed under:
|

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!

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server