Hi everyone,
Why is this bad? The answer is also given but I really don't get it well. Can you simply explain with an example what is meant? I thought yes because you have to care about all query which are greater than 20. So the first 1-20 are not relevant for the user. But it seems another reasoning. Is it because its an heap = unclustered that its not worth to have an index because its unordered. So it doesn't make sense to have a range for? If I have heap then its better to have equal search then its way faster?
Consider a relation stored as a randomly ordered file and a single unclustered index on the field sal of the relation. If you want to retrieve all records with sal > 20, is using the index always the best alternative? Explain.
No. In this case, the index is unclustered, each qualifying data entry could contain an rid that points to a distinct data page, leading to as many data page I/Os as the number of data entries that match the range query. In this situation, using index is actually worse than file scan.