What are the query processing steps
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.
What are query trees?
A diagram that contains leaf nodes (input relations) and internal nodes (relational algebra operations).
What is a Query Optimizer?
The optimizer tries to produce the best execution plan possible for a SQL statement.
What is access cost?
The time taken to retrieve the required data from a disk and depends on the method used for accessing the records in the file.
What is a Linear Search?
A sequential searching algorithm.
What is an Index Search?
A data structure that provides quick a look up of data in column.
What is a B+ tree?
A self balancing tree structure that contains root, internal and leaf nodes and organizes data for efficient searching, insertion and deletion.
What are the advantages of an Index Search?
-the DBMS automatically creates an index on the PK of each table
What are the disadvantages of an index search?
-the dbms does work to maintain indexes
-it slows down inserts, updates and deletes
What happens in a nested loop join?
It loops through the rows in one table then scans the second table to find matching rows. It’s efficient for small, unsorted tables.
What happens in an Index Join?
The query processor uses an index on the column that joins tables in increase search speed. (key-value)
What is a hash join?
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.
What are the advantages of a hash table?
-useful when there are no suitable join indices
What are the disadvantages of a hash join?
they require a significant amount of memory
What is a merge join?
It combines data from two tables that have been sorted on a specific join key.
What are the steps of a merge join?
-sort the input tables
What is Hashing?
A technique used to provide rapid data access to data records based on a unique identifier called a hash key/ hash code.
How does hashing work?
A new data record is inserted into the database and it’s key is passed through the hash function, which produces a hash value.