Subject Re: [firebird-support] Select count(*) too slow
Author Thomas Steinmaurer
> i uderstand why the count(*) can be very slow because it's must read all the data to know how many reccord ... but is their any way to give a limit to the count(*) ? for exemple if more than 10000 row read then stop the count(*) and return 10000
>
> something like
> select min(10000, count(*))

This is something I can think of:

select count(*) from (
select first 10000 pk_field from yourtable
)

Which basically creates 10000 non-indexed reads.


--
With regards,
Thomas Steinmaurer (^TS^)
Firebird Technology Evangelist

http://www.upscene.com/
http://www.firebirdsql.org/en/firebird-foundation/