X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 03C589DC809 for ; Wed, 1 Feb 2006 11:46:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70930-03 for ; Wed, 1 Feb 2006 11:46:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from relay01.mdc.ubisoft.com (relay01.mdc.ubisoft.com [216.98.56.134]) by postgresql.org (Postfix) with ESMTP id D563D9DCA15 for ; Wed, 1 Feb 2006 11:45:59 -0400 (AST) Received: from mdc-owa01.ubisoft.org (srvowa1-mdc.ubisoft.org [10.129.1.20]) by smarthost.mdc.ubisoft.com (Postfix) with ESMTP id 540F34BB6E for ; Wed, 1 Feb 2006 10:46:04 -0500 (EST) Received: from UBIMAIL1.ubisoft.org ([10.129.1.15]) by mdc-owa01.ubisoft.org with Microsoft SMTPSVC(6.0.3790.1830); Wed, 1 Feb 2006 10:46:04 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C62746.9B733CEA" Subject: CREATE INDEX with order clause Date: Wed, 1 Feb 2006 10:46:03 -0500 Message-ID: <1E293D3FF63A3740B10AD5AAD88535D20171B758@UBIMAIL1.ubisoft.org> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: CREATE INDEX with order clause Thread-Index: AcYnRptLXR9mCRkBRV2waoXBHx+xbA== From: "Daniel Caune" To: X-OriginalArrivalTime: 01 Feb 2006 15:46:04.0199 (UTC) FILETIME=[9BD0E370:01C62746] X-Ubisoft-MailScanner-Information: Please contact administrators@ubisoft.qc.ca X-Ubisoft-MailScanner: Found to be clean X-Ubisoft-MailScanner-SpamCheck: X-MailScanner-From: daniel.caune@ubisoft.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.121 required=5 tests=[AWL=0.120, HTML_MESSAGE=0.001, UPPERCASE_25_50=0] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200602/4 X-Sequence-Number: 24014 This is a multi-part message in MIME format. ------_=_NextPart_001_01C62746.9B733CEA Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 I would like to create an index on a table, specifying an order clause for one of the columns. =20 CREATE INDEX IDX_GSLOG_EVENT_PLAYER_EVENT_TIME_DESC ON GSLOG_EVENT(PLAYER_USERNAME, EVENT_NAME, EVENT_DATE_CREATED DESC); =20 which is not a valid, as the order clause DESC is not supported. Such as index would improve performance of query like: =20 SELECT GAME_CLIENT_VERSION FROM GSLOG_EVENT WHERE PLAYER_USERNAME =3D ? AND EVENT_NAME =3D ? AND EVENT_DATE_CREATED < ? ORDER BY EVENT_DATE_CREATED DESC LIMIT 1 =20 Actually, I'm not sure that is useful; perhaps PostgreSQL handles pretty well such query using an index such as: =20 CREATE INDEX IDX_GSLOG_EVENT_PLAYER_EVENT_TIME_DESC ON GSLOG_EVENT(PLAYER_USERNAME, EVENT_NAME, EVENT_DATE_CREATED); =20 Any idea? =20 -- Daniel CAUNE Ubisoft Online Technology (514) 4090 2040 ext. 5418 =20 ------_=_NextPart_001_01C62746.9B733CEA Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

 

I would like to create an index on a table, specifying an order clause for one of the = columns.

 

CREATE INDEX IDX_GSLOG_EVENT_PLAYER_EVENT_TIME_DESC

=

  = ON = GSLOG_EVENT(PLAYER_USERNAME,

           &= nbsp;     EVENT_NAME,

           &= nbsp;     EVENT_DATE_CREATED DESC);

 

which is not a valid, as the order clause = DESC is not supported.  Such as index would improve performance of query = like:

 

SELECT GAME_CLIENT_VERSION

  = FROM = GSLOG_EVENT

  = WHERE = PLAYER_USERNAME =3D ?

    AND = EVENT_NAME =3D ?

    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,

           &= nbsp;     EVENT_NAME,

           &= nbsp;     EVENT_DATE_CREATED);

 

Any idea?

 

--

Daniel CAUNE

Ubisoft Online Technology

(514) 4090 2040 ext. 5418

 

------_=_NextPart_001_01C62746.9B733CEA--