Indexing structures for files Flashcards

1
Q

What is the importance of indexing

A

Indexes, or access structures, are used to speed up access to desired data. – E.g., author catalog in library

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

Define a search key

A

attribute or set of attributes used to look up records in a file.

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

Define and illustrate an index file

A

The index file is a table of <key, block_pointer> pairs.
* These are called the index entries and recap the ordering key of the first record of their pointed-to block.
*See page 5 for illustration
Index files are typically much smaller than the original file

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

How are indexes stored

A

They’re stored on disk just like the main data file, and provide other access paths that can be quicker for certain operations on certain fields.
The index file usually occupies considerably less disk blocks than the data file because its entries are much smaller

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

How are indexes created

A

Any field (or combination of fields) can be used to create an index, but there will be different index types depending on whether the field is a key
(unique), and whether the main file is sorted by it or not.
* There can be multiple indexes on one file.

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

Give one advantage and disadvantage of indexes

A

Indexes speed up access on the indexed field, but slow down updates— almost every update on the main table must also update every index.

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

Describe dense and sparse indexes

A
  • A dense index has an index entry for every search key value (and hence every record) in the data file.
  • A sparse (or nondense) index, on the other hand, has index entries for only some of the search values
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Illustrate dense indexing

A

Index records contain search key value and a pointer to the actual record on the disk.
*See page 8 for illustration

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

What is an advantage and disadvantage of dense indexing

A

There is an index record for every search key value
in the database.
* This makes searching faster but requires more space to store index records itself

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

Illustrate sparse indexing

A

It is an index record that appears for only some of the values in the file.

*See page 9

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

What are the Types of Single-Level Ordered Indexes

A

Primary Indexes
Clustering Index
Secondary Index

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

What is an anchor record

A

The first record of each block

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

How is a record retrieved using primary indexes

A

To retrieve a record given its ordering key value using the index, the system does a binary search in the index file to find the index entry whose key value is ≤ the goal key’s value, then retrieves the pointed-to block from the original file

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

What is a primary index

A

An index on the ordering key (often primary key) of a sorted file.

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

Do the example on page 12-14

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

What are the problems with primary indexing

A

i. Inserting and deleting records in the main file must move other records, since it’s ordered.
ii. Some insertions/deletions must also change index entries, if the anchor records change.
iii. There can be only one primary index on a file.

17
Q

Describe clustering indexing

A

It is a non-dense index
Defined on an ordered data file
Includes one index entry for each distinct value of the field; the index entry points to the first data block that contains records with that field value.
*See page 17 and 18 for example

18
Q

What is the difference between clustering indexing and primary indexing

A

In clustering indexing the data file is ordered on a non-key field unlike primary index, which requires that the ordering field of the data file have a distinct value for each record.

19
Q

Describe a secondary index

A

Includes one entry for each record in the data file; hence, it is a dense index
A secondary index provides a secondary means of accessing a file for which some primary access already exists.
The secondary index may be on a field which is a candidate key and has a unique value in every record, or a nonkey with duplicate values.

*See page 20

20
Q

Describe the two fields a secondary index may have

A

i. The first field is of the same data type as some non-ordering field of the data file that is an indexing field.
ii. The second field is either a block pointer or a record pointer. There can be many secondary indexes (and hence, indexing fields) for the same file.

21
Q

Provide a summary of single indexes highlighting the number of index entries, whether it is dense or non-dense and whether it uses block anchoring

A

*See page 21

22
Q

Do the questions in the file called multiindexing exercise in downloads

A