Re: Querying a time range across multiple partitions

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Querying a time range across multiple partitions
Date: 2014-09-07 19:55:24
Message-ID: CAMkU=1z3dF_UrwZWaweWiRayaCEJwxehQS=q1pHOGH-JvBgG4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Sep 5, 2014 at 2:17 PM, John R Pierce <pierce(at)hogranch(dot)com> wrote:

> On 9/5/2014 10:31 AM, Cal Heldenbrand wrote:
>
> Number of child tables: 1581
>
>
> that's an insane number of children. We try and limit it to 50 or so
> child tables, for instance, 6 months retention by week, of data will
> millions of rows/day.
>

I've used more than that many for testing purposes, and there was little
problem. The main thing is that your insert trigger (if you have one on
the master table) needs to be structured as a binary search-like nesting of
if..elsif, not a linear-searching like structure. Unless of course almost
all inserts go into the newest partition, then it might make more sense to
do the linear search with that being the first test. But for performance,
better to just insert directly into the correct child table.

I dont' know if that many tables is a good idea in this case, but it is not
prima facie insane.

Cheers,

Jeff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2014-09-07 20:20:36 Re: Querying a time range across multiple partitions
Previous Message Jeff Janes 2014-09-07 19:44:08 Re: Querying a time range across multiple partitions