how to Improve query performance?

  • hello :

    the follow query, there are More than 5 million records in table t1,

    so I want to improve performance,Whether there are good suggestions?

    SELECT COUNT(*) FROM t1 a

    Inner Join t2 b

    on a.id = b.tid

    go

  • just try with b.id = a.id

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • What does the execution plan look like? Where do you have indexes on the table? How selective is the data you're using for your filtering? Answering these questions will tell you what's going on and will help determine how to improve performance. Just looking at the query, with no other information, it's just not possible to tell you ways to improve performance.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Only way you're likely to improve that is with indexes. The query is simple enough that there are no changes that you can make there that will improve the performance

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply