Data Storage Flashcards

1
Q

Speed is measured as blank and blank

A

access time and transfer rate

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

Blank is the time required to access the first byte in a read or write operation.

A

Access time

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

Blank is the speed at which data is read or written, following initial access.

A

Transfer rate

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

Blank typically ranges from pennies to dollars per gigabyte of memory, depending on the media type.

A

Cost

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

In principle, any media type can store any amount of data. In practice, blank is limited by cost.

A

capacity

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

Blank is memory that is lost when disconnected from power.

A

Volatile memory

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

Blank is retained without power.

A

Non-volatile memory

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

Computer media vary on what four important dimensions:

A

Speed.
Cost.
Capacity.
Volatility.

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

Three types of media are most important for database management:
Name them

A

Main memory, also called random-access memory (RAM)
Flash memory, also called solid-state drive (SSD)
Magnetic disk, also called hard-disk drive (HDD),

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

Blank, also called random-access memory (RAM), is the primary memory used when computer programs execute. Blank is fast, expensive, and has limited capacity.

A

Main Memory

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

Blank, also called solid-state drive (SSD), is less expensive and higher capacity than main memory. Writes to blank are much slower than reads, and both are much slower than main memory writes and reads.

A

Flash memory

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

Blank, also called hard-disk drive (HDD), is used to store large amounts of data. Blank is slower, less expensive, and higher capacity than flash memory.

A

Magnetic Disk

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

Main memory is blank

A

volatile

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

Flash memory and magnetic disk are blank and therefore considered blank

A

non-volatile
storage media

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

Databases store data permanently on blank and transfer data to and from blank during program execution.

A

storage media
main memory

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

Main memory has an access time of blank microseconds, transfer rate of blank, cost per gb of blank, and is blank

A

.01 to .1
>10
>1
Volatile

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

Flash memory has an access time or blank microseconds , transfer rate of blank gb/sec, cost per gb of blank, and is blank

A

20 to 100
.5 to 3
around .25
Non-volatile

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

Magnetic disk has an access time or blank microseconds , transfer rate of blank gb/sec, cost per gb of blank, and is blank

A

5,000 to 10,000
.05 to .2
around .02
Non-volatile

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

What type of memory - Reading one gigabyte takes about one second.

A

Flash memory

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

what type of memory - Used to store petabytes (millions of gigabytes) of user data in the cloud.

A

Magnetic disk

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

What type of memory - Upgrading from 16 to 32 gigabytes costs an extra $400 for an Apple laptop computer.

A

Main memory

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

Magnetic disk groups data in black, traditionally 512 bytes per sector but 4 kilobytes with newer disk formats.

A

sectors

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

Flash memory groups data in blank, usually between 2 kilobytes and 16 kilobytes per page.

A

pages

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

Databases and file systems use a uniform size, called a blank, when transferring data between main memory and storage media

A

block

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

Blank is independent of storage media.

A

Block size

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

Storage media are managed by blank, which convert between blocks and sectors or pages. This conversion is internal to the storage device, so the database is unaware of page and sector sizes.

A

controllers

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

Blank must be uniform within a database but, in most database systems, can be specified by the database administrator

A

Block size

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

Database systems typically support block sizes ranging from blank to blank

A

2 kilobytes to 64 kilobytes.

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

Smaller block sizes are usually better for blank, which access a few rows per query.

A

transactional applications

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

Larger block sizes are usually better for blank, which access many rows per query.

A

analytic applications

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

Accessing storage media is relatively slow. Since data is transferred to and from storage media in blocks, databases attempt to minimize the number of blocks required for blank.

A

common queries

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

Most relational databases are optimized for blank, which often read and write individual rows.

A

transactional applications

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

To minimize block transfers, relational databases usually store an entire row within one block, which is called blank.

A

row-oriented storage

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

Row-oriented storage performs best when row size is small relative to block size, for what two reasons:

A

Improved query performance.
Less wasted storage.

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

When row size is small relative to block size, each block contains many blank. Queries that read and write multiple rows transfer fewer blocks, resulting in better performance.

A

rows

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

Row-oriented storage wastes blank per block, since rows do not usually fit evenly into the available space. The wasted space is less than the row size. If row size is small relative to block size, this wasted space is insignificant.

A

a few bytes

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

Database administrators might specify a blank for databases containing larger rows.

A

larger block size

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

Sometimes a table contains a very large column, such as 1 megabyte documents or 10 megabyte images. For tables with large columns, each row usually contains a blank to the large column, which is stored in a different area.

A

link

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

In blank, also called columnar storage, each block stores values for a single column only.

