Subject | If Not SELECT COUNT(*), Then What? |
---|---|
Author | inoffensive_2009 |
Post date | 2008-12-10T10:14:04Z |
Hi Folks:
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?
Thanks
Larry
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?
Thanks
Larry