pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Orion Henry <orion@trustcommerce.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: help with dual indexing
Date: 26 Jan 2004 12:53:16 -0800
Message-ID: <1075150396.10503.363.camel@orthanc> (raw)
In-Reply-To: <8630.1074906490@sss.pgh.pa.us>
References: <1074884311.10503.133.camel@orthanc>
	<8630.1074906490@sss.pgh.pa.us>

Thanks Tom!  You're a life-saver.

On Fri, 2004-01-23 at 17:08, Tom Lane wrote:
> Orion Henry <orion@trustcommerce.com> writes:
> > The queries usually are in the form of, where "user_id = something and
> > event_time between something and something".
> 
> > Half of my queries index off of the user_id and half index off the
> > event_time.  I was thinking this would be a perfect opportunity to use a
> > dual index of (user_id,event_time) but I'm confused as to weather this
> > will help
> 
> Probably.  Put the user_id as the first column of the index --- if you
> think about the sort ordering of a multicolumn index, you will see why.
> With user_id first, a constraint as above describes a contiguous
> subrange of the index; with event_time first it does not.
> 
> 			regards, tom lane
-- 
Orion Henry <orion@trustcommerce.com>

Attachments:

  signature.asc (application/pgp-signature, 188B) download

view thread (3+ messages)

Message-ID: <1075150396.10503.363.camel@orthanc>
Permalink:  ../1075150396.10503.363.camel@orthanc/
Also on:    postgresql.org/message-id/1075150396.10503.363.camel@orthanc

 · 

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: orion@trustcommerce.com, tgl@sss.pgh.pa.us
  Subject: Re: help with dual indexing
  In-Reply-To: <1075150396.10503.363.camel@orthanc>

* 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