seeking Indexing advise, SQL Server 2012 Express

I have ParentTable with 14,000 rows with PK on ID char(7) which already has clustered index.

The next table (ChildTable with 1,500,000 rows) has FK on ID char(7).

Question 1: Do I need to index this FK? This FK is not unique.

There is another field I will searching called Field1 also  not unique.

Question 2: Is the following lines of code correct to build these two indexes?

CREATE INDEX index_FK_ID_ChildTable ON ChildTable (ID);    
CREATE INDEX index_Field1_ChildTable ON ChildTable (Field1);  

Question 3:Once these indexes get build, are created automatically? How long it might take. Any other pitfalls are there I need to be aware of?
LVL 34
Mike EghtebasDatabase and Application DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HuaMin ChenProblem resolverCommented:
You can have index on non-unique, but be aware of not having index on column having many many repeating values.

The speed would be quick to build indices to the table.
0
Vitor MontalvãoMSSQL Senior EngineerCommented:
Question 1: Do I need to index this FK? This FK is not unique
Yes you need. It's always a best practice to index the FK's since they will be used in JOIN clauses. The part of being not unique is irrelevant.

Question 2: Is the following lines of code correct to build these two indexes?
Yes.

Question 3:Once these indexes get build, are created automatically? How long it might take. Any other pitfalls are there I need to be aware of?
They are build in the moment you press the execute button and the time depends only on the number of records that the table has. Be aware that this operation will create locks so execute it during maintenance hours. And since index gets fragmented you need to have reindex and rebuild tasks in your maintenance plan.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.