Re: Thousands of partitions performance questions

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Shai Cantor <shaicantor(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Thousands of partitions performance questions
Date: 2019-04-29 07:34:37
Message-ID: CAKJS1f_n7cZ0Jigejg6cog_DaPWUzTnbda+4_4LJt73WUq5GzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 29 Apr 2019 at 19:20, Shai Cantor <shaicantor(at)gmail(dot)com> wrote:
> Some notes I haven't shared or were not clear enough on the previous post.
>
> Data is inserted using the copy command only and in an offline manner. Meaning, no user action creates or updates the data. An offline job runs is. Number of inserts can reach up to 1500 a day.
> Queries are only on a single partition
>
> Can that ease the performance?

Yes, COPY will be more efficient. In PG11 it still means locking all
partitions but that becomes more worthwhile the more tuples that are
inserted at once. The same goes for INSERT with multiple rows in the
VALUES clause.

> Will querying directly the partition tables help?

Yes. If you're able to determine which partition to query from within
the application and write that in the query instead, then this will be
much less planner overhead for PG11. It'll be pretty much the same as
if you were querying a normal table.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2019-04-29 08:06:29 Re: Missing pg_config on SuSE SLES 12 for PostgreSQL 10
Previous Message Shai Cantor 2019-04-29 07:20:06 Re: Thousands of partitions performance questions