Subject Re: [firebird-support] If Not SELECT COUNT(*), Then What?
Author Martijn Tonies
Hi,

> I had a bug in a function that is passed a table
> name and a where clause, and returns a count of the
> records that qualify for the where clause, if one is
> passed in.
>
> The function builds an SQL of
>
> SELECT
> COUNT(*) FROM
> <Table Name>
> WHERE <--------- If where clause passed in
> <Where Clause>;
>
> While tracking down the problem I read in Helen's
> book that SELECT COUNT(*) is inefficient.
>
> Should I re-think the use of COUNT(*) in this
> function?

Not in particular... The real question would be:

Why do you use COUNT anyway?

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!

Database questions? Check the forum:
http://www.databasedevelopmentforum.com