From: Николай Кобзарев <n.kobzarev@aeronavigator.ru>
To: txtoth@gmail.com
Cc: pgsql-general@lists.postgresql.org
Subject: Re: dynamic partition table inserts
Date: Wed, 25 Jan 2023 19:49:13 +0300
Message-ID: <1674665353.958767179@f409.i.mail.ru> (raw)
In-Reply-To: <CAFPpqQFDAJy=E3N5zPQVrb7F0dLhwiLp7N=HKB9-1dFdRciRHQ@mail.gmail.com>
References: <CAFPpqQFDAJy=E3N5zPQVrb7F0dLhwiLp7N=HKB9-1dFdRciRHQ@mail.gmail.com>
Hi!
Please be warned that this approach (if not exists create) is not thread safe, even "create table if not exists" syntax is not thread safe too.
Im using this kind of "dynamic partitioning" and use Advisory locks to make sure creating partitions is thread safe. Im using native partitioning, so no special dynamic inserts/selects is required. Consider maintanance procedure, when you create all required partitions in advance.
>Среда, 25 января 2023, 16:38 +03:00 от Ted Toth <txtoth@gmail.com>:
>
>I'm creating partition tables on the fly following the technique described in https://minervadb.com/index.php/postgresql-dynamic-partitioning/ . Regardless of whether a partition table is created or already exists all I really want to do is change the destination table (TG_TABLE_NAME?) of the insert to the partition table. Is this possible or is my only option to generate a new insert as in the example?
>
>Ted
С уважением,
Николай Кобзарев
n.kobzarev@aeronavigator.ru
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: n.kobzarev@aeronavigator.ru, txtoth@gmail.com
Subject: Re: dynamic partition table inserts
In-Reply-To: <1674665353.958767179@f409.i.mail.ru>
References: <CAFPpqQFDAJy=E3N5zPQVrb7F0dLhwiLp7N=HKB9-1dFdRciRHQ@mail.gmail.com> <1674665353.958767179@f409.i.mail.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox