Subject | Re: Why does it take hours to perform a select count(*) on a table with 586,000 recs |
---|---|
Author | Svein Erling Tysvær |
Post date | 2006-02-24T20:57:30Z |
--- In firebird-support@yahoogroups.com, "nathanawork" wrote:
changes (I think), the select count has to check every record -
possibly several versions on some of them. Still, 586.000 records
isn't more records than a simple select count(*) should be taking few
seconds (normally). I counted just under 1000000 rows in a view
earlier today, the entire table probably has 10-15 million rows.
However, put this in a join or subselect and the select count may be
executed lots of times - easily reaching hours.
It is also possible to do a quick and dirty count of records that is
not accurate. Take a look at
http://www.fbtalk.net/viewtopic.php?id=164
HTH,
Set
>Due to the multi-generational architecture and possible uncommitted
> I have a table with 586,000 records. When I try to get a record
> count using select count(*) from table, it takes hours. Why is this?
> How can I get a quick count?
changes (I think), the select count has to check every record -
possibly several versions on some of them. Still, 586.000 records
isn't more records than a simple select count(*) should be taking few
seconds (normally). I counted just under 1000000 rows in a view
earlier today, the entire table probably has 10-15 million rows.
However, put this in a join or subselect and the select count may be
executed lots of times - easily reaching hours.
It is also possible to do a quick and dirty count of records that is
not accurate. Take a look at
http://www.fbtalk.net/viewtopic.php?id=164
HTH,
Set