pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ragnar <gnari@hive.is>
To: Daniel Caune <daniel.caune@ubisoft.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: CREATE INDEX with order clause
Date: Fri, 03 Feb 2006 09:27:11 +0000
Message-ID: <1138958832.18918.49.camel@localhost.localdomain> (raw)
In-Reply-To: <1E293D3FF63A3740B10AD5AAD88535D20171B758@UBIMAIL1.ubisoft.org>
References: <1E293D3FF63A3740B10AD5AAD88535D20171B758@UBIMAIL1.ubisoft.org>

On Wed, 2006-02-01 at 10:46 -0500, Daniel Caune wrote:
> Hi,
> 
[snip need for reverse-sort operator class]

 
> 
> SELECT GAME_CLIENT_VERSION
>   FROM GSLOG_EVENT
>   WHERE PLAYER_USERNAME = ?
>     AND EVENT_NAME = ?
>     AND EVENT_DATE_CREATED < ?
>   ORDER BY EVENT_DATE_CREATED DESC
>   LIMIT 1

>  
> 
> Actually, I¢m not sure that is useful; perhaps PostgreSQL handles
> pretty well such query using an index such as:
> CREATE INDEX IDX_GSLOG_EVENT_PLAYER_EVENT_TIME_DESC
>   ON GSLOG_EVENT(PLAYER_USERNAME,
>                  EVENT_NAME,
>                  EVENT_DATE_CREATED);
>  
> 
> Any idea?

does index work with:
  SELECT GAME_CLIENT_VERSION 
     FROM GSLOG_EVENT
     WHERE PLAYER_USERNAME = ?
       AND EVENT_NAME = ?
       AND EVENT_DATE_CREATED < ?
     ORDER BY PLAYER_USERNAM DESC,
              EVENT_NAME DESC,
              EVENT_DATE_CREATED DESC
     LIMIT 1

gnari





view thread (3+ messages)

Message-ID: <1138958832.18918.49.camel@localhost.localdomain>
Permalink:  ../1138958832.18918.49.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1138958832.18918.49.camel@localhost.localdomain

 · 

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-sql@postgresql.org
  Cc: gnari@hive.is, daniel.caune@ubisoft.com
  Subject: Re: CREATE INDEX with order clause
  In-Reply-To: <1138958832.18918.49.camel@localhost.localdomain>

* 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