A

column-oriented storage

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

Column-oriented storage benefits analytic applications in what two ways

A

Faster data access.
Better data compression.

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

More column values are transferred per block, reducing time to blank.

A

access storage media

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

Databases often apply blank when storing data.

A

data compression algorithms

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

Data compression is usually more effective when all values have blank. As a result, more values are stored per block, which reduces storage and access time.

A

same data type

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

With column-oriented storage, reading or writing an entire row requires blank. Consequently, column-oriented storage is a poor design for most transactional applications.

A

accessing multiple blocks

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

PostgreSQL and Vertica are examples of relational databases that support blank. Many NoSQL databases, described elsewhere in this material, are optimized for analytic applications and use column-oriented storage.

A

column-oriented storage

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

A blank is a scheme for organizing rows in blocks on storage media.

A

table structure

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

Databases commonly support four alternative table structures. Name them

A

Heap table
Sorted table
Hash table
Table cluster

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

Each table in a database can have a blank. Databases assign a default structure to all tables. Database administrators can override the default structure to optimize performance for specific queries.

A

Different structure

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

In a heap table, no order is imposed on blank.

A

rows

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

The database maintains a list of blocks assigned to the table, along with the address of the first available space for inserts. If all blocks are full, the database allocates a blank and inserts rows in it.

A

new block

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

When a row is deleted, the space occupied by the row is marked as blank. Typically, blank space is tracked as a linked list, as in the animation below. Inserts are stored in the first space in the list, and the head of the list is set to the next space.

A

free

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

Heap tables optimize blank operations.

A

insert

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

Heap tables are particularly fast for blank of many rows, since rows are stored in load order.

A

bulk load

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

Heap tables are not optimal for queries that read rows in a blank, such as a range of primary key values, since rows are scattered randomly across storage media.

A

specific order

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

In a sorted table, the database designer identifies a blank that determines physical row order

A

sort column

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

The sort column is usually the blank but can be a non-key column or group of columns.

A

primary key

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

Rows are assigned to blocks according to the blank of the sort column. Each block contains all rows with values in a given range. Within each block, rows are located in order of sort column values.

A

value

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

Blank are optimal for queries that read data in order of the sort column, such as:

JOIN on the sort column
SELECT with range of sort column values in the WHERE clause
SELECT with ORDER BY the sort column

A

Sorted tables

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

Maintaining correct sort order of rows within each block can be slow. When a new row is inserted or when the sort column of an existing row is updated, free space may not be available in the correct location. To maintain the correct order efficiently, databases maintain pointers to the next row within each block, as in the animation below. With this technique, inserts and updates change blank rather than move entire rows.

A

two address values

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

When an attempt is made to insert a row into a full block, the block splits in two. The database moves half the rows from the blank to a new block, creating space for the insert.

A

initial block

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

Sorted tables are optimized for blank at the expense of insert and update operations.

A

read queries

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

In a blank, rows are assigned to buckets

A

hash table

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

A blank is a block or group of blocks containing rows.

A

bucket

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

Initially, each bucket has one block. As a table grows, some buckets eventually fill up with rows, and the database allocates additional blocks. New blocks are blank to the initial block, and the bucket becomes a chain of linked blocks.

A

linked

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

The bucket containing each row is determined by a blank function and a blank key.

A

hash

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

The blank is a column or group of columns, usually the primary key.

A

hash key

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

The blank computes the bucket containing the row from the hash key.

A

hash function

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

Blank are designed to scramble row locations and evenly distribute rows across blocks

A

Hash functions

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

The blank is a simple hash function with four steps:

A

modulo function

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

Name the four steps of the modulo function

A

1) Convert the hash key by interpreting the key’s bits as an integer value.
2) Divide the integer by the number of buckets.
3) Interpret the division remainder as the bucket number.
4) Convert the bucket number to the physical address of the block containing the row.

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

As tables grow, a blank allocates more rows to each bucket, creating deep buckets consisting of long chains of linked blocks.

A

fixed hash function

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

Blank are inefficient since a query may read several blocks to access a single row. To avoid deep buckets, databases may use dynamic hash functions

A

Deep buckets

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

A blank automatically allocates more blocks to the table, creates additional buckets, and distributes rows across all buckets. With more buckets, fewer rows are assigned to each bucket and, on average, buckets contain fewer linked blocks.

A

dynamic hash function

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

Blank are optimal for inserts and deletes of individual rows, since row location is quickly determined from the hash key.

A

Hash tables

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

Hash tables are optimal for selecting a single row when the hash key value is specified in the blank. Hash tables are slow on queries that select many rows with a range of values, since rows are randomly distributed across many blocks.

