pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Hammond <andrew.george.hammond@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Partitioned tables in queries
Date: 25 Jul 2006 13:48:28 -0700
Message-ID: <1153860508.907395.248520@h48g2000cwc.googlegroups.com> (raw)
In-Reply-To: <44C13909.9050900@borderware.com>
References: <44C12852.1040909@borderware.com>
	<44C13909.9050900@borderware.com>

> 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.




view thread (4+ messages)

Message-ID: <1153860508.907395.248520@h48g2000cwc.googlegroups.com>
Permalink:  ../1153860508.907395.248520@h48g2000cwc.googlegroups.com/
Also on:    postgresql.org/message-id/1153860508.907395.248520@h48g2000cwc.googlegroups.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: andrew.george.hammond@gmail.com
  Subject: Re: Partitioned tables in queries
  In-Reply-To: <1153860508.907395.248520@h48g2000cwc.googlegroups.com>
  References: <44C12852.1040909@borderware.com> <44C13909.9050900@borderware.com> <1153860508.907395.248520@h48g2000cwc.googlegroups.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox