Is there a difference if I do not define a primary key in a table

advertisements

I've been using SQL Server for quite a while, I always create database with design view.

The steps I took to create the table is:

  • Right Click Table -> New Table
  • I always have the first column as SOMETHING_ID (int) -> I make SOMETHING_ID as Identity with auto increment of 1
  • -> Then I add other columns
  • -> Save and use

As you can see, I didn't define SOMETHING_ID by right clicking it and SET AS PRIMARY.

Will there be any performance impact in this case?


Yes, it can impact performance because creating the primary key essentially makes an index for it. So when you join tables on that key it will improve performance greatly if there are indexes.... particularly if you have lots of data.