Link to home
Create AccountLog in
Avatar of CipherIS
CipherISFlag for United States of America

asked on

SQL Server Primary Keys

I have a database table architecture question.  Is it better to design a primary key with the standard pk_id where it is an "int" or a guid?
SOLUTION
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Hi,
Int is OK, and you can also declare it as an identity, like
CREATE TABLE new_employees
(
 id_num int IDENTITY(1,1),
 fname varchar (20),
 minit char(1),
 lname varchar(30)
)

Open in new window

Avatar of Vitor Montalvão
First thing that you should ask is: "Do I really need a GUID?"
As Expert says the GUID uses more resource to store the data.

 it took little more time to read the that column data, if you have large numbers of rows.

 If you declare it as the Primary column it will create the index on it and if you select Int as a type , Indexes will be more faster and efficient.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of CipherIS

ASKER

Thank You.