Subject Re: [firebird-support] Fastest way to query tables and views and return no records.
Author Helen Borrie
At 10:04 AM 3/03/2009, you wrote:
>Hi,
>
>I have a routine I use in my application which runs a separate query
>on every table and view in the database. The purpose of these queries
>is really just to obtain the field definitions of the underlying
>table, not to return any actual data.
>
>The routine uses the following generic SQL:
>
>Select * from TableName/ViewName where 1 = 0;
>
>My problem is that these queries can run very slowly on views which
>are really meant to have additional where clause statements, and even
>on tables with large numbers of records. The intention of the where
>clause "where 1 = 0" was to eliminate any query activity, but it is
>not working out this way.
>
>Is there a query which I can execute that will run very fast (and
>return no data), or any other ideas on how to do what I want?

You only need to prepare the query to get hold of the information you want.

./heLen