Re: Copy performance issues

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: s anwar <sanwar(at)gmail(dot)com>
Cc: pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Copy performance issues
Date: 2010-08-18 22:49:50
Message-ID: 4C6C638E.9090204@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

s anwar wrote:
> 3. 8T RAID5 partition for database on a Dell PERC 5/E controller
> (I understand that I'll never get fast inserts/updates on it based on
> http://wiki.postgresql.org/wiki/SlowQueryQuestions but cannot change
> to a RAID0+1 for now).
> Database's filesystem is ext4 on LVM on RAID5.

And LVM slows things down too, so you're stuck with basically the worst
possible layout here. Have you checked that your PERC is setup with a
write-back cache? If not, that will kill performance. You need to have
a battery for the controller for that to work right. This is the first
thing I'd check on your system. With ext4, on this controller you might
need to use the "nobarrier" write option when mounting the filesystem to
get good performance too. Should be safe if you have a battery on the
controller.

> shared_buffers = 10GB
> checkpoint_segments = 40

I've gotten some reports that the fall-off where shared_buffers stops
helping is lower than this on Linux. I'd suggest at most 8GB, and you
might even try something like 4GB just to see if that turns out to be
better.

With what you're doing, you could likely increase checkpoint_segments
quite a bit from here too. I'd try something >100 and see if that helps.

> enable_seqscan = off

That's going to cause you serious trouble one day if you leave it like
this in production, on a table where index scans are much more expensive
than sequential ones for what you're doing.

One thing that can help large COPYies a lot is to increase Linux
read-ahead. Something like:

/sbin/blockdev --setra 4096 /dev/sda

Done for each physical drive the system sees will help large sequential
reads of files the way COPY does significantly. The default is probably
256 on your system given the LVM setup, possibly even smaller.

Beyond that, you may just need to investigate clever ways to reduce the
indexing requirements.

--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg(at)2ndQuadrant(dot)com www.2ndQuadrant.us

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message s anwar 2010-08-18 22:59:52 Re: Copy performance issues
Previous Message Tom Lane 2010-08-18 22:42:14 Re: Copy performance issues