Re: Another weird one with an UPDATE - Mailing list pgsql-performance

From David Griffiths
Subject Re: Another weird one with an UPDATE
Date
Msg-id 080d01c3912a$1356dea0$6501a8c0@griffiths2
Whole thread Raw
In response to Another weird one with an UPDATE  (David Griffiths <dgriffiths@boats.com>)
Responses Re: Another weird one with an UPDATE
Re: Another weird one with an UPDATE
List 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

pgsql-performance by date:

Previous
From: Gaetano Mendola
Date:
Subject: Re: IMMUTABLE function's flag do not work: 7.3.4, plpgsql
Next
From: Joe Conway
Date:
Subject: Re: Another weird one with an UPDATE