Subject Re: SQL
Author mihai_silver
--- In firebird-support@yahoogroups.com, "nxciro" <pict100@y...>
wrote:
>
> Hello
>
> Fb 1.5.1
>
> Do I have a better way to formulate this query
> to speed things up ?
>
> select distinct xrnd, count(xrnd) from t1
> group by xrnd
> order by count(xrnd) desc
>
> there is an index for xrnd
> the table currently has 6 million rows
>
> this is the plan : PLAN SORT (SORT (SORT ((T1 NATURAL))))
>
> nxciro

I think you can't improve the speed of that query but if you are't
interested to see all the results at once you can try this:
"select first :number skip :number distinct xrnd, count(xrnd) from t1
group by xrnd
order by count(xrnd) desc"

Good luck,
Silver