A

WHERE clause

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

Blank, also called multi-tables, interleave rows of two or more tables in the same storage area.

A

Table clusters

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

Table clusters have a blank, a column that is available in all interleaved tables.

A

cluster key

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

The cluster key determines the order in which rows are interleaved. Rows with the same cluster key value are stored together. Usually the cluster key is the blank of one table and the corresponding blank of another,

A

primary key
foreign key

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

Table clusters are optimal when blank interleaved tables on the cluster key, since physical row location is the same as output order.

A

joining

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

Table clusters perform poorly for many other queries. Name them.

A

Join on columns other than cluster key.
Read multiple rows of a single table.
Update cluster key.

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

A blank is a file containing column values, along with pointers to rows containing the column value. The pointer identifies the block containing the row.

A

single-level index

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

In some indexes, the pointer also identifies the blank of the row within the block

A

exact location

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

Indexes are created by database designers with the blank command.

A

CREATE INDEX

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

Single-level indexes are normally sorted on the blank.

A

column value

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

A sorted index is not the same as an index on a sorted blank.

A

table

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

If an indexed column is blank, the index has one entry for each column value.

A

unique

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

If an indexed column is not unique, the index may have blank for some column values, or one entry for each column value, followed by multiple pointers.

A

multiple entries

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

An index is usually defined on a single column, but an index can be defined on blank.

A

multiple columns

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

In a blank, each index entry is a composite of values from all indexed columns. In all other respects, blank behave exactly like indexes on a single column.

A

multi-column index

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

To execute a SELECT query, the database can perform a blank scan or an blank scan

A

table
index

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

A blank is a database operation that reads table blocks directly, without accessing an index.

A

Table scan

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

An blank is a database operation that reads index blocks sequentially, in order to locate the needed table blocks.

A

index scan

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

Blank, also called filter factor or selectivity, is the percentage of table rows selected by a query.

A

Hit ratio

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

When a SELECT query is executed, the database examines the WHERE clause and estimates hit ratio. If hit ratio is high, the database performs a blank.

A

table scan

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

When a SELECT query is executed, the database examines the WHERE clause and estimates hit ratio. If hit ratio is low, the query needs only a few table blocks, so a table scan would be inefficient. Instead, the database does what four things:

A

Looks for an indexed column in the WHERE clause.
Scans the index.
Finds values that match the WHERE clause.
Reads the corresponding table blocks.

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

If the WHERE clause does not contain an blank, the database must perform a table scan.

A

indexed column

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

Since a column value and pointer occupy less space than an entire row, an index requires fewer blocks than a table. Consequently, index scans are blank than table scans.

A

much faster

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

In some cases, indexes are small enough to reside in blank, and index scan time is insignificant. When hit ratio is low, additional time to read the table blocks containing selected rows is insignificant.

A

main memory

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

If a single-level index is sorted, each value can be located with a blank.

A

binary search

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

In a binary search, the database repeatedly splits the index blank until it finds the entry containing the search value.

A

in two

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

How does the binary search work? Four steps

A

The database first compares the search value to an entry in the middle of the index.

If the search value is less than the entry value, the search value is in the first half of the index. If not, the search value is in the second half.

The database now compares the search value to the entry in the middle of the selected half, to narrow the search to one quarter of the index.

The database continues in this manner until it finds the index block containing the search value.

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

For an index with N blocks, a binary search reads blank, rounded up to the nearest integer

A

log2 N blocks

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

Indexes on a sorted table may be blank or blank

A

primary or secondary

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

A blank, also called a clustering index, is an index on a sort column.

A

primary index

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

A blank, also called a nonclustering index, is an index that is not on the sort column.

A

secondary index

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

A sorted table can have only one sort column, and therefore only one blank.

A

primary index

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

Usually, the blank is on the primary key column(s).

A

primary index

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

In some database systems, the blank may be created on any column.

A

primary index

109
Q

All indexes of a heap or hash table are blank, since heap and hash tables have no sort column.

A

secondary

110
Q

Indexes may also be blank or blank

A

dense or sparse

111
Q

A blank index contains an entry for every table row.

A

dense index

112
Q

A blank index contains an entry for every table block.

A

sparse

113
Q

Primary indexes are on sort columns and usually blank. Secondary indexes are on non-sort columns and therefore are always blank.

A

sparse
dense

114
Q

Blank indexes are much faster than blank indexes since blank indexes have fewer entries and occupy fewer blocks.

A

Sparse
dense
sparse

115
Q

