Re: Regex query not using index

Поиск
Список
Период
Сортировка
От Chris
Тема Re: Regex query not using index
Дата
Msg-id 47BBC33D.6040500@gmail.com
обсуждение исходный текст
Ответ на Re: Regex query not using index  ("Postgres User" <postgres.developer@gmail.com>)
Список pgsql-general
Postgres User wrote:
> by the way, your example works fine unless it's a null value or empty string
> unfortunately, postgres isn't smart enough to know that the when
> p_param below is null, that the WHERE condition can be ignored
>
> select * from table where name in (Coalesce(p_param, name))
>
> which is the same as:   select * from table where name in (name)
>
> postgres does a row scan on the above sql.  too slow.

If there's no where condition, postgres has to do a seq-scan anyway so
your argument is void :)

--
Postgresql & php tutorials
http://www.designmagick.com/

В списке pgsql-general по дате отправления:

Предыдущее
От: "Postgres User"
Дата:
Сообщение: Re: Regex query not using index
Следующее
От: H.Harada
Дата:
Сообщение: Re: ERROR: relation with OID 1322527 does not exist