From: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | "Marshall, Steve" <smarshall(at)wsi(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Allow use of immutable functions operating on constants with constraint exclusion |
Date: | 2007-05-09 09:00:59 |
Message-ID: | 20070509173454.6742.ITAGAKI.TAKAHIRO@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Marshall, Steve" <smarshall(at)wsi(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Meskes | 2007-05-09 09:01:17 | Re: Windows Vista support (Buildfarm Vaquita) |
Previous Message | Zeugswetter Andreas ADI SD | 2007-05-09 08:48:00 | Re: Seq scans roadmap |