From: chester c young <chestercyoung@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: broken join optimization? (8.0)
Date: Tue, 25 Oct 2005 16:56:11 -0700 (PDT)
Message-ID: <20051025235612.20767.qmail@web54301.mail.yahoo.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: chestercyoung@yahoo.com
Subject: Re: broken join optimization? (8.0)
In-Reply-To: <20051025235612.20767.qmail@web54301.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox