Re: Allow use of immutable functions operating on constants with constraint exclusion

Поиск
Список
Период
Сортировка
От ITAGAKI Takahiro
Тема Re: Allow use of immutable functions operating on constants with constraint exclusion
Дата
Msg-id 20070509173454.6742.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
обсуждение исходный текст
Ответ на Re: Allow use of immutable functions operating on constants with constraint exclusion  ("Marshall, Steve" <smarshall@wsi.com>)
Список pgsql-hackers
"Marshall, Steve" <smarshall@wsi.com> wrote:

> the first query would be optimized using 
> constraint exclusion, while the second query would not:
> 
> SELECT * FROM test_bulletins WHERE created_at > '2006-09-09 
> 05:00:00+00'::timestamptz;
> SELECT * FROM test_bulletins WHERE created_at > '2006-09-09 
> 05:00:00+00'::timestamptz + '0 days'::interval;

Hmmm... CE seems to be still not enough to optimize complex expressions.
If I added the wrapper function, it worked.

CREATE FUNCTION timeadd(timestamptz, interval) RETURNS timestamptz   AS $$ SELECT $1 + $2; $$ LANGUAGE sql IMMUTABLE;

SELECT * FROM test_bulletins WHERE created_at >   timeadd('2006-09-09 05:00:00+00', '0 days');


I noticed that we should be careful about CE with prepared statements
and functions. Seamless partitioning requires more works.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center




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

Предыдущее
От: "Zeugswetter Andreas ADI SD"
Дата:
Сообщение: Re: Seq scans roadmap
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: Windows Vista support (Buildfarm Vaquita)