Subject Re: [firebird-support] Select * from where 0=1
Author Jerome Bouvattier

> > > > I need to come up with a statement that's as fast a #2 but also
> on
> > > > most IB/FB engines.
> > > > How should this statement look like ?
> >
> > > select * from table where pkcolumn = nonexistingvalue.
> >
> > The problem with this statement is that it forces me to know a bit too
> much
> > about the table :
> > a column name and a non-existing value.
> >
> > Ideally, I'd need something more generic.
> > Any other hint ?
> No.
> But why do you want to do this?

Actually, it's not for me. I'm asking for the makers of a Delphi tool I use
"Data Abstract". Part of it, is an IDE that lets you build a repository
holding SQL statements. It works with a number of data access libraries and
wizards use
TDataset.Fields information to help build the abstracted datasets, commands,
params mappings, etc...
They appear to use the query "Select * from <table> where 0=1" to retrieve
field defs under the hood (or maybe it's standard TDataset implementation).
instantaneous with most backends and data access libraries except against
big FB tables (accessed thru IBX/IBO, didn't test with IB). In this case
execution is proportional to the table's size.
Since this tool heavily draws on the above query, it gets somewhat jerky in
the above scenario.

They seem not too much versed into IB/FB, so I decided to ask for a
workaround here. Just in case.

Not sure I'm clear...

Still, shouldn't "Select * from <table> where 0=1" execution time be
independant from the table's size ?