Primary indexes are usually sparse and sparse indexes are fast. As a result, database designers usually create a primary index on the blank of large tables.

A

primary key

116
Q

Index with one entry for each table row. What type?

A

Dense

117
Q

Index with one entry for each table block. What type?

A

Sparse

118
Q

An index on the table sort column. What type?

A

Primary

119
Q

An index that is not on the table sort column. What type?

A

Secondary

120
Q

A clustering index is not the same as a blank. A blank refers to a table cluster storage structure

A

cluster key

121
Q

When a row is inserted into a table, a new blank is created.

A

index entry

122
Q

Since single-level indexes are sorted, a new entry must be placed in the correct location. To make space for the new entry, subsequent entries must be moved, which is too slow for large tables. Instead, the database blanks an index block and reallocates entries to the blank, creating space for the new entry.

A

splits
new block

123
Q

When a row is deleted, the row’s index entry must be blank or blank

A

physically removed or marked deleted

124
Q

Since single-level indexes are sorted, physically deleting an entry requires moving all subsequent entries, which is slow. For this reason, index entries are blank. Periodically, the database may reorganize the index to remove deleted entries and compress the index.

A

marked as ‘deleted’

125
Q

An update to a column that is not indexed does not affect the index. An update to an indexed column is like a delete followed by an insert. The index entry for the blank is deleted and an index entry for the blank is inserted.

A

initial value
updated value

126
Q

With a sparse index, each entry corresponds to a table block rather than a table row. Index entries are inserted or deleted when blank.

A

blocks split or merge

127
Q

A blank stores column values and row pointers in a hierarchy. The bottom level of the hierarchy is a blank. The bottom level is blank for primary indexes, or blank for secondary indexes.

A

multi-level index
sorted single-level index
sparse
dense

128
Q

In a multi-level index, each level above the bottom is a blank to the level below. Since all levels above the bottom are blank, levels rapidly become smaller. The top level always fits in blank.

A

sparse sorted index
sparse
one block

129
Q

In a multi-level index, to locate a row containing an indexed value, the database first reads the blank. The database compares the indexed value to entries in the block and locates the next level block containing the value. Continuing in this manner, the database eventually locates the bottom-level block containing the value. The bottom-level block contains a blank.

A

top-level block
pointer to the correct table block

130
Q

A blank index has more bottom-level entries than a blank index, and may have more levels.

A

dense
sparse

131
Q

For a dense multilevel index, number of levels =

A

logfan-out (number of rows)

132
Q

The number of index entries per block is called the blank of a multi-level index. The number of levels in a multi-level index can be computed from blank, number of rows, and rows per block:

A

fan-out

133
Q

For a sparse multilevel index, number of levels =

A

logfan-out (number of rows / rows per block)

134
Q

When calculating number of levels in a multilevel index, blank is a fractional number and must be rounded up to the nearest integer. Both formulas assume minimal free space in the index.

A

log

135
Q

Dense indexes usually have blank levels or less. Sparse indexes usually have blank levels or less.

A

four levels
three levels

136
Q

Multi-level indexes are blank than single-level indexes on most queries.

A

faster

137
Q

The multi-level index search reads blank per level. Usually the top two levels are small and retained in memory. Since the index has three levels, the query reads just one index block from blank.

A

one index block
storage media

138
Q

Because blank indexes are faster than blank indexes on most queries, databases commonly use blank rather than blank indexes.

A

multi-level
single-level
multi-level
single-level

139
Q

Number of rows / rows per table block is what type of search

A

Table scan

140
Q

Number of index blocks plus referenced table blocks is what type of search

A

Single-level index scan

141
Q

log base 2 (number of index blocks) plus referenced table blocks is what type of search

A

Single-level index binary search

142
Q

log base fan-out (number of rows), rounded up, plus referenced table blocks is what type of search

A

multi-level dense index search

143
Q

log base fan-out (number of rows / rows per table block), rounded up, plus referenced table block is what type of search

A

multi-level sparse index search

144
Q

Each path from the top-level block to a bottom-level block is called a blank

A

branch

145
Q

Multi-level indexes are called blank when all branches are the same length and blank when branches are different lengths.

A

balanced
imbalanced

146
Q

Imbalanced indexes are undesirable, since blank is unpredictable.

A

processing time

147
Q

If a query follows a long branch, the query is blank.

A

relatively slow

148
Q

Blank are managed to maintain balanced indexes

A

inserts

149
Q

In a blank index, inserts always generate new bottom-level index entries. In a blank index, inserts generate new bottom-level index entries when table blocks split.

A

dense
sparse

150
Q

