Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a SQL Server index B-tree a flat structure or a depth structure

I was asked this question on the interview a few minutes ago and I didnt know the answer. I answered it logically thinking that a B-Tree is always a depth structure because it has multiple levels. Was I right on my answer? What would be the best way to answer this question?

like image 569
rvphx Avatar asked Apr 18 '12 16:04

rvphx


People also ask

What is B-Tree index in SQL Server?

The B-Tree structure provides the SQL Server Engine with a fast way to move through the table rows based on index key, that decides to navigate let or right, to retrieve the requested values directly, without scanning all the underlying table rows.

What are the two types of table structures in SQL Server?

As you can see from the previous image, the data pages for the SQL Server table can be organized within each partition in two ways: in Heap or B-Tree Clustered tables.

What is an index structure?

1 Basic structure of an index. An index consists of a key and key values. A key is the column name of an indexed column. The values in the column are called the key values. Creating an index for a column that will be used as the basis for retrievals from the table will improve the table's retrieval performance.


2 Answers

B-tree hence the name will be a tree or depth structure.

like image 44
Kuberchaun Avatar answered Nov 15 '22 00:11

Kuberchaun


Yes, you were right in both your answer and your reasoning. A tree is never a flat structure. An example of a flat structure would be a single dimension array.

like image 158
Yuck Avatar answered Nov 15 '22 00:11

Yuck