Resolved: SQL Index exercise
Hi,
I am working through the index exercise where I extract salary figures of everything above 89000.
It seems that when I create an index for this and then execute the same selection code, it takes longer than when it doesn't have an index.
Why is this the case?
1 answers ( 0 marked as helpful)
Hi Josh!
Thanks for reaching out.
Although in this example on some machines the fetch time actually increases when applying the index, the fact is that when your database is much larger, this difference can be reverted significantly, and in that case using indexes will be crucial. That's why this technique is important and the theory provided in the lectures is actually, in general, valid.
Just depending on computer settings, Workbench version and the like, the fetch time appears slower with indexes in this example for some machines, apparently. Hope this clarifies the situation but thanks for sharing this information with our Community! Best,
Martin
Just depending on computer settings, Workbench version and the like, the fetch time appears slower with indexes in this example for some machines, apparently. Hope this clarifies the situation but thanks for sharing this information with our Community! Best,
Martin