From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Tom Burke" <lists(at)spamex(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Updates are slow.. |
Date: | 2002-06-11 19:22:57 |
Message-ID: | 3459.1023823377@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Tom Burke" <lists(at)spamex(dot)com> writes:
> For the purposes of our performance test, we created a PostgreSQL
> database with only a single table of about 1.2 million records. Updating
> an indexed column for 600K records on that table is unusually slow. It
> takes anywhere from forty minutes to over an hour.
That seems way way off. I tried to replicate your situation on an RH
7.2 box, using PG 7.1 (I don't have 7.2 installed there at the moment,
and current devel sources might be an unfair comparison). I got a time
more like forty seconds:
test71=# create table emp (emp_id serial, dept_id int, emp_status int);
test71=# create index emp2 on emp(DEPT_ID, EMP_STATUS);
[ fill with random data ]
[tgl(at)rh1 tgl]$ time psql test71 -c "UPDATE Emp SET Dept_ID = 5 WHERE Dept_ID =
4;"
UPDATE 593216
real 0m41.290s
user 0m0.000s
sys 0m0.000s
[tgl(at)rh1 tgl]$
Now this machine has a faster CPU than yours (1.8GHz I think), but
probably not any faster disk. At best it could be twice as fast as
yours. I don't have as many columns either, so the I/O volume is
probably a good bit more in your case. But even allowing for that,
it's hard to extrapolate to an hour.
What are the datatypes of your columns, exactly? What's the average
tuple size (actually, showing the VACUUM VERBOSE stats for the table
would be the most useful answer)? Are you *sure* there are no foreign
keys either from or to this table? Also, what plan is shown by EXPLAIN
for the query? (7.2 should surely not be dumb enough to pick an
indexscan plan, but if it did that would explain a lot ...)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Roberto Nanamura | 2002-06-11 19:23:08 | Re: Poor performance in Porting Oracle based application to |
Previous Message | Jorge Sarmiento | 2002-06-11 19:16:30 | pl/pgsql manuals and examples. |