What is B tree Index ?| B Tree Index with industry examples

B tree Index :

In my previous article i have given the information about the bitmap index with real life examples.In this article i would like to give you information about B tree index with real life examples.User should know that Oracle should create B-tree index by default.B-tree indexes also known as balanced tree indexes.These are most common type of database index. The classic b-tree index structure,there are branches from the top that lead to leaf nodes that contains data.The B-tree structure is from branches to leaf nodes.

Where to use B-tree Indexes ?

So everyone have question in mind that where exactly we need to use the B tree index.The B-tree index is most used index used to improve the performance of any application or any sql query. The main use of B-tree index is to improve the performance of SQL Queries. I have given some examples of bitmap index and instructions about where to use the bitmap indexes. Just like that i would like to give you the information about some guidelines to use B-tree indexes :

1.Primary key tables :

The B-tree indexes are useful when there is primary key for the table.

2.Sorting is needed :

The B-tree index is used when sorting is needed for improving the performance of query.

Real life example :

I would like to give one example of sorting. The sorting is important in some of cases. Lets say Student table has joined with Student_master table and it is joined with Roll_No column.The Roll_No column is not sorted in the table.To apply sorting on that column kindly create b-tree index on that column so as to improve the performance.

Create index SI_Student_Roll_No

on Student(Roll_No);

Create index SI_Student_master_Roll_No

on Student_Master(Roll_No);

These two indexes gives the better performance as the sorting applied properly on it.

3.Range Searches :

The B-tree index is most useful in the range queries or range searches queries.

Real life example :

Lets say user need to fetch the report of Students from Student table where the admission is between 1st Jan 2018 to 31 Jan 2018.So User need to add index on date.

Sub Types of B-Tree Indexes :

In this section i would like to give you different types of B-tree index with some examples.

Type 1 : Index Organized Table :

The index organized tables are different from regular heap organized tables. In Index organized table the rows are stored in an index defined on primary key for that table.The Logical rowid will build the secondary indexes.

Type 2 : Reverse key index :

For some situations The bytes of index key are reversed.Example is 123 is stored as 321.The reverse key index is used to solve the problem of contention for leaf block and improves the performance.

Type 3 : Descending Index :

There are some situations where user needs the data in descending order. For these situations user needs to use B-tree indexes in descending order.The most important indexes used in BI reporting queries as lot of columns from the table in reporting needs descending order data.

Example :

Create index Desc_Student_Roll_No on Student (Roll_No Desc);


Type 4 : Clustered Index :

The another type of index named Clustered index which uses the cluster key for indexing.

These are four sub-types of B-tree indexes. I hope you get the idea about B-tree index in detail.kindly comment in comment section if you like this article or if you have any suggestions.

Amit S

Oracle Consultant with vast experience in Oracle BI and PL/SQL Development. Amiet is the admin head of this website who contributes by preparing tutorials and articles related to database technologies. He is responsible to manage the content and front-end of the website.

Recent Posts

The Essential Guide to Cryptocurrency Exchange Platform Development for Beginners and Beyond

Introduction Cryptocurrencies took the world by storm, setting up a new financial system and breaking…

5 months ago

Top 20 System Administrator Interview Questions and answers

In my previous article I have given Top 20 technical support interview questions with its…

8 months ago

Desktop Support Scenario Based Interview Questions

In my previous articles I have given 15 most asked desktop support interview questions with…

8 months ago

How Do Business Analysts Use SQL for Their Needs?

A business analyst is someone who is versed in processes of data analysis used for…

8 months ago

Top 15 Control-M Interview Questions with Answers

In my previous article I have already given top questions and answers for Desktop support…

8 months ago

Top 20 SQL Interview Questions for Production Support

In my previous article I have given unix production support interview questions and answers. In…

8 months ago