Re: Question about simple function folding optimization

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Question about simple function folding optimization
Дата
Msg-id 24479.1054230258@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Question about simple function folding optimization  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Question about simple function folding optimization  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-hackers
Awhile back I said:
> [ SQL-function inlining breaks planner's ability to recognize functional
>   indexes ]

> The urge is becoming very strong to fix this by replacing functional
> indexes with expressional indexes, as I suggested doing many moons ago.
> Then the difficulty at hand would be easily handled by running the
> index's defining expression through eval_const_expressions before
> checking if it is equal() to a candidate WHERE argument.  Not sure I
> have time to do that before 7.4 though :-(

I've now done this (amazing what you can do when you're putting off
editing thousands of elog() calls ...), and so Stephan's example
works again:

regression=# explain select * from b1 where (fold_clients(a,b))='1_A';                             QUERY PLAN
----------------------------------------------------------------------Index Scan using b1ind on b1  (cost=0.00..17.12
rows=5width=36)  Index Cond: ((((a)::text || '_'::text) || upper(b)) = '1_A'::text)
 
(2 rows)

Note that EXPLAIN will show the index condition in terms of the inlined
function's expansion.  A rather interesting property of this behavior
is that the index can get matched to whether you write the original
function or its equivalent expression.
        regards, tom lane


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

Предыдущее
От: pgsql@mohawksoft.com
Дата:
Сообщение: Re: No more RH7.3 RPMs?
Следующее
От: Darko Prenosil
Дата:
Сообщение: Linux startup script