Postgresql – Postgres partition tables 1 million rows

postgresql

I have a 1 million rows in one of my table and expect it grow to 3-4M in next 1 or 2 years.

There is lot of averages and sum are run on the date column for this row.

I'm planning to partition the tables to make the query run faster..

Questions:

  1. Is it ok to partition table that just has 1 million rows.
  2. I have 10 columns in the table but there are 2 columns that are text which stores around 2000 bytes of data.
  3. How many rows Postgres can handle without partitions.

Best Answer

Your database is small and doesn't require partitioning.

A quick guesstimate gives storage requirements: two 2,000 byte columns times 1M rows is 4GB; times 3-4M rows is 12-16GB. A proper calculation would include a fudge factor for the other columns, indices, and other overheads, but it's still obviously an amount that fits in RAM on anything but the most crusty of servers.

So to answer your questions:

  1. You can partition a 1M row table, but it's not worth the effort with PostgreSQL. (PostgreSQL is not MySQL.)
  2. This is not a question!
  3. PostgreSQL's "about" page states there is no limit on the number of rows, but a table cannot exceed 32TB.