Subject Re: Select distinct slow
Author Adam
You have no index on the f_gender field in t_framesdata. The way that
FB is trying to implement the distinct is by using a sort, and you
can see it is not using an index to do that.

Basically, you are requiring FB to check 285520 records to do its
operation. There may be some connection overhead, but I doubt that is
29 seconds.

Adam


<snip>

>
> SELECT DISTINCT f_gender from t_framesdata
>
> Plan
> PLAN SORT ((T_FRAMESDATA NATURAL))
>
> Adapted Plan
> PLAN SORT ((T_FRAMESDATA NATURAL))
>
> the table has 38 fields and 285520 rows

<snip>