Re: COALESCE implementation question - Mailing list pgsql-hackers

From Philip Warner
Subject Re: COALESCE implementation question
Date
Msg-id 3.0.5.32.20000805172250.01f18720@mail.rhyme.com.au
Whole thread Raw
In response to COALESCE implementation question  (Philip Warner <pjw@rhyme.com.au>)
Responses Re: COALESCE implementation question
Re: COALESCE implementation question
List pgsql-hackers
P.S. What's worse, I should have mentioned that the plan *with* indexes
seems flawed:

Create Table t1(f1 int);
Create Table t1(f1 int, f2 int);
Create Unique Index t2f1 on t2(f1);
Create Unique Index t2f2 on t2(f2);

explain update t1 set f1 = Coalesce( (select f2 from t2 x where x.f1 =
t1.f1), t1.f1);
NOTICE:  QUERY PLAN:

Seq Scan on t1  (cost=0.00..20.00 rows=1000 width=10) SubPlan   ->  Index Scan using t2f1 on t2 x  (cost=0.00..8.14
rows=10width=4)   ->  Seq Scan on t2 x  (cost=0.00..22.50 rows=1000 width=4)
 



----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.C.N. 008 659 498)             |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


pgsql-hackers by date:

Previous
From: Philip Warner
Date:
Subject: COALESCE implementation question
Next
From: Philip Warner
Date:
Subject: Re: COALESCE implementation question