logoalt Hacker News

yasaheblasatoday at 7:26 PM1 replyview on HN

This is a topic that interests me a lot but there's a lot I find surprising since I finally started working with postgres dependent apps. Why for example is the id a good primary key? Joins are not uncommon, but I don't have anyone searching on id in my application and it is not even supposed to be user visible. I would think every possible user search would look at all partitions indexes if I did this instead of creation date.


Replies

jagged-chiseltoday at 8:13 PM

Your primary key is there to uniquely identify a record. You need additional indexes on fields you will search on.