From: Richard Huxton <dev@archonet.com>
To: Ivar Zarans <iff@alcaron.ee>
To: pgsql-performance@postgresql.org
Subject: Re: Slow UPADTE, compared to INSERT
Date: Thu, 4 Dec 2003 20:23:36 +0000
Message-ID: <200312042023.37050.dev@archonet.com> (raw)
In-Reply-To: <20031204195121.GA16497@alcaron.ee>
References: <20031204185751.GA15893@alcaron.ee>
<20031204142320.3c021100.threshar@torgo.978.org>
<20031204195121.GA16497@alcaron.ee>
On Thursday 04 December 2003 19:51, Ivar Zarans wrote:
>
> My second tests were done with temporary table and update query as:
> "UPDATE table1 SET Status = 'done' WHERE recid IN (SELECT recid FROM
> temptable)". It is still slower than INSERT, but more or less
> acceptable. Compared to my first tests overall processing time dropped
> from 1 hour and 20 minutes to 16 minutes.
Ah - it's probably not the update but the IN. You can rewrite it using PG's
non-standard FROM:
UPDATE t1 SET status='done' FROM t_tmp WHERE t1.rec_id = t_tmp.rec_id;
Now that doesn't explain why the update is taking so long. One fifth of a
second is extremely slow. Are you certain that the index is being used?
--
Richard Huxton
Archonet Ltd
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: dev@archonet.com, iff@alcaron.ee
Subject: Re: Slow UPADTE, compared to INSERT
In-Reply-To: <200312042023.37050.dev@archonet.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