Relational Databases

Database Index

Say we want to look at the customer who has the largest amount. Such a operation is a linear time operation, and if they have distributed system and large databases, this operation can take some time. This is where database index become useful. The idea is that we can create an auxiliary datastructure in your database that can be optimized for fast searching on an attribute of the table. There are lot of types of databases - bitmap index, loose index, dense index, etc

For eg. create a database index with amount in ascending order. We could bring a linear operation to logarithmic time.

The trade off is that a axiliary database may take more space and whenever you update/insert data into the database, the database index also needs to be updated. Therefore the write operation is going to slower but read is going to be much faster.

Key-Value Store

We saw in the previous section that relational database along with SQL have very powerful quering capabilities. However, at some time, the very same structure can prove combuersome than useful, and in those cases we might want to use non-relational databases, aka non-sql database. One of the popular type of non-sql database is a key-value store. A key-value is what you see below:

	key     value
	___			_____
	foo     gool
	bar     systemexpert
	baz     1,2,3

They are incredembly flexible and simple, flexible as they dont have that imposed structure, and its simple from a conceptual standpoint.

Dynamic Configuration - Sometimes we want to have special parameters or constants in your systems that different parts of the system can rely on. We can have a key-value pair, for example, "is_alive":true which can be constant widely throughout the system.

Using Key-Value stores, we are accessing value directly through keys, therefore this results in lowered latencies and improves troughput.

Specialized Storage Paradigms

back