Re: Slow copy with little CPU/disk usage

From: Mischa Sandberg <mischa(dot)sandberg(at)telus(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow copy with little CPU/disk usage
Date: 2005-04-20 04:37:21
Message-ID: 1113971840.4265dc810374c@webmail.telus.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Quoting Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> "Jim C. Nasby" <decibel(at)decibel(dot)org> writes:
> > A friend of mine has an application where he's copying in 4000 rows at a
> > time into a table that has about 4M rows. Each row is 40-50 bytes. This
> > is taking 25 seconds on a dual PIII-1GHz with 1G of RAM and a 2 disk
> > SATA mirror, running FBSD 4.10-stable. There's one index on the table.
>
> If there's no hidden costs such as foreign key checks, that does seem
> pretty dang slow.
>
> > What's really odd is that neither the CPU or the disk are being
> > hammered. The box appears to be pretty idle; the postgresql proces is
> > using 4-5% CPU.
--
This sounds EXACTLY like my problem, if you make the box to a Xeon 2.4GHz, 2GB
RAM ... with two SCSI drives (xlog and base); loading 10K rows of about 200
bytes each; takes about 20 secs at the best, and much longer at the worst. By
any chance does your friend have several client machines/processes trying to
mass-load rows at the same time? Or at least some other processes updating
that table in a bulkish way? What I get is low diskio, low cpu, even low
context-switches ... and I'm betting he should take a look at pg_locks. For my
own problem, I gather that an exclusive lock is necessary while updating
indexes and heap, and the multiple processes doing the update can make that
pathological.

Anyway, have your friend check pg_locks.


"Dreams come true, not free." -- S.Sondheim, ITW

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Frost 2005-04-20 04:40:08 Re: Opteron vs Xeon (Was: What to do with 6 disks?)
Previous Message Greg Stark 2005-04-20 04:34:27 Re: Slow copy with little CPU/disk usage