I can't find a reasonable explanation for this.
I have a table game, with primary key gameid (an int).
If I use a where involving gameid and <, or >, or <=, or >=, then I get a sequential scan. If I use =, then of course I get an Index scan.
More surprising to me is the fact that using BETWEEN, I get an Index scan!!
The following is a copy-n-paste of the EXPLAIN outputs (with the useless lines removed):
explain delete from game where gameid = 1000; Index Scan using game_pkey on game (cost=0.00..3.14 rows=1 width=6)
explain delete from game where gameid < 1000; Seq Scan on game (cost=0.00..4779.50 rows=200420 width=6)
explain delete from game where gameid between 1000 and 2000; Index Scan using game_pkey on game (cost=0.00..3.15 rows=1 width=6)
How's that possible? Is it purposely done like this, or is it a bug? (BTW, Postgres version is 7.2.3)
Thanks,
Carlos --
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org