How to properly index a many-many association table?

后端 未结 2 776
温柔的废话
温柔的废话 2021-02-01 04:25

In a typical many-many arrangement like this...

Movies       Actors       Movies_Actors
------       ------       -------------
movie_ID     actor_ID     FK_movie_ID
         


        
2条回答
  •  不知归路
    2021-02-01 05:23

    In SQL Server, a composite index can be used for a single field search for the first column only. That means you should have an additional, one field index on FK_actor_id if there will be searches on that field without FK_Movie_id in the same query.

提交回复
热议问题