Re: check constraint question

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tim Rupp" <caphrim007(at)gmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: check constraint question
Date: 2008-01-25 11:35:24
Message-ID: 877ihyjfyb.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Tim Rupp" <caphrim007(at)gmail(dot)com> writes:

> where start_time >= '2008-01-01'::date AND start_time < '2008-01-10'::date
>
> should give the same rows as
>
> where start_time >= '2008-01-01'::date AND end_time <= '2008-01-09'::date

I think you'll need to do the same thing to the constraints as well. You'll
probably want four clauses on your constraints:

start_time >= ... and start_time <= ... and end_time >= ... and end_time <= ...

(or BETWEEN which is equivalent)

Then you could include start_time and/or end_time ranges in your where clause
and the planner would prune partitions using both ranges.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL training!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Stark 2008-01-25 11:40:24 Re: REINDEX on large DB vs. DROP INDEX/CREATE INDEX
Previous Message Gevik Babakhani 2008-01-25 10:56:12 Re: exporting postgre data