pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: jay <jackem.mojx@alibaba-inc.com>
Cc: Heikki Linnakangas <heikki@enterprisedb.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] 答复: [PERFORM] Postgresql update op is very very slow
Date: Thu, 26 Jun 2008 10:02:31 -0600
Message-ID: <dcc563d10806260902o581ec3afud773867c1d0d2c69@mail.gmail.com> (raw)
In-Reply-To: <16213.1214492661@sss.pgh.pa.us>
References: <473587.97248.qm@web32701.mail.mud.yahoo.com>
	<op.uc83c7m2cigqcu@apollo13.peufeu.com>
	<004b01c8d671$3dec1630$0544000a@hz.ali.com>
	<486219B6.7050003@enterprisedb.com>
	<005101c8d773$ff81b2c0$0644000a@hz.ali.com>
	<16213.1214492661@sss.pgh.pa.us>

2008/6/26 Tom Lane <tgl@sss.pgh.pa.us>:
> "jay" <jackem.mojx@alibaba-inc.com> writes:
>>       I know the problem, because there are about 35 million rows , which
>> cost about 12G disk space and checkpoint segments use 64, but update
>> operation is in one transaction which lead fast fill up the checkpoint
>> segments and lead do checkpoints frequently, but checkpoints will cost lots
>> resources, so update operation become slowly and slowly and bgwrite won't
>> write because it's not commit yet.
>> Create a new table maybe a quick solution, but it's not appropriated in some
>> cases.
>>       If we can do commit very 1000 row per round, it may resolve the
>> problem.
>
> No, that's utterly unrelated.  Transaction boundaries have nothing to do
> with checkpoints.

True.  But if you update 10000 rows and vacuum you can keep the bloat
to something reasonable.

On another note, I haven't seen anyone suggest adding the appropriate
where clause to keep from updating rows that already match.  Cheap
compared to updating the whole table even if a large chunk aren't a
match.  i.e.

... set col=0 where col <>0;

That should  be the first thing you reach for in this situation, if it can help.



view thread (2+ messages)

Message-ID: <dcc563d10806260902o581ec3afud773867c1d0d2c69@mail.gmail.com>
Permalink:  ../dcc563d10806260902o581ec3afud773867c1d0d2c69@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10806260902o581ec3afud773867c1d0d2c69@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: scott.marlowe@gmail.com, tgl@sss.pgh.pa.us, jackem.mojx@alibaba-inc.com, heikki@enterprisedb.com
  Subject: Re: [PERFORM] 答复: [PERFORM] Postgresql update op is very very slow
  In-Reply-To: <dcc563d10806260902o581ec3afud773867c1d0d2c69@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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