If the new index entry goes in a full index block, the blank. Half of the rows move to the new block, creating space for the entry.

A

block splits

151
Q

A new block in the blank generates a new index entry the next level up. If the block in the next level up is full, the block splits and the process repeats.

A

bottom level

152
Q

If blocks are full at all index levels, the split propagates to the blank. In this case, the blank block splits and a new level is created.

A

top level

153
Q

New levels are always added at the blank rather than the bottom of one branch. As a result, all branches are always the same length, and the index is always balanced.

A

top of the hierarchy

154
Q

Deletes may cause blank. Blank are the reverse of block splits and potentially eliminate the top level of the index. Consequently, deletes also maintain a balanced index.

A

block mergers

155
Q

Updates to an indexed column behave like a delete of the initial value followed by an insert of a new value. Since updates are implemented as deletes and inserts, updates also leave the index blank.

A

balanced

156
Q

In B+tree, all indexed values appear in the blank. Pointers to table blocks appear only in the blank. Since some indexed values also appear in higher levels, values are occasionally repeated in the index.

A

bottom level

157
Q

In B-tree, if an indexed value appears in a higher level, the value is blank at lower levels. Instead, a blank to the corresponding table block appears in the higher level along with the value.

A

not repeated
pointer

158
Q

B-trees are more compact than B+trees since blank are not repeated.

A

index values

159
Q

B+trees are simpler, since all pointers to table blocks appear in the same blank level.

A

(bottom)

160
Q

The B+tree structure has two benefits over the B-tree. Name them

A

The bottom level of a B+tree is a single-level index and can be scanned or searched.

In a B-tree, inserts, updates, and deletes may cause a table pointer to change levels, which is hard to implement. B+trees do not have this problem, since table pointers are always in the bottom level.

161
Q

Multi-level indexes are usually implemented as blank.

A

B+trees

162
Q

Although most multi-level indexes are implemented as B+trees, the term blank is commonly used and often refers to a B+tree structure. B+tree is commonly written as B+-tree or B+-tree.

A

B-tree

163
Q

The blank index is the most commonly used index type.

A

multi-level

164
Q

In a blank, index entries are assigned to buckets.

A

hash index

165
Q

A blank is a block or group of blocks containing index entries.

A

bucket

166
Q

In a hash index, initially, each bucket has blank. As an index grows, some buckets eventually fill up, and additional blank are allocated and linked to the initial block.

A

one block
blocks

167
Q

In a hash index, the bucket containing each index entry is determined by a blank, which computes a bucket number from the value of the indexed column.

A

hash function

168
Q

In a hash index, To locate a row containing a column value, the database does what four things:

A

Applies the hash function to the column value to compute a bucket number.
Reads the index blocks for the bucket number.
Finds the index entry for the column value and reads the table block pointer.
Reads the table block containing the row.

169
Q

A hash index stores blank in each bucket, while a hash table stores blank in each bucket.

A

index entries
table rows

170
Q

A blank is an index that is structured using a hash function. A blank is a column that determines the physical location of rows in a hash table.

A

hash index
hash key

171
Q

A blank is a grid of bits

A

bitmap index

172
Q

In a bitmap index, each index row corresponds to a blank. If the table’s primary key is an integer, the index row number might be the primary key value. Alternatively, the index row number might be an internal table row number, maintained by the database.

A

unique table row

173
Q

In a bitmap index, each index column corresponds to a blank. Ex: If the index is on AirportCode, each index column corresponds to a different three-letter airport code. The mapping of index column numbers to table values is computed with a function or stored in an internal ‘lookup’ table.

A

distinct table value

174
Q

Bitmap indexes contain blank and blank.

A

ones and zeros

175
Q

In a bitmap index, blank indicates that the table row corresponding to the index row number contains the table value corresponding to the index column number.

A

‘One’

176
Q

In a bitmap index, blank indicates the row does not contain the value.

A

‘Zero’

177
Q

In a bitmap index, tyo locate rows containing a table value, the database does what five things:

A

Determines the index column corresponding to the table value.

Reads the index column and finds index rows that are set to ‘one’.

Determines table rows corresponding to the index rows.

Determines pointers to blocks containing the table rows.

Reads the blocks containing the table rows.

178
Q

An efficient bitmap index has what two characteristics:

A

The database can quickly determine the block containing a table row from the index row number (steps 3 and 4). Ex: The index row number is the hash key for a hash table. The block is determined by applying the hash function to the row number. Ex: The index row number is the table primary key. The block is determined with a primary index.

The indexed column contains relatively few distinct values, typically tens or hundreds. If the indexed column contains thousands of distinct values, the bitmap index is large and inefficient.

