From: | <mallah(at)trade-india(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Why is seq search preferred here by planner? |
Date: | 2003-04-23 16:21:21 |
Message-ID: | 1220.219.65.235.51.1051114881.squirrel@mail.trade-india.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi Folks,
I want to update the country feild in table email_bank by looking
up another table personal_account_details by matching userid.
any anyone tellme why an seq scan on personal_account_details
for getting the coutry. the query is:
UPDATE email_bank set country=personal_account_details.country where userid > 0 and
userid=personal_account_details.userid ;
both tables have been vacuum analyzed before running the queries.
my question is is the the best plan ?
becoz i most get similar plan when i update in
this manner.
Its quite a decent IBM xseries server with
2GB ram and 4 Intel(R) XEON(TM) CPU 2.00GHz.
and explain analyze is below:
tradein_clients=# begin work;explain analyze UPDATE email_bank set
country=personal_account_details.country where userid > 0 and
userid=personal_account_details.userid ;BEGIN
Time: 669.57 ms
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=14496.79..36722.98 rows=216658 width=137) (actual time=3505.31..49707.67
rows=150756 loops=1) Hash Cond: ("outer".userid = "inner".userid)
-> Seq Scan on email_bank (cost=0.00..16268.10 rows=216658 width=123) (actual
time=0.06..43033.91 rows=155714 loops=1) Filter: (userid > 0)
-> Hash (cost=14113.23..14113.23 rows=153423 width=14) (actual time=3505.08..3505.08 rows=0
loops=1) -> Seq Scan on personal_account_details (cost=0.00..14113.23 rows=153423 width=14)
(actual time=0.04..3196.12 rows=153431 loops=1) Total runtime: 209472.14 msec
(7 rows)
Regds
Mallah.
-----------------------------------------
Get your free web based email at trade-india.com.
"India's Leading B2B eMarketplace.!"
http://www.trade-india.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2003-04-23 16:32:09 | Re: [SQL] Yet Another (Simple) Case of Index not used |
Previous Message | Bruce Williams | 2003-04-23 15:44:51 | Invoice Numbers |