Newby Coder header banner

Index

What is an Index

An index is a key associated with a value (like page numbers of a book), or a set of keys in case of databases

Index of an Array

When data objects are stored in an array, then individual objects are retrieved by the index assigned to them, that is usually a non-negative integer

An index maps the array value to a stored object

In many programming languages, index of an array starts from 0

Typically value of an array can be accessed with its index between square brackets []

numbers = [10, 32, 35, 66, 89]
print("element at index 3 is :", numbers[3])

Above python code declares a list and displays value of its element whose index is 3

Its output is

element at index 3 is : 66

Database Index

A list of keys (or keywords), each of which identifies a unique record

An index is a copy of selected column(s) of data from a table each of which can be linked to the complete row of data it was copied from

Indices make it faster to find specific records and to sort records by the index field -- that is, the field used to identify each record

For example, in a table containing data for customers, index can be created on email address column of the table

Indexing

Indexing is the process of creating an index on one or more columns

One common type of indexing is called "search engine indexing" which involves aggregating and interpreting search engine data, to ease data retrieval

This type of indexing is also sometimes called Web indexing

Without an index, the search engine has to search every document for a query, whereas with an index, much of this work is eliminated