179
Q

Bitmap indexes with the strong characteristics enable blank and can easily be retained in memory.

A

fast reads

180
Q

A single- or multi-level index normally contains pointers to table blocks and is called a blank.

A

physical index

181
Q

A blank is a single- or multi-level index in which pointers to table blocks are replaced with primary key values.

A

logical index

182
Q

Logical indexes are always blank indexes and require a separate primary index on the same table.

A

secondary

183
Q

In a logical index, to locate a row containing a column value, the database must do what three things:

A

Looks up the column value in the logical index to find the primary key value.

Looks up the primary key value in the primary index to find the table block pointer.

Reads the table block containing the row.

184
Q

Logical indexes change only when blank values are updated, which occurs infrequently.

A

primary key

185
Q

Physical indexes change whenever a row moves to a new block, which can occurs in what three ways:

A

A row is inserted into a full block. To create space for the new row, the block splits and some rows move to a new block.

The sort column is updated. When the sort column is updated, the row may move to a new block to maintain sort order.

The table is reorganized. Occasionally, a database administrator may physically reorganize a table to recover deleted space or order blocks contiguously on magnetic disk.

186
Q

If a table has several indexes, the time required to update blank is significant, and blank are more efficient.

A

physical indexes
logical indexes

187
Q

On read queries, a logical index requires an additional read of the blank and is slower than a physical index. However, the blank is often retained in memory, mitigating the cost of the additional read.

A

primary index

188
Q

Which index is an index on a unique sort column.

A

Primary index

189
Q

Which index is an index on a non-sort column.

A

Secondary index

190
Q

Which index is an index with primary key values rather than block pointers.

A

Logical Index

191
Q

Which index is an index with table block pointers.

A

Physical index

192
Q

In some cases, values specified in a WHERE clause may be in a different format or units than values stored in the column. To address this problem, some databases support blank.

A

function indexes

193
Q

In a function index, the database designer specifies a blank on the column value. Index entries contain the result of the function applied to column values, rather than the column values.

A

function

194
Q

In principle, blank can be used with any index type, including single-level, multi-level, hash, bitmap, and logical indexes.

A

functions

195
Q

A blank is a database object that maps one or more tables to a single file.

A

tablespace

196
Q

The blank statement names a tablespace and assigns the tablespace to a file.

A

CREATE TABLESPACE

197
Q

The CREATE TABLE statement assigns a table to a blank. Indexes are stored in the same tablespace as the indexed table.

A

tablespace

198
Q

Give the syntax for a CREATE TABLESPACE

A

CREATE TABLESPACE TablespaceName
[ ADD DATAFILE ‘FileName’ ];

199
Q

Give the syntax for a CREATE TABLE assigning a tablespace

A

CREATE TABLE TableName
( ColumnName ColumnDefintion, … )
[ TABLESPACE TablespaceName ];

200
Q

By default, most databases automatically create one blank for each table, so each table is stored in a separate file.

A

tablespace

201
Q

Database administrators can blank tablespaces and assign one or multiple tables to each tablespace

A

manually create

202
Q

Database administrators can improve blank by assigning frequently accessed tables to tablespaces stored on fast storage media.

A

query performance

203
Q

In most cases, databases perform better with a blank per tablespace

A

single table

204
Q

With a single table per tablespace, Individual tables can be backed up blank of other tables.

A

independently

205
Q

With a single table per tablespace, when a table is dropped, the associated file is deleted and blank is released. When multiple tables are stored in one tablespace, all tables must be dropped to release blank.

A

storage

206
Q

With a single table per tablespace, blank of multiple tables are usually faster when each table is stored in a separate file.

A

concurrent updates

207
Q

With a single table per tablespace, blocks of a new file are usually allocated contiguously on a few tracks of a disk drive. As files are updated, blocks become scattered, or blank, across many tracks. Queries that scan tables on heavily blank files are slow because the disk drive must read many tracks. When tables are updated, storing one table per file minimizes blank and optimizes table scans.

A

fragmented

208
Q

In some cases, assigning multiple tables to one tablespace can improve performance. Each tablespace must be managed by the database and incurs a small amount of blank.

A

overhead

209
Q

Storing many small tables in one tablespace reduces overhead and, if the tables are commonly accessed in the blank, may improve query performance

A

same query

210
Q

If the tables are read-only, assigning the tables to one tablespace does not increase blank.

A

fragmentation

211
Q

A blank is a subset of table data.

A

partition

212
Q

One table has many partitions that do not overlap and, together, contain all blank.

