pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steinar H. Gunderson <sgunderson@bigfoot.com>
To: pgsql-performance@postgresql.org
Subject: Re: Performace comparison of indexes over timestamp fields
Date: Tue, 22 May 2007 14:43:20 +0200
Message-ID: <20070522124320.GA24779@uio.no> (raw)
In-Reply-To: <88daf38c0705220539q5807d2c2t1f20a03922bf8d33@mail.gmail.com>
References: <4652C846.4020801@andromeiberica.com>
	<88daf38c0705220539q5807d2c2t1f20a03922bf8d33@mail.gmail.com>

On Tue, May 22, 2007 at 02:39:33PM +0200, Alexander Staubo wrote:
> PostgreSQL uses B-tree indexes for scalar values. For an expression
> such as "t between a and b", I believe it's going to match both sides
> of the table independently (ie., t >= a and t <= b) and intersect
> these subsets. This is inefficient.

A B-tree index can satisfy range queries such as this.

> You should get better performance by mapping timestamps to a
> one-dimensional plane and indexing them using GiST. GiST implements an
> R-tree-like structure that supports bounding-box searches.

You may be thinking of interval overlaps?

/* Steinar */
-- 
Homepage: http://www.sesse.net/



view thread (5+ messages)  latest in thread

Message-ID: <20070522124320.GA24779@uio.no>
Permalink:  ../20070522124320.GA24779@uio.no/
Also on:    postgresql.org/message-id/20070522124320.GA24779@uio.no

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: sgunderson@bigfoot.com
  Subject: Re: Performace comparison of indexes over timestamp fields
  In-Reply-To: <20070522124320.GA24779@uio.no>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox