<= Index.

From: "Greg Sikorski" <gte(at)atomicrevs(dot)demon(dot)co(dot)uk>
To: pgsql-admin(at)postgresql(dot)org
Subject: <= Index.
Date: 2002-03-31 04:08:07
Message-ID: OF33E123C1.30883729-ON80256B8D.0015DC01-80256B8D.0016B750@atomicrevs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

How come this Index isn't being used in the situation below? :) The field
is an epoch timestamp, and for various reasons it can't be a postgres
date/time type ;)
It does use the index with a direct = comparison.

Cheers, Greg

--
cmaster=# explain analyze SELECT user_id,channel_id FROM levels WHERE
suspend_expires <= 1017550117;
NOTICE: QUERY PLAN:

Seq Scan on levels (cost=0.00..13297.38 rows=395082 width=8) (actual
time=0.10..6647.88 rows=355869 loops=1)
Total runtime: 7492.36 msec

cmaster=# \d levels_suspendexpires_idx
Index "levels_suspendexpires_idx"
Column | Type
-----------------+---------
suspend_expires | integer
btree

--
cmaster=# select min(suspend_expires) from levels;
0
cmaster=# select max(suspend_expires) from levels;
1049662527
cmaster=# select avg(suspend_expires) from levels;
4555730.7985110746

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Eisentraut 2002-03-31 07:06:52 Re: <= Index.
Previous Message Derek Neighbors 2002-03-30 18:57:51 Re: Troubles Starting Postgres