pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
\COPY command and indexes in tables
4+ messages / 4 participants
[nested] [flat]

* \COPY command and indexes in tables
@ 2020-11-19 07:38  Matthias Apitz <guru@unixarea.de>
  0 siblings, 2 replies; 4+ messages in thread

From: Matthias Apitz @ 2020-11-19 07:38 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org


Hello,

We load large tables in some customer installation (some millions of rows)
from file with:

    TRUNCATE TABLE tableName ;
    \COPY tableName FROM 'fileName' WITH ( DELIMITER '|' )

and got to know that the loading nearly stops (without any real CPU
consumption) in the middle. The wild guess is that we forgot to DROP the indexes on
the tables. The doc https://www.postgresql.org/docs/13/sql-copy.html
does not give any hints related indexes.

There seems to be even tools available which address this issue on the
flight, like https://www.californiacivicdata.org/2018/01/25/index-drop-and-copy/

Any comments on this?

	matthias

-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
Без книги нет знания, без знания нет коммунизма (Влaдимир Ильич Ленин)
Without books no knowledge - without knowledge no communism (Vladimir Ilyich Lenin)
Sin libros no hay saber - sin saber no hay comunismo. (Vladimir Ilich Lenin)





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: \COPY command and indexes in tables
@ 2020-11-19 07:57  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Matthias Apitz <guru@unixarea.de>
  1 sibling, 0 replies; 4+ messages in thread

From: Laurenz Albe @ 2020-11-19 07:57 UTC (permalink / raw)
  To: Matthias Apitz <guru@unixarea.de>; pgsql-general@lists.postgresql.org

On Thu, 2020-11-19 at 08:38 +0100, Matthias Apitz wrote:
> We load large tables in some customer installation (some millions of rows)
> from file with:
> 
>     TRUNCATE TABLE tableName ;
>     \COPY tableName FROM 'fileName' WITH ( DELIMITER '|' )
> 
> and got to know that the loading nearly stops (without any real CPU
> consumption) in the middle. The wild guess is that we forgot to DROP the indexes on
> the tables.

If it does not consume CPU, it must be stalled somehow.

Are there any wait events in "pg_stat_activity".

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: \COPY command and indexes in tables
@ 2020-11-19 10:07  Jayadevan M <maymala.jayadevan@gmail.com>
  parent: Matthias Apitz <guru@unixarea.de>
  1 sibling, 1 reply; 4+ messages in thread

From: Jayadevan M @ 2020-11-19 10:07 UTC (permalink / raw)
  To: Matthias Apitz <guru@unixarea.de>; +Cc: pgsql-general@lists.postgresql.org

>
> We load large tables in some customer installation (some millions of rows)
> from file with:
>
>     TRUNCATE TABLE tableName ;
>     \COPY tableName FROM 'fileName' WITH ( DELIMITER '|' )
>
>
May be you could also make sure that loading actually stopped, by checking
the size of the data directory. In another session, you could try
watch du -h  -s <datadirectory>

Regards,
Jayadevan

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: \COPY command and indexes in tables
@ 2020-11-19 10:17  Paul Förster <paul.foerster@gmail.com>
  parent: Jayadevan M <maymala.jayadevan@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Paul Förster @ 2020-11-19 10:17 UTC (permalink / raw)
  To: Jayadevan M <maymala.jayadevan@gmail.com>; +Cc: Matthias Apitz <guru@unixarea.de>; pgsql-general@lists.postgresql.org

Hi Jayadevan,

> On 19. Nov, 2020, at 11:07, Jayadevan M <maymala.jayadevan@gmail.com> wrote:
> 
> May be you could also make sure that loading actually stopped, by checking the size of the data directory. In another session, you could try 
> watch du -h  -s <datadirectory>

that might be misleading if you have the pg_wal directory inside PGDATA.

Cheers,
Paul







^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2020-11-19 10:17 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 07:38 \COPY command and indexes in tables Matthias Apitz <guru@unixarea.de>
2020-11-19 07:57 ` Laurenz Albe <laurenz.albe@cybertec.at>
2020-11-19 10:07 ` Jayadevan M <maymala.jayadevan@gmail.com>
2020-11-19 10:17   ` Paul Förster <paul.foerster@gmail.com>

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