Help Please - Does a table NEED to have a Primary Key?

All topics about programming / development in T-SQL or other languages for SQL Server.
Post Reply
Posts: 1
Joined: Wed Jun 26, 2019 5:04 pm

Wed Jun 26, 2019 5:06 pm

Do you need to create a Primary Key when creating a table? Will my queries perform terrible if I don't create one?
Posts: 14
Joined: Sat Jun 22, 2019 7:04 pm

Wed Jun 26, 2019 5:09 pm

Hi, this depends. Do you have any foreign keys on the table that you will be joining too? Will you be doing any joins on the Primary Key?
Posts: 29
Joined: Sat Jun 22, 2019 7:58 pm
Answers: 1

Wed Jun 26, 2019 5:14 pm

It is recommended that you create a Primary Key for your table.

(You are essentially creating a clustered index).

This will help to improve performance within the database for indexing and relationships between your tables.

Why don't you try your queries creating two tables (One with a PK and one Without) and see if this improves your performance?
Post Reply

Social Media