An Overview of Database Indexing for Beginners
Too Long; Didn't Read
A database index allows a query to retrieve data from a database in an efficient manner. Indexing is a way to get an unordered table into an order that will maximize the efficiency when searching for a record. Indexes can be related to specific tables and consist of one or more keys. A table can have multiple indexes built from it. The database would have to search through all 17 records in the order they appear in the table, from top to bottom, one at a time, to look for all the potential instances of `company_id` as 18. This isn’t ideal and can be a problem when looking inside a database table with huge amount of data.