A

table data

213
Q

A blank partition is a subset of table rows.

A

horizontal

214
Q

A blank partition is a subset of table columns.

A

vertical

215
Q

MySQL and most relational databases partition tables blank, not blank.

A

horizontally
vertically

216
Q

Each partition is stored in a separate blank, specified either explicitly by the database administrator or automatically by the database.

A

tablespace

217
Q

When a table is partitioned, table blank are also partitioned. Each partition contains index entries only for rows in the partition.

A

indexes

218
Q

Partitions can be defined in several ways. Often, rows are assigned to partitions based on values of a blank. Each partition may be associated with a continuous range of values or an explicit list of values.

A

specific column

219
Q

Partitions improve blank by reducing the amount of data accessed by INSERT, UPDATE, DELETE, and SELECT statements

A

query performance

220
Q

The term blank means either an individual subset of a table or, collectively, all subsets of a table. Usually, the meaning is clear from context

A

partition

221
Q

A blank is similar to a partition. Like a partition, a blank is a subset of table data, usually a subset of rows rather than columns.

A

shard

222
Q

Unlike partitions, which are stored on different storage devices of a single computer, shards are stored on different computers of a blank

A

distributed database

223
Q

To partition a table, the database administrator specifies a blank based on one or more blank.

A

partition expression
partition columns

224
Q

The partition blank may be simple, such as the value of a single partition column, or a complex expression based on several partition columns.

A

expression

225
Q

Rows are assigned to partitions in one of what three ways:

A

A range partition
A list partition
A hash partition

226
Q

A blank partition associates each partition with a range of partition expression values.

A

Range

227
Q

In a range partition, the blank keywords specify the upper bound of each range. The blank keyword represents the highest column value, and blank specifies the highest range. Each partition is explicitly named by the database administrator.

A

VALUES LESS THAN
MAXVALUE
VALUES LESS THAN MAXVALUE

228
Q

A blank partition associates each partition with an explicit list of partition expression values using the blank keywords. Like a range partition, each partition is explicitly named.

A

list
VALUES IN

229
Q

A blank partition requires a partition expression with positive integer values. The database administrator specifies the number of partitions, N, and partitions are automatically named p0 through p(N-1). The partition number for each row is computed as: (partition expression value) modulo N.

A

hash

230
Q

Range, list, and hash partitions are supported in most relational databases. The blank partition is commonly used, often with a simple partition expression based on a date column.

A

range

231
Q

A blank partition is similar to a hash partition, except the partition expression is determined automatically by the database.

A

key

232
Q

Give the syntax for adding a partition

A

CREATE TABLE TableName
( ColumnName ColumnDefinition, … )
[ PARTITION BY
{ RANGE (Expression)
| LIST (Expression)
| HASH (Expression)
}
[ PARTITIONS NumberOfPartitions ]
[ ( PartitionDefinition, … ) ]
];

PartitionDefinition:
PARTITION PartitionName
[ VALUES
{ LESS THAN { (Expression) | MAXVALUE }
| IN ( Value, … )
}
]
[ TABLESPACE TablespaceName ]

233
Q

MySQL has two unusual restrictions that prevent partitions on many tables and columns. Name them
As a result, partitions are of limited value in MySQL.

A

A partitioned table may not contain foreign keys, and foreign keys may not refer to a partitioned table.

All partition columns must appear in all unique columns, including the primary key, of the partitioned table.

234
Q

Blank specifies tables, columns, and keys.

A

Logical design

235
Q

Blank specifies indexes, table structures, and partitions.

A

Physical design

236
Q

Physical design affects query performance but never affects blank.

A

query results

237
Q

A blank or storage manager translates instructions generated by a query processor into low-level commands that access data on storage media.

A

storage engine

238
Q

Storage engines support different index and table structures, so blank is dependent on a specific storage engine.

A

physical design

239
Q

MySQL can be configured with several different storage engines, including what three:

A

InnoDB
MyISAM
MEMORY

240
Q

Blank is the default storage engine installed with the MySQL download. Blank has full support for transaction management, foreign keys, referential integrity, and locking.

A

InnoDB

241
Q

Blank has limited transaction management and locking capabilities. Blank is commonly used for analytic applications with limited data updates.

A

MyISAM

242
Q

Blank stores all data in main memory. Blank is used for fast access with databases small enough to fit in main memory.

A

MEMORY

243
Q

Different databases and storage engines support different blank and blank.

A

table structures and index types

244
Q

Blank supports heap, sorted, hash, and cluster tables. Blank supports only heap and sorted tables.

A

