broken join optimization? (8.0) - Mailing list pgsql-sql

From chester c young
Subject broken join optimization? (8.0)
Date
Msg-id 20051025235612.20767.qmail@web54301.mail.yahoo.com
Whole thread Raw
Responses Re: broken join optimization? (8.0)  (Michael Fuhr <mike@fuhr.org>)
Re: broken join optimization? (8.0)  (Richard Huxton <dev@archonet.com>)
List pgsql-sql
in php (for example) it's frequently nice to get the structure of a
table without any data, ie, pull a single row with each attribute's
value is null.  I use the query (dual is a table of one row ala
Oracle):

select m.* from dual
left join mytable m on( false );

this works every time, but if mytable is big, then takes a long time. 
needed to rewrite the query to:

select m.* from dual
left join (select * from mytable limit 1) m on( false );

this works as it should - pulls empty row but fast.

it seems to me that a full table scan should not be necessary if the
join condition is false.


    
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs


pgsql-sql by date:

Previous
From: Judith Altamirano Figueroa
Date:
Subject: backend error
Next
From: "Bath, David"
Date:
Subject: ?Equiv to oracle (ENABLE|DISABLE) (CONSTRAINT|TRIGGER) statements?