Re: Partitioned tables in queries - Mailing list pgsql-performance

From Andrew Hammond
Subject Re: Partitioned tables in queries
Date
Msg-id 1153860508.907395.248520@h48g2000cwc.googlegroups.com
Whole thread Raw
In response to Re: Partitioned tables in queries  (Kevin Keith <kkeith@borderware.com>)
List pgsql-performance
> 2. I found that using the now() function - and arbitrary interval will
> produce a different execution plan that using a specific date. For example:
>     assuming the current time is 16:00:
>     a) where start_date > now() - interval '4 hours' scans all child tables.
>     b) where start_date > '2006-07-21 12:00:00' only scans the child
> table with today's data.
>
> So am I to assume that the value in the query must be a constant, and
> cannot be a result of a built-in function in order for
> constraint_exclusion to work correctly?

Have you tried WHERE start_date > (SELECT now() - interval '4 hours')?
Certainly using the constant will allow CBE to work. I think that a
subquery might too.


pgsql-performance by date:

Previous
From: Markus Schaber
Date:
Subject: Re: BUG #2543: Performance delay acrros the same day
Next
From: nuggets72@free.fr
Date:
Subject: loading increase into huge table with 50.000.000 records