Skip to content

Comment on A Curated Guide to PostgreSQLparent

Comments

perhaps he meant a foreign key, not primary key.

postgresql doesn't automatically create indexes for foreign keys.

> Is there a fundamental difference to the default pkey index versus an explicitly created index?

i don't know of any in practice.

You're correct it was intended to be foreign keys, correctly updated now.

I believe the difference would be on the constraint. A primary key is intended to be unique, where as an index does not alway carry that constraint.

A primary key is the same thing as a unique index (any index which enforces unique entries) + a not null constraint.

It might make a difference in the heuristic for finding functional dependencies for group by though. This feature was introduced in 9.1 and allows one to not always have to list all columns in the GROUP BY clause.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.