Re: Running update in chunks?
Richard Huxton <dev@archonet.com>
From: Richard Huxton <dev@archonet.com>
To: Tim Uckun <timuckun@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Date: 2013-01-21T09:30:59Z
Lists: pgsql-general
On 21/01/13 08:04, Tim Uckun wrote: > This is the query I am running > > update cars.imports i > set make_id = md.make_id > from cars.models md where i.model_id = md.id; > > > Here is the analyse Looks like it's the actual update that's taking all the time. > This query takes fifty seconds on a macbook air with i7 processor and > eight gigs of RAM and SSD hard drive. I am using postgres 9.2 > installed with homebrew using the standard conf file. Can you try a couple of things just to check timings. Probably worth EXPLAIN ANALYSE. SELECT count(*) FROM cars.imports i JOIN cars.models md ON i.model_id = md.id; CREATE TEMP TABLE tt AS SELECT i.* FROM cars.imports i JOIN cars.models md ON i.model_id = md.id; Now the first one should take half a second judging by your previous explain. If the second one takes 50 seconds too then that's just the limit of your SSD's write. If it's much faster then something else is happening. -- Richard Huxton Archonet Ltd