Обсуждение: bulk DMLs
Hi All,
Hope everyone is doing well.
I would like to know how we perform/handle the bulk provisioning i.e., insert/delete/updates in Postgresql.
I would like to know how we perform/handle the bulk provisioning i.e., insert/delete/updates in Postgresql.
Regards,
Nikhil
On Thu, Nov 16, 2023 at 7:04 AM Nikhil Ingale <niks.bgm@gmail.com> wrote:
Hi All,Hope everyone is doing well.
I would like to know how we perform/handle the bulk provisioning i.e., insert/delete/updates in Postgresql.
Bulk loading via the COPY command is very efficient.
Bulk deletes can be tricky. I'd use a CTE SELECT with LIMIT clause that fetches the PK in chunks.
On Thu, Nov 16, 2023 at 8:21 AM Ron Johnson <ronljohnsonjr@gmail.com> wrote: > > On Thu, Nov 16, 2023 at 7:04 AM Nikhil Ingale <niks.bgm@gmail.com> wrote: >> >> Hi All, >> Hope everyone is doing well. >> I would like to know how we perform/handle the bulk provisioning i.e., insert/delete/updates in Postgresql. >> > > Bulk loading via the COPY command is very efficient. > Bulk deletes can be tricky. I'd use a CTE SELECT with LIMIT clause that fetches the PK in chunks. TRUNCATE command is fast alternative to DELETE when you're sure you want to delete all rows of a table. Please read the full docs of the TRUNCATE command to make sure you understand the tradeoff, though. https://www.postgresql.org/docs/current/sql-truncate.html Best regards, Gurjeet http://Gurje.et