Subject | Re: [firebird-support] Optimizing SELECT DISTINCT .. |
---|---|
Author | Harriv |
Post date | 2009-02-03T12:15:19Z |
On Tue, Feb 3, 2009 at 1:27 PM, Douglas Tosi <douglasht@...> wrote:
The number just moves from "Non-indexed" to "Indexed" in DBWorkbench.
> On Tue, Feb 3, 2009 at 9:11 AM, Harri Vartiainen <harriv@...> wrote:Yes it does, but according to statistics it still reads whole table.
>> What would be best way to optimize "SELECT DISTINCT FIELD1 FROM
>> TABLE1 ORDER BY FIELD1" query?
>
> Not sure if it's the best, but try:
> SELECT FIELD1 FROM TABLE1 GROUP BY FIELD1
> This should use the index for an ordered fetch.
The number just moves from "Non-indexed" to "Indexed" in DBWorkbench.
>
> hth,
> --
> Douglas Tosi
> www.sinatica.com
>