Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group