You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Tim Dudgeon <td...@informaticsmatters.com> on 2008/10/05 22:01:51 UTC

Slow performance of select count(*) from a_table

I have a large table (24 million rows) and getting the row count with 
select count(*) from a_table is taking about 50 seconds.
This seems surprising to me. Surely Derby is not going through every row 
and counting them?

Tim


Re: Slow performance of select count(*) from a_table

Posted by Tim Dudgeon <td...@informaticsmatters.com>.
Knut Anders Hatlen wrote:
> Tim Dudgeon <td...@informaticsmatters.com> writes:
> 
>> I have a large table (24 million rows) and getting the row count with
>> select count(*) from a_table is taking about 50 seconds.
>> This seems surprising to me. Surely Derby is not going through every
>> row and counting them?
> 
> Hi Tim,
> 
> I think that's how count(*) is implemented currently.
> 

So can this be optimised?
Should I submit a RFE?

Thanks

Tim


Re: Slow performance of select count(*) from a_table

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Tim Dudgeon <td...@informaticsmatters.com> writes:

> I have a large table (24 million rows) and getting the row count with
> select count(*) from a_table is taking about 50 seconds.
> This seems surprising to me. Surely Derby is not going through every
> row and counting them?

Hi Tim,

I think that's how count(*) is implemented currently.

-- 
Knut Anders