Set 3-2 Flashcards

(31 cards)

1
Q

Select a storage engine for MySQL.

A

Physical Design

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

Specify a column is UNIQUE.

A

Logical design

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

Specify an index is CLUSTERED.

A

Physical design

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

Determine foreign keys.

A

Logical design

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

CREATE INDEX FirstIndex
ON Flight (FlightNumber, AirlineName);

CREATE INDEX SecondIndex
ON Flight (DepartureAirportCode);

The questions below refer to the result table of the following statement:

SHOW INDEX FROM Flight;

How many result table rows have ‘FirstIndex’ in the Key_name column?

A

2

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

CREATE INDEX FirstIndex
ON Flight (FlightNumber, AirlineName);

CREATE INDEX SecondIndex
ON Flight (DepartureAirportCode);

The questions below refer to the result table of the following statement:

SHOW INDEX FROM Flight;

FlightNumber is the primary key of Flight. Flight has 90 rows. In the row with Column_name = “FlightNumber”, what is the value of Cardinality?

A

90

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

CREATE INDEX FirstIndex
ON Flight (FlightNumber, AirlineName);

CREATE INDEX SecondIndex
ON Flight (DepartureAirportCode);

The questions below refer to the result table of the following statement:

SHOW INDEX FROM Flight;

In the row with Column_name = “AirlineName”, what is the value of Seq_in_index?

A

2

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

EXPLAIN
SELECT FlightNumber
FROM Flight
WHERE AirportCode IN
(SELECT AirportCode
FROM Airport
WHERE Country = “Cuba”);

In the row with table = “Airport”, what is the value of select_type?

A

SUBQUERY

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

EXPLAIN
SELECT FlightNumber
FROM Flight
WHERE AirportCode IN
(SELECT AirportCode
FROM Airport
WHERE Country = “Cuba”);

In the row with table = “Flight”, the _____ column contains NULL because no indexes exist that might be used to process the query.

A

key

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

EXPLAIN
SELECT FlightNumber
FROM Flight
WHERE AirportCode IN
(SELECT AirportCode
FROM Airport
WHERE Country = “Cuba”);

Assume the Airport table contains an AirportCode for Cuba. In the row with table = “Flight”, what is the value of rows?

A

90

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

An index never appears in the key column of the EXPLAIN result table for any slow query. Should this index always be dropped?

A

No

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

In the EXPLAIN result table for one slow query, the key column is NULL, the filtered column is 1%, and the rows column is 10 million. Should an index be created?

A

Yes

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

Additional indexes never slow performance of SELECT queries.

A

True

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

In step 1 of physical design for MySQL with InnoDB, the database administrator determines table structures.

A

True

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

Which index entry refers to Air China flight 1107?

A

The sixth entry

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

Lufthansa flight 44, departing from Munich, is inserted into the table. The code for Munich is MUC. Where does the new index entry go?

A

Between the LAX and ORD index entries.

17
Q

An index entry requires 12 bytes. Pointers to table blocks require 8 bytes. Index blocks are 4 kilobytes. Approximately how many rows can be referenced in one index block?

18
Q

An index on a non-unique column can either:
A) store multiple pointers after one value, or
B) store duplicate values with one pointer each.
What is the advantage of strategy A?

A

Index is more compact.

19
Q

Refer to the following scenario:

A table occupies 2,000 blocks.
FlightNumber is the primary key.
An index on FlightNumber occupies 200 blocks.
The WHERE clause of a SELECT specifies "FlightNumber = 3988".

The query is executed with an index scan.

What is the maximum number of blocks necessary to process the SELECT?

20
Q

Refer to the following scenario:

A table occupies 2,000 blocks.
FlightNumber is the primary key.
An index on FlightNumber occupies 200 blocks.
The WHERE clause of a SELECT specifies "FlightNumber = 3988".

The query is executed with an index scan.

What is the minimum number of blocks necessary to process the SELECT?

21
Q

Refer to the following scenario:

A table occupies 2,000 blocks.
FlightNumber is the primary key.
An index on FlightNumber occupies 200 blocks.
The WHERE clause of a SELECT specifies "FlightNumber = 3988".

The query is executed with an index scan.

Assume the table has no index. What is the maximum number of blocks necessary to process the SELECT?

22
Q

Refer to the following scenario:

A table has 100 million rows.
Each row is 400 bytes.
Each block is 8 kilobytes.
Each index entry is 20 bytes.
Magnetic disk transfer rate is 0.1 gigabytes per second.

Assuming no free space, a table scan requires approximately how many seconds?

23
Q

Refer to the following scenario:

A table has 100 million rows.
Each row is 400 bytes.
Each block is 8 kilobytes.
Each index entry is 20 bytes.
Magnetic disk transfer rate is 0.1 gigabytes per second.

Assuming the index is sorted, a binary search for one row reads approximately how many blocks?

24
Q

Index with one entry for each table row.

25
Index with one entry for each table block.
Sparse Index
26
An index on the table sort column.
Primary Index
27
An index that is not on the table sort column.
Secondary Index
28
Inserts to a sorted table are always faster when the table has no indexes.
False
29
Inserts to a heap table are always faster when the table has no secondary indexes.
True
30
Most large tables have a primary index.
True
31
A table update may cause an index block split.
True