The old "not using index" question - Mailing list pgsql-general

From Jan-Philipp 'Thefly' Reining
Subject The old "not using index" question
Date
Msg-id 02cd01c297c5$8cfcbb80$84c206d4@thefly
Whole thread Raw
Responses Re: The old "not using index" question
List pgsql-general
Hi there,

---this one is using the index on "ranking"
SELECT  *
FROM  ttm_slots s
WHERE  s.peering = 72
AND   s.ranking = 1050

---but this one does not?
SELECT  *
FROM  ttm_slots s
WHERE  s.peering = 72
AND   s.ranking < 1050
AND   s.ranking > 950

The index ist "btree", so it should be able to use the index with a < >
comparison?

\d ranking_ttm_slots_key
Index "ranking_ttm_slots_key"
 Column  |  Type
---------+---------
 ranking | integer
btree



regards,
Jan-Philipp


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Memory leak with palloc
Next
From: Joe Conway
Date:
Subject: Re: One SQL to access two databases.