From: Bruce Momjian <bruce@momjian.us>
To: aditya desai <admad123@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pgsql Performance <pgsql-performance@lists.postgresql.org>
Subject: Re: Any way to speed up INSERT INTO
Date: Tue, 8 Mar 2022 09:53:49 -0500
Message-ID: <Yidt/abMPVcTOUnX@momjian.us> (raw)
In-Reply-To: <CAN0SRDF+zmPg54v_0JSjUxoCE7toXAPJ77AVgGg-9SKBP2Xbww@mail.gmail.com>
References: <CAN0SRDHkd=3j7_xu2G_mg0ku0uwdN+DDGxEn8gzO=9hb=UFtcw@mail.gmail.com>
<3967140.1646419359@sss.pgh.pa.us>
<CAN0SRDF+zmPg54v_0JSjUxoCE7toXAPJ77AVgGg-9SKBP2Xbww@mail.gmail.com>
On Tue, Mar 8, 2022 at 06:36:17PM +0530, aditya desai wrote:
> Hi Tom,
> I added BEGIN and COMMIT as shown below around insert and executed it from
> pgadmin for 100,000 rows. It ran in just 1 min.
>
> BEGIN;
> INSERT INTO TABLE VALUES(....);
> INSERT INTO TABLE VALUES(....);
> .
> ,
> COMMIT;
>
> However when I run above from psql by passing it to psql(As shown below) as a
> file. It still takes a lot of time. Am I doing anything wrong? How can I run
> this from pgadmin within a minute?
>
> psql -h host -U user -p Port -d database < INSERT_FILE.sql
>
> PSQL is still printing as below.
> INSERT 0 1
> INSERT 0 1
Uh, they should be the same. You can turn on log_statement=all on the
server and look at what queries are being issued in each case.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
If only the physical world exists, free will is an illusion.
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: bruce@momjian.us, admad123@gmail.com, tgl@sss.pgh.pa.us, pgsql-performance@lists.postgresql.org
Subject: Re: Any way to speed up INSERT INTO
In-Reply-To: <Yidt/abMPVcTOUnX@momjian.us>
* 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