Subject Re: [firebird-support] Re: Select * from where 0=1
Author Martijn Tonies
Hi,

> > Still, shouldn't "Select * from <table> where 0=1" execution time be
> > independant from the table's size ?
>
> Firebird checks the where clause for each row of the table, that's why
> it is slow. Using the PK makes it possible to look it up directly
> using an index so that is faster.
>
> That Firebird doesn't know that 0 will be different from 1 without
> evaluating it for every row is actually helping those of us who
> occationally want to prevent the optimizer from choosing one
> particular plan.

I think another reason why the optimizer doesn't recognize this
as a "silly case", is that is was expected that developers would
write meaningful SQL :-)

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com