SQL - Filtering large tables with joins - best practices

前端 未结 3 844
不知归路
不知归路 2020-12-30 11:37

I have a table with a lot of data and I need to join it with some other large tables.

Only a small portion of my table is actually relevant for me each time.

3条回答
  •  悲&欢浪女
    2020-12-30 12:16

    You should put your query in the management studio, tick "include actual execution plan", and run it. That way you will get the exact answer what SQL server did with your query. From then, you can move forward with optimization.

    In general:

    • The columns used for join should be indexed
    • Use the most discriminating filter first

提交回复
热议问题