Re: Any way to speed up INSERT INTO

From: aditya desai <admad123(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Any way to speed up INSERT INTO
Date: 2022-03-09 06:09:55
Message-ID: CAN0SRDEew4pFJtZT3yM=HJN5PwKmPNEbL1wt3kod2OfJuOESag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Ok Will check. But from pgadmin it takes 1min and by psql it is taking 20
mins for 100,000 rows with BEGIN; COMMIT;

Thanks,
Aditya.

On Tue, Mar 8, 2022 at 8:23 PM Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> 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(at)momjian(dot)us> https://momjian.us
> EDB https://enterprisedb.com
>
> If only the physical world exists, free will is an illusion.
>
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jayadevan M 2022-03-10 05:10:17 Explain analyse with track_io_timing
Previous Message Bruce Momjian 2022-03-08 14:53:49 Re: Any way to speed up INSERT INTO