From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Expression transformation curiosity |
Date: | 2003-08-17 10:32:58 |
Message-ID: | 200308171132.58073.dev@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I just had a look at EXPLAIN ANALYSE output for an SQL function I'm trying to
write. The WHERE clause wasn't too complex, but the explain output took up a
dozen lines.
Boiling the problem down, I've looked at a clause of the form:
a OR (b AND c)
which PG converts to:
(a OR b) AND (a OR c)
Now these two are equivalent, but it would take me forever to demonstrate that
with the full query. I'm happy the planner is going to get it right, but I'm
confused as to why the transformation occurs.
Is it an artefact of displaying the EXPLAIN, or is it actually processed that
way? You could see how testing "a" twice could be expensive in some
situations.
Oh, btw - 7.3.2 on this box, I'll be looking at 7.3.3/4 later today.
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-08-17 15:23:01 | Re: Expression transformation curiosity |
Previous Message | Rod Taylor | 2003-08-17 02:47:22 | Re: Do it exist? |