Search code examples
databasestringintegervarchar

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?


Solution

  • 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