Should i Putin a non clustered index over a clustered index table, based on this where clause and join?
Posted: Sun 24 Nov 2013 22:14
Hi
I have a parent table and a child table.
Parent table has a clustered index as primary key with increment value. ( ParentID )
Child table has also a clustered index as primary key with increment value. ( ChildID )
Primar key Parent.parentID is in relation with child.parentID as a foreign key.
I join those two tables based on following query.
Select ....
Join on parent.parentID = child.parentID where parent.personalNumber = 197608134356
Now, should i
1. add non clustered index on parent.personalNumber as its in the where clause?
2. Add a non clustered index on the foreign key child.parentiD to speed up the join?
It would mean i put non clustered index over à clustered index table.
I expect a lot of rows on both parent and child over time.
There Will be inserts and selects. No updates or deletes
Thanks
/s
I have a parent table and a child table.
Parent table has a clustered index as primary key with increment value. ( ParentID )
Child table has also a clustered index as primary key with increment value. ( ChildID )
Primar key Parent.parentID is in relation with child.parentID as a foreign key.
I join those two tables based on following query.
Select ....
Join on parent.parentID = child.parentID where parent.personalNumber = 197608134356
Now, should i
1. add non clustered index on parent.personalNumber as its in the where clause?
2. Add a non clustered index on the foreign key child.parentiD to speed up the join?
It would mean i put non clustered index over à clustered index table.
I expect a lot of rows on both parent and child over time.
There Will be inserts and selects. No updates or deletes
Thanks
/s