I have a test table with 20M rows, one row have 2 column type integer, 1 column have index, other dont't have. Value of integer column is random value from 0 to 1000.
Run query with equal condition below, query in column with index is much faster.
"select count(*) from test where int_1 = 100;"
(0.084 seconds vs 15.221 seconds) => > 150x faster
But when run a range query, query in column with index is not much faster.
"select count(*) from test where int_1 > 700;"
(7.852 seconds vs 12.889 seconds) => > 0.5x faster
Should index have to optimize data organizaion or algorithm to increase performance ?
Thanks a lot.