Week 5 : Query Processing Flashcards

(18 cards)

1
Q

What are the query processing steps

A

query decomposition - scanning, parsing, validation

query optimization - choosing a suitable execution strategy to retrieve the query result from the internal database file

query code generation - used to execute the strategy

runtime database processing - runs complied of interpreted code to give the query result and generates error messages for runtime errors.

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

What are query trees?

A

A diagram that contains leaf nodes (input relations) and internal nodes (relational algebra operations).

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

What is a Query Optimizer?

A

The optimizer tries to produce the best execution plan possible for a SQL statement.

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

What is access cost?

A

The time taken to retrieve the required data from a disk and depends on the method used for accessing the records in the file.

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

What is a Linear Search?

A

A sequential searching algorithm.

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

What is an Index Search?

A

A data structure that provides quick a look up of data in column.

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

What is a B+ tree?

A

A self balancing tree structure that contains root, internal and leaf nodes and organizes data for efficient searching, insertion and deletion.

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

What are the advantages of an Index Search?

A
  • improves search time

-the DBMS automatically creates an index on the PK of each table

  • the user can specify additional index using ‘CREATE INDEX’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the disadvantages of an index search?

A

-the dbms does work to maintain indexes

  • the systems has to insert/delete rows in all indexes

-it slows down inserts, updates and deletes

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

What happens in a nested loop join?

A

It loops through the rows in one table then scans the second table to find matching rows. It’s efficient for small, unsorted tables.

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

What happens in an Index Join?

A

The query processor uses an index on the column that joins tables in increase search speed. (key-value)

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

What is a hash join?

A

This requires one pass through the file. It two phases are

build - the server builds an in-memory hash table where rows from one of the inputs are stored and creates a hash table key

probe - the server searches for matching rows in the hash table.

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

What are the advantages of a hash table?

A
  • effective for large volumes of data with unsorted inputs and no useful indexes

-useful when there are no suitable join indices

  • a smaller files uses the build phases/filter to reduce the number of rows
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the disadvantages of a hash join?

A

they require a significant amount of memory

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

What is a merge join?

A

It combines data from two tables that have been sorted on a specific join key.

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

What are the steps of a merge join?

A

-sort the input tables

  • merge operation
  • comparison and matching
  • repeat and advance
  • result generation
17
Q

What is Hashing?

A

A technique used to provide rapid data access to data records based on a unique identifier called a hash key/ hash code.

18
Q

How does hashing work?

A

A new data record is inserted into the database and it’s key is passed through the hash function, which produces a hash value.