[EMAIL PROTECTED] wrote on 31/03/2002 08:06:52:

> Greg Sikorski writes:
> 
> > How come this Index isn't being used in the situation below?
> 
> There's no point in using an index if you're retrieving nearly the 
entire
> table.
> 
> -- 
> Peter Eisentraut   [EMAIL PROTECTED]
> 
> 

Well, that was probably a poor example to include, but it was nearly 4am 
;)

Typically <20 results are returned, although it still says "Seq Scan", but 
on a smaller subset.

--
cmaster=# SELECT user_id,channel_id FROM levels WHERE suspend_expires <= 
1017589362 AND suspend_expires <> 0;
 user_id | channel_id
---------+------------
...
(17 rows)

cmaster=# explain analyze SELECT user_id,channel_id FROM levels WHERE 
suspend_expires <= 1017589362 AND suspend_expires <> 0;
NOTICE:  QUERY PLAN:

Seq Scan on levels  (cost=0.00..13709.09 rows=2609 width=8) (actual 
time=208.98..1521.08 rows=17 loops=1)
Total runtime: 1521.29 msec

Cheers, Greg.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to