1. Primary keys should be as small as necessary. Prefer a numeric type because numeric types are stored in a much more compact format than character formats. This is because most primary keys will be foreign keys in another table as well as used in multiple indexes. The smaller your key, the smaller the index, the less pages in the cache you will use.
When dealing with "small" databases this stuff doesn't matter so much. But when you deal with large db's all of the little things matter. Just imagine if you have 1 billion rows with int or long pk's compared to using text or guid's. There's a huge difference!
Reference:
1 .http://stackoverflow.com/questions/337503/whats-the-best-practice-for-primary-keys-in-tables
Subscribe to:
Post Comments (Atom)
Devops links
Build Versioning in Azure DevOps Pipelines
-
Build Versioning in Azure DevOps Pipelines
-
Don't use FirstorDefault() unless you are sure its valid/ verified in the business scenario. else you are going to introduce bugs in t...
-
Generate Dates and hour between Date Range DECLARE @start DateTime = getdate() -1, @end DateTime = getdate(); ; WITH Dates_CTE ...
No comments:
Post a Comment