Re: COALESCE implementation question

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: pgsql-hackers(at)hub(dot)org
Subject: Re: COALESCE implementation question
Date: 2000-08-05 07:22:50
Message-ID: 3.0.5.32.20000805172250.01f18720@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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=10 width=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 |/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2000-08-05 08:17:11 Re: COALESCE implementation question
Previous Message Denis Perchine 2000-08-05 07:08:58 Re: LIKE/ESCAPE implementation