3 ms·
Understanding the power of data types (PostgreSQL)
- insulanian 10y ago> Use bigserial or uuid for your primary key... If your table is small, the extra size doesn't matter. This is wrong! If a table is small it is probably used as a lookup reference (e.g. product_category, discount_group, etc...), in which case its PK is repeated over and over in child tables (e.g. product, order_item, etc...) and taking much more space than needed. As always, the rule is: "Know your data". Use the right data type and think about the use of every single column! Don't be lazy. Code is written once, but queries will run over and over and you'll be sorry.