Skip to content
Advertisement

When should I split my table for faster lookup?

I have a Postgres table with 500k rows that are only read (a lot, by multiple users). I was wondering if splitting the database in two by, let’s say “date of birth” of the rows, would be more efficient.

I have half of the table that will be queried a lot more (birthdate>40). So splitting it by birthdate would allow me to directly check into a smaller subset (by simply checking if my element is >40). Is this method improving anything?

Advertisement

Answer

An index solves your problem. Spliting a table by storing different sections of it only complicates things.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement