I’m looking for a number in the phone book where the last name starts with G. Instead of turning every page starting with A to G, I open the phonebook in the middle, then I cut that in half, and half that again till I get to the record I am searching for. That’s essentially what indexes do in a DB.
Haha ‘half’ might have been a bad word to use, rather the emphasis should be on removing a subset of the data to eliminate potential possibilities. It’s easier to find a needle in a haystack if you know which section of the hay it isn’t in.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I’m looking for a number in the phone book where the last name starts with G. Instead of turning every page starting with A to G, I open the phonebook in the middle, then I cut that in half, and half that again till I get to the record I am searching for. That’s essentially what indexes do in a DB.
That is a binary search!
Haha ‘half’ might have been a bad word to use, rather the emphasis should be on removing a subset of the data to eliminate potential possibilities. It’s easier to find a needle in a haystack if you know which section of the hay it isn’t in.