Flip to the back of any thick textbook and you will find an index: a list of terms with page numbers, sorted alphabetically so you never have to read the whole book to find one fact. Databases face the same problem at a much bigger scale. A table with a few million rows cannot be scanned row by row every time someone runs a query. The solution borrows the same idea as the book index, except it is built using specific data structures designed to make searching, sorting, and retrieving records almost instant.

Table of Contents

Why databases need an index in the first place

Without an index, a database has only one option when you ask for a specific record: check every single row until it finds a match. This is called a full table scan, and it works fine for a few hundred records. It becomes painfully slow once a table holds millions of rows, because every lookup means reading data from disk, and disk access is far slower than reading from memory.

An index solves this by creating a separate, compact structure that stores the values of a chosen column along with a pointer to where the full record actually lives. Instead of scanning the whole table, the database searches this smaller, organised structure first and jumps straight to the right location. This structure is essentially a lookup table, built once and then maintained automatically as data changes.

Inside the B-tree: the default indexing engine

Most relational databases, including MySQL, PostgreSQL, Oracle and SQL Server, use a data structure called the B-tree as their default index type. The name stands for balanced tree, and that single word explains most of its value.

How a B-tree finds a record

A B-tree organises index entries into nodes, each holding several keys arranged in sorted order. A search starts at the root node and compares the target value against the keys stored there. Based on that comparison, the search moves down to the correct branch, skipping every other branch entirely. Each node is typically sized to match a disk page, which means one node can hold dozens or hundreds of keys, and very few disk reads are needed to reach the answer.

Why balance keeps searches fast

Every leaf in a B-tree sits at exactly the same depth from the root. This balance guarantees that a search, insertion, or deletion takes roughly the same number of steps no matter which record is being looked for. Real-world indexes holding millions of records typically need a tree depth of only four or five levels to reach any record, which is why B-tree lookups feel instantaneous even on huge tables. The technical term for this efficiency is logarithmic time complexity, written as O(log n): as the table grows from a thousand rows to a billion, the number of steps needed to find a record grows extremely slowly in comparison.

B-trees have one more advantage that makes them the default choice: because the keys are stored in sorted order, they handle range queries naturally. A request for โ€œall orders placed between two datesโ€ or โ€œall salaries above a certain amountโ€ can be answered by walking along the sorted keys, something a purely random structure cannot do.

Hash indexes: built for speed, not for range

Not every query needs sorted data. Sometimes a system only needs to check whether a value matches exactly, such as looking up a user by their unique ID. For this narrow but common case, some databases offer a hash index.

A hash index runs the indexed value through a hash function, which converts it into a fixed location in a table of โ€œbuckets.โ€ Hash indexing works best for equality comparisons and is not suited to range queries or partial matches. Because there is no scanning or comparing involved, an exact-match lookup can be resolved in constant time, regardless of how large the table grows.

The trade-off is flexibility. A hash index cannot answer โ€œgreater than,โ€ โ€œless than,โ€ or โ€œstarts withโ€ queries, because hashed values carry no information about their original order. Two very different values can also produce the same hash location, known as a collision, which the database has to resolve using additional logic, adding a small amount of overhead.

Feature B-tree index Hash index
Best suited for Range queries, sorting, general use Exact match (equality) queries only
Search speed O(log n) O(1) on average
Handles range queries Yes No
Common in Most relational databases by default Specific columns with equality-only lookups

Organising indexes: primary, secondary and clustered structures

Beyond the underlying data structure, indexes are also classified by how they relate to the actual table data.

Primary index: This is built automatically on the tableโ€™s primary key. It usually determines the physical order in which rows are stored on disk, which is why it is also called a clustered index.

Clustered index: A table can have only one clustered index, since data can physically exist in only one order at a time. Because it defines the actual arrangement of rows on disk, this index type is especially efficient for range-based queries, such as pulling all transactions from a particular month.

Secondary index: Built on any column other than the primary key, a secondary index does not change how rows are physically stored. Instead, it keeps its own sorted structure of values with pointers back to the original rows. A table can have several secondary indexes, letting the same data be searched efficiently by different attributes, such as email, city, or department.

