Developing a database. Part 1. Why may you need indexes and how does Hash index work.

I plan to write a series of posts about databases internals. In order to make it easily perceivable, I’ll be writing a NoSQL DB from scratch in Ruby. No doubts that it’s not the best fit for database development, but it’s extremely readable and will help us a lot. This one will be about why may you want to have an index and what is a Hash index.

UPD. I decided to not continue this series because it takes too much effort to investigate deep enough to explain, but it had got much fewer views and likes than more applicable ones. Probably will return to this topic once, but not now.
Continue reading

Chop-chop, MongoDB! Leveraging indexes power. Part 1

As you may know, PostgreSQL provides you four index types: B-tree, Hash, GiST and GIN. They all named the way that if you don’t know ’em you’ll never get which one do you need. In MongoDB indexes are named in a more human-readable way. Here they are:
1. Single field index.
2. Compound index.
3. Multikey index.
4. Text index.
5. Hashed index.
6. 2dsphere, 2d, geoHaystack indexes.

Since I’m using Mongo for more than a year now, I worked with few of them and will elucidate you the most commonly used ones.

Continue reading