Subject | Re: Select count(*) too slow |
---|---|
Author | nathanelrick |
Post date | 2012-02-13T20:17:29Z |
thanks thomas, i will try this look pretty good !
--- In firebird-support@yahoogroups.com, Thomas Steinmaurer <ts@...> wrote:
>
> > 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/
>