Re: R: R: Slow queries on very big (and partitioned) table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Job <Job(at)colliniconsulting(dot)it>, Jaime Soler <jaime(dot)soler(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: R: R: Slow queries on very big (and partitioned) table
Date: 2017-02-21 23:11:17
Message-ID: 16979.1487718677@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephen Frost <sfrost(at)snowman(dot)net> writes:
> * Job (Job(at)colliniconsulting(dot)it) wrote:
>> We thought to implement one partition for day.
>> Do you think it should be fine?

> Really depends on what you're doing. If you're running very short
> queries that pull out just a record or a few records, then you're going
> to be unhappy with the planning time required when you have hundreds and
> thousands of partitions, which is why I typically recommend against
> using partitions-by-day unless you're only keeping a few months worth of
> data.

Or to put it more simply: if you have more than O(100) partitions,
you're doing it wrong. There is a cost to subdividing things too finely.

The improved partitioning support that's going into v10 will probably
allow more partitions before it really starts to groan, but it'll still
not be a great idea to create more than the minimum number of partitions
you really need.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Patrick B 2017-02-21 23:41:34 Re: bloat indexes - opinion
Previous Message David G. Johnston 2017-02-21 23:05:38 Re: NOTIFY command impact