How do I index to speed up OVERLAPS?

From: Matthew Wilson <matt(at)tplus1(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How do I index to speed up OVERLAPS?
Date: 2008-11-29 21:18:28
Message-ID: slrngj3cd4.b3g.matt@sprout.tplus1.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a table shift with a start_time column and a stop_time column and
I do a lot of queries like:

select * from shift
where (start_time, stop_time) overlaps ($A, $B);

$A and $B are user-submitted values.

Anyhow, how do I put indexes on my table to make these queries run
faster?

Also, is there a better data type to use for ranges of time?

TIA

Matt

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ries van Twisk 2008-11-29 21:22:54 Re: Install question on Mac Leopard Server 10.5
Previous Message ries van Twisk 2008-11-29 21:05:16 Re: Install question on Mac Leopard Server 10.5