Good morning, today I want to ask a question about performance (time) on what is more efficient, if you have a conventional id, type INT
, or have a column type UniqueIdentifier
.
With respect to the statement they are practically the same, the difference is that the UniqueIdentifier
does not apply IDENTITY
, if not a DEFAULT NEWID()
CREATE TABLE miTablaConvencional
(
id INT NOT NULL PRIMARY KEY IDENTITY(1,1),
campo VARCHAR(1)
)
CREATE TABLE miTablaUnique
(
id UNIQUEIDENTIFIER NOT NULL PRIMARY KEY DEFAULT NEWID(),
campo VARCHAR(1)
)
Which of the two tables would be more efficient, if you had to make queries by comparing your primary key fields and why.
Note: