Re: Interesting speed anomaly

Поиск
Список
Период
Сортировка
От Zoltan Boszormenyi
Тема Re: Interesting speed anomaly
Дата
Msg-id 43A1F547.3080308@dunaweb.hu
обсуждение исходный текст
Ответ на Re: Interesting speed anomaly  ("Jim C. Nasby" <jnasby@pervasive.com>)
Список pgsql-hackers
Jim C. Nasby írta:

>Those queries aren't the same though. The view is equivalent to
>
>SELECT *
>FROM
>    (select 'AAA' AS prefix,id from table 1
>        union select 'AAA',id from table 2
>    ) view
>WHERE prefix||id = '...'
>
>In this case the prefixes have already been unioned together, so there's
>no chance for the planner to use the function index.
>
>If break the WHERE clause into seperate clauses, such as
>
>WHERE prefix='AAA' AND id = '2005000001'
>
>then I think the planner will know what selects it can simply ignore. If
>that doesn't work, then add 'AAA'||id AS fullid to each of the selects
>in the view and that should allow the function indexes to be used.
>  
>

Thanks, both method sworks very fast now and use the expression indexes.
Thanks for the patience and the explanations.

Best regards,
Zoltán Böszörményi



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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: postgres version control?
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Which qsort is used