Обсуждение: [HACKERS] Optimizer

Поиск
Список
Период
Сортировка

[HACKERS] Optimizer

От
Alexander Demenshin
Дата:
Hi!

  What do you think about "learn" optimizer to use indices
  in queries like:

select max(i) from tab;

  Currently, even if "i" have *unique* index, value for max()
  is searched sequentially!

  And one more:

select * from tab where (s ~ '^aa');

  In this case, if "s" indexed, why not use index, since we know
  *first* characters, and can limit search range?

/Al

------------------------------

Re: [HACKERS] Optimizer

От
Bruce Momjian
Дата:
>
> Hi!
>
>   What do you think about "learn" optimizer to use indices
>   in queries like:
>
> select max(i) from tab;
>
>   Currently, even if "i" have *unique* index, value for max()
>   is searched sequentially!
>

Indexes are currently not used by sorts either.  Actually, there could
be a WHERE clause in the SELECT that would cause the use of an index to
be a problem.

>   And one more:
>
> select * from tab where (s ~ '^aa');
>
>   In this case, if "s" indexed, why not use index, since we know
>   *first* characters, and can limit search range?

This is already on the TODO list.

- --
Bruce Momjian
maillist@candle.pha.pa.us

------------------------------