Quiz 2 - Indexing Flashcards

1
Q

table scan

A
  • a sequential scan of the table
  • each row is examined for inclusion in result
  • it is the simplest and slowest for of search
  • performance is benchmarked against table scan
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Advantages of indexing

A
  • index is alphabetically sorted, therefore faster
  • index is much smaller than table
  • only load needed pages, instead of all of them
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

index

A
  • index is built for a column in a table
  • a table can have more than one index
  • each index entry has a search key and a pointer
  • all indexes are sorted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

search key

A
  • value of an attribute in the column being indexed

* part of an index entry

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

pointer

A
  • physical memory location where a record is stored

* part of an index entry

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

ordered index

A
  • table is sorted according to value in the indexed column
  • each search key can have only one occurrence in the index
  • index points to the first occurrence in the table
  • also known as a primary or clustered index
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

hash index

A
  • index is sorted, but table is not
  • one index record for EVERY table record
  • each search key may have multiple occurences in the index
  • a hash index is always dense
  • also known as a secondary or non-clustered index
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

primary index

A

another name for ordered index

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

clustered index

A

another name for ordered index

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

secondary index

A

another name for hash index

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

non-clustered index

A

another name for hash index

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

types of ordered indices

A
  • dense

* sparse

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

dense index

A
  • table sorted by indexed column
  • each search key key MUST have one and only one index record
  • a type of ordered or hash index
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

sparse index

A
  • table is sorted by indexed column
  • there is an index record for only SOME of the search keys
  • each search key can have, at most, one index record
  • a type of ordered index only
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

impact to ordered index: INSERT

A

• update location values in index
• if new search key value inserted, then new record inserted to index

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

impact to ordered index: UPDATE

A
  • equivalent to INSERT+DELETE if indexed column value is changed
  • INSERT record with updated/new value
  • DELETE record with old value
17
Q

impact to ordered index: DELETE

A
  • remove record from page
  • move up following records on that page
  • if required, delete entry from index and update locations of records moved up on that page
18
Q

impact to hash index: INSERT / UPDATE / DELETE

A

• only requirement is to update index

19
Q

ordered index vs. hash index

A
  • hash index has same number of rows as the table indexed—index search takes longer
  • same values may not be in adjacent locations in a hash index
20
Q

multilevel indexing

A
  • done when an index is too large for efficient processing
  • an index is built for an index
  • outer index is always an ordered sparse index
21
Q

multilevel index structure

A
  • root node index – ordered sparse
  • intermediate level index – ordered or hash
  • leaf nodes / data pages – table data
22
Q

What should be indexed?

A
  • attribute most frequently used to search for records usually determines the primary index
  • DBMS default sets PK as ordered index, but DBA / designer may change
  • one column must be a primary index
  • other attributes very frequently used for searching determine secondary indexes
23
Q

composite index

A
  • index using more than one column
  • determined using analysis of queries
  • allows location of records using a single index instead of two
24
Q

indexing factors to consider

A
  • access type - specific values vs. a range of values
  • access time - time to search and find
  • insertion time - to insert new data + update index
  • deletion time - to delete data + update index
25
Q

effective table indexing

A
  • create effective clustered index
  • keep index keys small
  • only index selective columns
  • make sure left-most column is selective
  • verify results and monitor performance over time