broken join optimization? (8.0)

From: chester c young <chestercyoung(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: broken join optimization? (8.0)
Date: 2005-10-25 23:56:11
Message-ID: 20051025235612.20767.qmail@web54301.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bath, David 2005-10-26 01:13:43 ?Equiv to oracle (ENABLE|DISABLE) (CONSTRAINT|TRIGGER) statements?
Previous Message Judith Altamirano Figueroa 2005-10-25 23:28:38 backend error