January 30, 2018
If you think of any sort of application or online service, you are interacting with information. You might be responding to information (❤️ liking, 💬 commenting) or entering your own information (✍️ 🌅 posting).
All of this information, your posts, the fact that you like something, your comment, or even your view, gets stored in a database.
This information has to become a form digital devices can understand. It has to become data. Data is a binary representation of information, which usually means converting it into a series of numbers, and then those numbers into the famous ones and zeros.
Different types of data have a different representation. Whole numbers have one. Depending on the range you wish to store, you might have more binary ones-and-zeros set aside or less. Or you might decide negative numbers are unnecessary — e.g. when did you see a post get negative 5 comments? That decision leaves headroom for further positive numbers.
Text has standardisations (Unicode) that aims to cover the world’s written languages, from Finish to emoji. These standards basically translate enormous international alphabets into a series of numbers. And those then become ones-and-zeros like any number.
Information that is more than text, such as photos, audio, and video, each have their own specialized representations. Each one converted into data usually tallies in the thousands or millions of numbers, so these are often stored outside of the main database, and instead get their own specialised home equipped for data of that size.
A database not only stores data. It allows it to be found again. This is a process called ‘indexing’. As new data is added, certain desired-to-be-searched elements get extracted and collated into one or more indexes.
An index is just like one in the back of a book. It cuts through the masses of information and copies the essential pieces into sorted lists, where it can be quickly flipped through just like you would with a dictionary or phone book, tracing your finger quickly through the alphabet to find the first letter, and gradually slowing down with the next letter and so forth until you found your exact target.
The found entry in the index would tell you which page to turn to, where you would find the full set of information. A database index works the same way, and it’s up to the database manager to determine which elements to index.
Written by Patrick Smith who lives and works in Melbourne.
He posts about development & design on Twitter