pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Caune <daniel.caune@ubisoft.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrew Sullivan <ajs@crankycanuck.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to force PostgreSQL using an index
Date: Thu, 16 Feb 2006 08:57:20 -0500
Message-ID: <1E293D3FF63A3740B10AD5AAD88535D20190944D@UBIMAIL1.ubisoft.org> (raw)



> -----Message d'origine-----
> De : Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Envoyé : mercredi, février 15, 2006 17:47
> À : Daniel Caune
> Cc : Andrew Sullivan; pgsql-sql@postgresql.org
> Objet : Re: [SQL] How to force PostgreSQL using an index
> 
> "Daniel Caune" <daniel.caune@ubisoft.com> writes:
> > SELECT <some-columns>
> >   FROM GSLOG_EVENT
> >   WHERE EVENT_NAME = 'player-status-update'
> >     AND EVENT_DATE_CREATED >= <start-time>
> >     AND EVENT_DATE_CREATED < <end-time>
> 
> > I have an index on EVENT_DATE_CREATED that does it job.  But I though
> > that I can help my favourite PostgreSQL if I create a composite index on
> > EVENT_DATE_CREATED and EVENT_NAME (in that order as EVENT_DATE_CREATED
> > is more dense that EVENT_NAME).
> 
> Wrong ... should be EVENT_NAME first.  Think about the sort order of the
> data to see why --- your query represents a contiguous subset of the
> index if EVENT_NAME is first, but not if EVENT_DATE_CREATED is first.
> 
> 			regards, tom lane

Yes, you're right!



view thread (11+ messages)

Message-ID: <1E293D3FF63A3740B10AD5AAD88535D20190944D@UBIMAIL1.ubisoft.org>
Permalink:  ../1E293D3FF63A3740B10AD5AAD88535D20190944D@UBIMAIL1.ubisoft.org/
Also on:    postgresql.org/message-id/1E293D3FF63A3740B10AD5AAD88535D20190944D@UBIMAIL1.ubisoft.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: daniel.caune@ubisoft.com, tgl@sss.pgh.pa.us, ajs@crankycanuck.ca
  Subject: Re: How to force PostgreSQL using an index
  In-Reply-To: <1E293D3FF63A3740B10AD5AAD88535D20190944D@UBIMAIL1.ubisoft.org>
  References: <1E293D3FF63A3740B10AD5AAD88535D20190944D@UBIMAIL1.ubisoft.org>

* 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