| From: | Ragnar <gnari(at)hive(dot)is> |
|---|---|
| To: | Daniel Caune <daniel(dot)caune(at)ubisoft(dot)com> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: CREATE INDEX with order clause |
| Date: | 2006-02-03 09:27:11 |
| Message-ID: | 1138958832.18918.49.camel@localhost.localdomain |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nigel Bishop | 2006-02-03 10:43:23 | Help writing a piece of SQL |
| Previous Message | padmanabha konkodi | 2006-02-03 05:27:51 |