Subject Select * from where 0=1
Author Jerome Bouvattier
Hello list,

I need to retrieve an empty resultset with all fields of a given table. I
tried the two following queries :

#1 : Select * from <table> where 0=1
#2 : Select first 0 * from <TableName>

First one seems to care about the amount of data in the queried table, while
the second one does not.

Against an empty table, both queries perform the same.
On a 15 million table, #1 takes 1.8s while #2 takes 20ms.

I need to come up with a statement that's as fast a #2 but also works on
most IB/FB engines.
How should this statement look like ?

Thanks in advance.

--
Jerome