This layered approach mirrors how a well-run office keeps multiple indexes for the same set of files: one by employee ID for payroll, another by department for administration, and another by date for audits. The underlying records do not move; only the lookup structure changes.

The trade-off no index escapes

Indexes are not free. Every index consumes additional storage space, since it duplicates the indexed columnโ€™s values alongside pointers to the original data. More importantly, every insert, update, or delete on the table has to update every index built on it, which slows down write operations. A B-tree simplifies the binary search tree by allowing each node to hold more than two children, which keeps the structure shallow, but the database still has to do real work to keep that structure balanced after every change.

This is why database administrators do not index every column. The general rule is to index columns that are frequently searched, filtered, or joined on, while leaving rarely queried columns unindexed. A table with too many indexes can end up slower overall, because the cost of maintaining them during writes outweighs the benefit during reads.

Why this matters beyond the exam

Indexing is not just database theory; it is the invisible engine behind almost every digital records system used in modern offices, from HR management software to e-commerce order tracking. When a company handles thousands of customer records, invoices, or employee files digitally, the speed at which a clerk or manager can retrieve a specific record depends entirely on how well that underlying data is indexed. Understanding the logic behind indexing data structures helps in appreciating why some office software feels instant while poorly designed systems feel sluggish as data grows.

What do you think? If you were designing a records system for a growing organisation, which columns would you choose to index first, and why? Can you think of examples where a range-friendly B-tree index would work better than a fast but rigid hash index?

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

References
  1. https://www.tutorialspoint.com/dbms/dbms_indexing.htm
  2. https://planetscale.com/blog/btrees-and-database-indexes
  3. https://use-the-index-luke.com/sql/anatomy/the-tree
  4. https://www.geeksforgeeks.org/dbms/difference-between-indexing-techniques-in-dbms/
  5. https://www.jaroeducation.com/blog/indexing-in-dbms-explained
  6. https://builtin.com/data-science/b-tree-index

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Office Management and Secretarial Practice

1 About the Office

  1. Meaning of Office
  2. Office Layout
  3. Office Location
  4. Office Procedures
  5. Role of A Company Office
  6. Equipments & Skills Used in Offices
  7. Types of Offices

2 Office Space & Virtual Space

  1. Meaning of Office Space
  2. Virtual Office
  3. Advantages of Virtual Office
  4. Disadvantages of Virtual Office
  5. Hybrid Office
  6. Differences Between Virtual Office and Physical Office
  7. Virtual Meeting Space
  8. Work From Home (WFH) Culture
  9. Future Trends in the Office Environment

3 Office Etiquette

  1. Meaning of Etiquette
  2. What is Office Etiquette?
  3. Need and Importance of Office Etiquette
  4. Doโ€™s and Donโ€™ts of Office Etiquette
  5. Case Study on Office Etiquette: Internet Surfing At Work

4 Organising an Office

  1. Office Organization
  2. Importance of Office Organization
  3. Forms and Types of Organizations
  4. Line Organization
  5. Functional Organization
  6. Line and Staff Organization
  7. Committee Organization
  8. Centralization and Decentralization
  9. Measuring the Degree of Decentralization
  10. Factors Affecting Decentralization
  11. Difference Between Delegation and Decentralization
  12. Difference Between Centralization and Decentralization

5 Office Management

  1. Objectives of Office Management
  2. Importance of Office Management
  3. Functions of Office Management
  4. Planning
  5. Organizing
  6. Coordinating
  7. Controlling
  8. Activities of Office

6 Duties and Responsibilities of Office Manager

  1. Roles of Office Manager
  2. Duties of Office Manager
  3. Qualities of a Good Office Manager
  4. Functions of Office Manager
  5. Skills Required to be an Office Manager

7 Filing of Documents

  1. Meaning and Importance of Filing
  2. Essentials of Good Filing System
  3. Office Filing Procedure
  4. Centralized v/s Decentralized Filing
  5. System of Classification
  6. Concept of Paperless Office Methods of Filing
  7. Steps of Filing Procedure
  8. Digitalization and Retrieval of Records
  9. Weeding of Old Records

