Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

INT vs VARCHAR datatype for primary keys

Which out of the INTEGER and VARCHAR datatypes is better for use as primary keys and why? I am used to making my primary keys INTEGER, will using VARCAHRs have a performance penalty?

like image 238
rjmcb Avatar asked Feb 09 '12 06:02

rjmcb


1 Answers

INT is faster for clustor index and if we want to join with other table.

You will get idea if you have understanding of Clustor Index and JOIN

like image 85
Sanjay Goswami Avatar answered Sep 20 '22 05:09

Sanjay Goswami