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


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to