8 Indexing Documents

  1. Meaning of Indexing
  2. Significance of Indexing
  3. Essentials of a Good Indexing System
  4. Advantages of a Good Indexing System
  5. Types of Indexing
  6. Choice of a Suitable Index System
  7. Impact of Indexing in Office Management
  8. Indexing Data Structure
  9. Indexing Websites at Search Engines

9 Publishing Documents

  1. Meaning of Publishing
  2. Publishing Platforms
  3. Digital Publishing Platform
  4. Social Media Platform
  5. Content Publishing Platform
  6. Published Annual Reports
  7. Portable Digital File (PDF)
  8. Conversion of Document to Word/PDF/JPG
  9. Animated Publishing in a Multimedia Format

10 Office Forms

  1. Meaning and Significance of Office Forms
  2. Designing of Office Forms
  3. Forms used in an Office
  4. Internal Office Forms
  5. External Contract Forms
  6. Different Types of Fields
  7. Advantages and Disadvantages of using Forms
  8. Form Control

11 Office Stationery

  1. Types of Stationery Used in Office
  2. Importance of Managing Stationery
  3. Selection of Stationery
  4. Essential Requirements for a Good System of Dealing with Stationery
  5. Purchasing Principles
  6. Purchase Procedure
  7. Standardization of Stationery

12 Mailing Procedures

  1. Meaning and Importance of Mail
  2. Centralization of Mail Handling Work
  3. Mail Room Equipment and Accessories
  4. Postal Franking Machine
  5. Mailing through Posts/ Couriers/ Emails
  6. Appending Files with Emails
  7. Inward and Outward Mails

13 Modern office Equipments

  1. Office Equipment
  2. Modern Office Equipment
  3. Office Automation
  4. Office Mechanization
  5. Kinds of Office Machines
  6. Factors in Selecting Office Machines

14 Modern Office System

  1. Technological Communication
  2. Meaning of Web-Conferencing
  3. Easy, Effective and Reliable Video Solutions for Any Meeting Space
  4. Modern Enterprises Video Communication
  5. Office System and Automation
  6. E-Gov Office Automation
  7. System Automation
  8. e-Office Software Office Automation Software
  9. Technology Internet and Cloud used in office
  10. Smart Cloud Based Office Solutions
  11. Benefits and Drawbacks of Cloud Computing
  12. Cloud Storage
  13. Role of Cloud Computing
  14. Impact of IoT in Cloud
  15. Different Types of Cloud Computing and Their Benefits

15 Banking Facilities and Modes of Payment

  1. Types of Accounts
  2. Passbook and Cheque Book
  3. Other Forms Used in Banks
  4. Online Banking
  5. Types of Payments

16 Budget

  1. Budget
  2. Annual Budget
  3. Revised Budget
  4. Estimated Budget
  5. Structure of Budget
  6. Purpose of Budget
  7. Salient Features of Budget
  8. Types of Budgets
  9. Advantages of Budget
  10. Limitations of Budget
  11. Process of Preparing the Budget
  12. Heads of Expenditure

17 Audit

  1. Audit
  2. Importance of Audit
  3. Types of Audits
  4. Vouching
  5. Verification of Assets and liabilities
  6. Difference between Vouching and Verification
  7. Consumable/Stock register
  8. Asset Register

18 Nature and Scope of Secretarial Work

  1. Definition of the Secretary
  2. Importance of a Secretary
  3. Role of a Secretary
  4. Duties of a Secretary
  5. Qualifications of a Secretary
  6. Importance of Secretarial Work
  7. Types of Secretaries
  8. Private Secretary

19 Secretarial Functions in Organisation

  1. Secretary of an Association or a Club
  2. Secretary of a Co-operative Society
  3. Secretary of a Local Body
  4. Secretary of a Government Department

20 General Principle of Meetings

  1. What is a Meeting?
  2. Classification of Meetings
  3. Requisites of a Valid Meeting
  4. Rules Governing Meetings
  5. Preparation for and Conduct of Meetings
  6. Role of Chairman: His Powers and Duties

21 Conduct of Meeting

  1. Rules Governing Discussion and Debate in Meetings
  2. Order of Business
  3. Motions, Amendments and Resolutions
  4. Voting Procedures and Methods
  5. Minutes of Meetings
  6. Duties of Secretary