Subject Re: how to do a view (or work with) of top 80000 records
Author Svein Erling Tysvær
Have you verified that it returns the correct records? Just asking due
to Bjoern Reimers question about SELECT FIRST not too long ago
(yesterday or today).

Set

--- In firebird-support@yahoogroups.com, "Gary Benade" wrote:
> >> ended up with this, based on your example
> >>
> >> select b.name, count(*) from customers c
> >> join branches b on b.orderappend = c.branchcode and
> >> b.enabled = 'T'
> >> where c.weighted_value >=
> >> (SELECT FIRST 1 SKIP 80000 Weighted_Value FROM Customers
> >> ORDER BY Weighted_Value DESC)
> >> group by 1
>
> > Ann Harrison wrote,
> > Do you have any idea what the performance of that is likely to be?
>
> PLAN (CUSTOMERS ORDER I_CUSTOMERS_WEIGHTEDVALUE)
> PLAN SORT (JOIN (B NATURAL,C INDEX
> (IDX_CUSTOMERS_BRANCHCODE,I_CUSTOMERS_WEIGHTEDVALUE)))
>
> Prep 0.496 sec
> Process 7.156 sec
>
> 65 non indexed reads on branches
> 160,037 indexed reads on customers
>
> very very very impressive compared to the 5+ hour return times of my
> original attempt :)
>
> Regards
> Gary