FoundersOnly

Is one Postgres database really enough at 2,000 customers?

#1

Everything I read says "just use Postgres". I am at 2,100 accounts, about 40 GB, and one reporting query has started taking 9 seconds. Before I reach for a second database or a queue, tell me whether I am about to do something stupid.

#2

post the query plan. 40gb is small. logpond ran on one box until 600gb

#4Accepted solution
↳ Replying to Théo LaurentSequential scan on the events table, 31 million rows, filtering by account and a date range.

Then it is an index, not an architecture problem. A composite index on account and created date, in that order, and that query should come back in milliseconds. Build it concurrently so you do not lock writes.

If it is still slow afterwards, post the plan again. But I would be surprised.

#8

For what it is worth I host eleven small products on two machines and the answer to "do I need a second database" has been no every time for nine years. The answer to "do I need a tested backup" has been yes every time.

#10

One addition: turn on slow query logging with a 500 ms threshold now, while you have one slow query. It is much nicer to learn about the second one from a log than from a customer.

Your perspective belongs here.

Register to reply