Question 41
MediumWhy do many indexes slow down INSERT, UPDATE and DELETE?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
DBMS
Why do many indexes slow down INSERT, UPDATE and DELETE?
Indexes lock the whole database
Indexes make queries longer
Every index must also be updated when the data changes
Indexes delete old rows
Sign up free to see the answer and a step-by-step explanation.
Which query is a hash index NOT useful for?
WHERE email = '[email protected]'
WHERE price BETWEEN 100 AND 500
WHERE code = 'X1'
WHERE id = 42
Sign up free to see the answer and a step-by-step explanation.
A query filters WHERE YEAR(order_date) = 2024 and there is an index on order_date. How can it be rewritten so the index can be used?
It cannot
WHERE order_date LIKE '%2024%'
WHERE YEAR(order_date) + 0 = 2024
WHERE order_date >= '2024-01-01' AND order_date < '2025-01-01'
Sign up free to see the answer and a step-by-step explanation.
Which column is the worst candidate for a B+ tree index on a 10-million-row table?
order_date, used in range filters
customer_id, used in joins
email, used for lookups
is_active, which is TRUE or FALSE
Sign up free to see the answer and a step-by-step explanation.
What does a database do in an 'index-only scan'?
Answers the query from the index without reading the table rows
Deletes the index
Reads only the table
Rebuilds the index
Sign up free to see the answer and a step-by-step explanation.
A primary index file has one entry for each data block, and the data file has 10,000 blocks. How many index entries are needed?
1
10,000
One per record
100
Sign up free to see the answer and a step-by-step explanation.
A secondary index on city has 50,000 entries for a table of 50,000 rows. Why does it have one entry per row?
Because indexes always duplicate the table
Because the index is sparse
Because city is the primary key
The table is not sorted on city, so each row's position must be recorded (a dense index)
Sign up free to see the answer and a step-by-step explanation.
A B+ tree of height 3 indexes a table, and the root is cached in memory. How many disk reads does a single-key lookup need, including fetching the row?
4
2
1
3
Sign up free to see the answer and a step-by-step explanation.
When a B+ tree leaf overflows on insertion, what happens?
The root is deleted
The insert is rejected
The whole tree is rebuilt
It splits into two leaves and a key is copied up to the parent
Sign up free to see the answer and a step-by-step explanation.
Which data structure does linear hashing or extendible hashing improve on?
B+ trees
Static hashing, which cannot grow without long overflow chains
Heaps
Bitmap indexes
Sign up free to see the answer and a step-by-step explanation.