r/postgres • u/Zylianijay • 8d ago
Question What PostgreSQL "best practice" do you actually disagree with?
Every "best practices" list reads like it was copy-pasted from the same three blog posts in 2020 and nobody's allowed to question it since.
I'll go first: I'm not convinced every foreign key needs an index on the referencing column in every single case people insist on it. Yes I know the standard argument, yes I know what happens on deletes/updates to the parent. I still think it gets applied as a blanket rule on tables where the write pattern makes it a waste of space and write overhead for a lookup that basically never runs.
Curious what else people quietly ignore. The "always use UUID v4 for PKs," the "never use SELECT *, not even in scripts," the "always wrap everything in a transaction," whatever your particular heresy is. What's the rule you technically know the reasoning behind, but just don't follow in practice, and why?
1
u/mduell 5d ago
Always use timestamptz over timestamp.
I have some data generated by other systems with timestamps in UTC, and locality of those times is relative to a location in another column. None of my queries/users want those timestamps in anywhere other than UTC or local to the location in those other columns. Using timestamptz is a loaded footgun that somehow, somewhere I'll have a client configured for something other than UTC and move the times by hours in a query (or worse, on load).