Re: Another weird one with an UPDATE

From: David Griffiths <dgriffiths(at)boats(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Another weird one with an UPDATE
Date: 2003-10-13 01:33:54
Message-ID: 080d01c3912a$1356dea0$6501a8c0@griffiths2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

[snip]

> I think you want something like:
> UPDATE user_account SET last_name = 'abc'
> WHERE EXISTS (SELECT 1 FROM commercial_entity ce, commercial_service cs
> WHERE user_account.user_account_id = ce.user_account_id AND
> ce.commercial_entity_id = cs.commercial_entity_id);

Unfort, this is still taking a long time.

----------------------------------------------------------------------------
----------------------------------------------------------------------------
-------
Seq Scan on user_account (cost=0.00..748990.51 rows=36242 width=716)
(actual time=10262.50..26568.03 rows=3771 loops=1)
Filter: (subplan)
SubPlan
-> Nested Loop (cost=0.00..11.47 rows=1 width=24) (actual
time=0.24..0.24 rows=0 loops=72483)
-> Index Scan using comm_ent_usr_acc_id_i on commercial_entity
ce (cost=0.00..4.12 rows=1 width=12) (actual time=0.05..0.05 rows=0
loops=72483)
Index Cond: ($0 = user_account_id)
-> Index Scan using comm_serv_comm_ent_id_i on
commercial_service cs (cost=0.00..7.32 rows=3 width=12) (actual
time=1.72..1.72 rows=0 loops=7990)
Index Cond: ("outer".commercial_entity_id =
cs.commercial_entity_id)
Total runtime: 239585.09 msec
(9 rows)

Anyone have any thoughts?

David

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Joe Conway 2003-10-13 01:37:18 Re: Another weird one with an UPDATE
Previous Message Ivan Voras 2003-10-12 22:47:38 Re: go for a script! / ex: PostgreSQL vs. MySQL