Skip site navigation (1) Skip section navigation (2)

Re: Slow Inserts on large tables

From: Iulian Dragan <iulian_dragan(at)yahoo(dot)com>
To: Peter Childs <peterachilds(at)gmail(dot)com>
Cc: Postgresql Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Slow Inserts on large tables
Date: 2008-10-03 10:09:37
Message-ID: (view raw or whole thread)
Lists: pgsql-performance

(please take this with a pinch of salt as I am no expert)

Here is  a possible scenario:
Each of your checkpoints takes 90 seconds or more (you told it  so with the checkpoint_completion_target). 
If your insert fills 3 checkpoint segments (48 megs ) in less than 90 seconds then a new checkpoint request is issued. And maybe a third one, and so on. I imagine that this can flood the disk cache with write requests at some point although I can't explain how.
Have a look at the log, see the interval between the checkpoint requests and try to make this (a lot) larger than the checkpoint duration.
Start by increasing your checkpoint_segments (to, say, 16). If this doesn't work, maybe the timeout is too short, or the 90 seconds target to generous.



--- On Fri, 10/3/08, Peter Childs <peterachilds(at)gmail(dot)com> wrote:
From: Peter Childs <peterachilds(at)gmail(dot)com>
Subject: Re: [PERFORM] Slow Inserts on large tables
Cc: "Postgresql Performance" <pgsql-performance(at)postgresql(dot)org>
Date: Friday, October 3, 2008, 9:47 AM

2008/10/3 Peter Eisentraut <peter_e(at)gmx(dot)net>:
> Peter Childs wrote:
>> I have a problem where by an insert on a "large" table will
>> take longer than usual.
>> I think the problem might have something to do with checkpoints,
> Then show us your checkpointing-related parameters.  Or try to set them to
> lot higher values so checkpoints happen more rarely and see if that makes
> difference.

More often or less often?

I've currently got them set to

checkpoint_segments = 3
checkpoint_timeout = 180s
checkpoint_completion_target = 0.5

after reading that doing more smaller checkpoints might make each
checkpoint work quicker and hence less of a performance hit when they
actually happen.



In response to

pgsql-performance by date

Next:From: Tom LaneDate: 2008-10-03 12:19:51
Subject: Re: Slow Inserts on large tables
Previous:From: Peter ChildsDate: 2008-10-03 08:47:38
Subject: Re: Slow Inserts on large tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group