Re: Partitioned tables in queries

From: "Andrew Hammond" <andrew(dot)george(dot)hammond(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Partitioned tables in queries
Date: 2006-07-25 20:48:28
Message-ID: 1153860508.907395.248520@h48g2000cwc.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message nuggets72 2006-07-26 15:34:47 loading increase into huge table with 50.000.000 records
Previous Message Markus Schaber 2006-07-24 07:54:29 Re: BUG #2543: Performance delay acrros the same day