4: Indexes and Trees Flashcards

1
Q

What do indexes do?

A

They enhance the operational speed of queries, especially when there are very large numbers of tuples involved.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why can the selection of an appropriate index enhance or reduce the performance of the DB ?

A

Because relations - stored over many pages - have to be bought to the main memory, and the cost of querying and modifying is significant.

Furthermore, the index itself has to be stored and updated appropriately with the relation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What types of index are available ?

A
  • Clustering index
  • Hash index
  • Multi-level index
  • B-Tree
  • B+Tree
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which indexes are the most commonly used and why?

A

B+/-Trees, as they are the most cost-efficient in terms of the number of I/O operations they use, and are pretty straightforward to modify.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What’s the key difference between B+ and B- Tree?

A

B-Tree can point to records at any level in the tree.

B+ points to records from its leaf nodes (more efficient).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a ‘balanced’ tree?

A

All paths from root to leaf node are the same length and have few I/Os, and therefore have a low cost.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How many additional index levels can speed up query processing, before B+tree is preferable?

A

Only one or two, as I/O costs may increase as extra levels are added in a multi-level environment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a clustering index?

A

The index is ordered on a non-key field.

The records in the file may be physically ordered on a non-key field that does not have distinct values (not a primary nor candidate key).

This key is called a ‘clustering field’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is a clustering index ordered?

A

It’s an ordered file with 2 fields:

  • A field with the same type as the clustering field on file
  • A field with a pointer to the record with that clustering field.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If your search for a record that requires the use of more than one index – identify the index-type in use ?

A

Multi-level

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The B-tree (and B+-tree) structure can be identified as having three levels:

  • Root Level
  • Intermediate Level
  • Leaf Level.

If the record you are searching for is pointed to from an intermediate node, which type of tree is being used?

A

B-Tree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If the relation is ordered on a non-key field (that has duplicate values allowed), which index type is usually associated with this implementation?

A

Clustering

How well did you know this?
1
Not at all
2
3
4
5
Perfectly