I have a Login Table that has a Identity field “Id” as the Primary Key(clustered) , and other fields like email , password etc.The only time I will use this table is to authenticate the user.After that i will be always querying other tables like user_profile, user_comments etc which has a foreign key Login_id to the Login Table.
My question is, is it a good idea to make the Login_id in the user_profile and user_comments table , a clustered index ? I will not be doing any join with the Login table since after the user is successfully authenticated, i will keep the LoginId in FormsAuthentication.SetAuthCookie for future querying the child tables.
I am developing a web app using C# and .Net.
Thanks in advance !
Since you will be constantly using the Login_id to get data from user_profile and user_comments, and assuming these searching using login_id in those tables will be more often than any other columns like Id, in those tables, then “login_id” should be clustered indexed . Basically, you would want to use the clustered index on column that gets queried the most. It could be two columns like “first name” and last name. From MSDN