Re: SQL to Check whether "AN HOUR PERIOD" is between start and end timestamps

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: James Kitambara <jameskitambara(at)yahoo(dot)co(dot)uk>, Srikanth <rssrik(at)yahoo(dot)co(dot)in>, pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL to Check whether "AN HOUR PERIOD" is between start and end timestamps
Date: 2009-04-02 15:00:42
Message-ID: 22529.1238684442@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Another way to phrase the WHERE clause is with the OVERLAPS operator,
> something like this:

> WHERE (start_ts, end_ts) OVERLAPS ('2008-12-07 07:59:59', '2008-12-07 08:59:59')

> What I'm not so sure about is how optimizable this construct is.

Not at all :-( --- or at least, our code doesn't do anything with
it currrently; I shouldn't claim that it's impossible to optimize.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2009-04-02 15:09:44 Re: ibatis with overlaps query
Previous Message Tony Cebzanov 2009-04-02 14:22:50 Performance problem with row count trigger