Oracle Database
MySQL with InnoDB

245
Q

Blank or Blank supports only B+tree indexes. Blank supports both B+tree and hash indexes.

A

MySQL with InnoDB or MyISAM
MySQL with MEMORY

246
Q

In MySQL with InnoDB, name the five rules

Indexes are always B+tree indexes.

A primary index is automatically created on every primary key.

A secondary index is automatically created on every foreign key.

Additional secondary indexes are created manually with the CREATE INDEX statement.

Tables with a primary key have sorted structure. Tables with no primary key have a heap structure.

A

Indexes are always B+tree indexes.

A primary index is automatically created on every primary key.

A secondary index is automatically created on every foreign key.

Additional secondary indexes are created manually with the CREATE INDEX statement.

Tables with a primary key have sorted structure. Tables with no primary key have a heap structure.

247
Q

The blank statement creates an index by specifying the index name and table columns that compose the index. Most indexes specify just one column, but a composite index specifies multiple columns.

A

CREATE INDEX

248
Q

The blank statement deletes a table’s index.

A

DROP INDEX

249
Q

The blank statement displays a table’s index. Blank generates a result table with one row for each column of each index. A multi-column index has multiple rows in the result table.

A

SHOW INDEX

250
Q

Give the syntax for creating an index

A

CREATE INDEX IndexName
ON TableName (Column1, Column2, …, ColumnN);

251
Q

Give the syntax for deleting an index

A

DROP INDEX IndexName ON TableName;

252
Q

Give the syntax for showing an index

A

SHOW INDEX FROM TableName;

253
Q

Name the eight columns in the results table of SHOW INDEX

A

Table
Non_unique
Key_name
Seq_in_index
Column_name
Cardinality
Null
Index_type

254
Q

The blank statement generates a result table that describes how a statement is executed by the storage engine.

A

EXPLAIN

255
Q

EXPLAIN syntax is simple and uniform in most databases. Name it

A

EXPLAIN statement;

256
Q

The statement in an EXPLAIN query can be any blank, blank, blank, or blank statement.

A

SELECT, INSERT, UPDATE, or DELETE

257
Q

Name the eight columns in an EXPLAIN statement results table

A

select_type
table
type
possible_keys
key
ref
rows
filtered

258
Q

In the select type column of an EXPLAIN table result, what three values are possible and what do they mean

A

SIMPLE indicates query is neither nested nor union
PRIMARY indicates query is the outer SELECT of nested query
SUBQUERY indicates query is an inner SELECT of nested query

259
Q

In the type column of an explain statement results column, what are the possible join values and what do they mean

A

const indicates the table has at most one matching row
range indicates a join column is compared to a constant using operators such as BETWEEN, LIKE, or IN()
eq_ref indicates one table row is read for each combination of rows from other tables (typically, an equijoin)
ALL indicates a table scan is executed for each combination of rows from other tables

260
Q

In the key column of the EXPLAIN statement, what does NULL mean

A

NULL indicates a table scan is performed

261
Q

What is the formula for the filtered column in an explain statement results table

A

Estimated number of rows selected by WHERE clause / estimated number of rows read from table

262
Q

What are the five possible steps a database admin may take in the physical design process?

A

Create initial physical design.

Identify slow queries.

EXPLAIN slow queries.

Create and drop indexes based on the EXPLAIN result table.

Partition large tables.

263
Q

In the create physical design step of the design process, the DB admin create initial physical design by creating a blank on primary keys and a blank on foreign keys. In MySQL with InnoDB, these indexes are created automatically for all tables. In other databases, this step is necessary for tables larger than roughly 100 kilobytes, but can be omitted for smaller tables.

A

primary index
secondary index

264
Q

In the identify slow queries step of physical design, the blank is a file that records all long-running queries submitted to the database. Identify slow queries by inspecting the log. Most other relational databases have similar query logs.

A

MySQL slow query log

265
Q

In the EXPLAIN slow queries step of physical design, run blank on each slow query to assess the effectiveness of indexes. A high value for rows and a low value for blank indicates either a table scan or an ineffective index.

A

EXPLAIN
filtered

266
Q

In the create and drop indexes based on the EXPLAIN result table step of physical design, consider creating an blank when the rows value is high and the filtered value is low. Consider dropping indexes that are blank.

A

index
never used

267
Q

In physical design’s partition large tables step, if some queries are still slow after indexes are created, consider blank. Blank when slow queries access a small subset of rows of a large table. The blank column should appear in the WHERE clause of slow queries. Often, a blank is best.

A

Partitions
partition
partition
range partition

268
Q

Test

A

Tes