Re: check constraint question - Mailing list pgsql-general

From Gregory Stark
Subject Re: check constraint question
Date
Msg-id 877ihyjfyb.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: check constraint question  ("Tim Rupp" <caphrim007@gmail.com>)
List pgsql-general
"Tim Rupp" <caphrim007@gmail.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!

pgsql-general by date:

Previous
From: "Gevik Babakhani"
Date:
Subject: Re: exporting postgre data
Next
From: Gregory Stark
Date:
Subject: Re: REINDEX on large DB vs. DROP INDEX/CREATE INDEX