From: mallah@trade-india.com
To: pgsql-sql@postgresql.org
Subject: Why is seq search preferred here by planner?
Date: Wed, 23 Apr 2003 21:51:21 +0530 (IST)
Message-ID: <1220.219.65.235.51.1051114881.squirrel@mail.trade-india.com> (raw)
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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mallah@trade-india.com
Subject: Re: Why is seq search preferred here by planner?
In-Reply-To: <1220.219.65.235.51.1051114881.squirrel@mail.trade-india.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox