I am using Postgres database , I am trying to see the difference between Index Scan and Sequential scan on table of 1000000 rows
Describe table
\d grades
Then explain analyze for rows between 10 and 500000
explain analyze select name from grades where pid between 10 and 500000 ;
Then explain analyze for rows between 10 and 600000
explain analyze select name from grades where pid between 10 and 600000 ;
The strange for me why it made Index scan on first query and sequential scan in the second although they query by the same column which it contained in the index .


