Question 31
MediumWhy can a sparse index be used only on a sorted (clustered) file?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
DBMS
Why can a sparse index be used only on a sorted (clustered) file?
Sparse indexes store all the data
Unsorted files can't be read
It relies on records being in key order to scan forward from the nearest entry
Sorted files have no keys
Sign up free to see the answer and a step-by-step explanation.
What is a covering index for a query?
An index that covers the whole disk
An index on every column of the table
An index that contains every column the query needs, so the table itself isn't read
A clustered index
Sign up free to see the answer and a step-by-step explanation.
Which kind of index suits a low-cardinality column such as gender in a data warehouse?
A hash index
A bitmap index
No index can be used
A unique index
Sign up free to see the answer and a step-by-step explanation.
What does static hashing suffer from as the data grows?
Too few keys
No collisions
Faster lookups over time
Overflow chains, because the number of buckets is fixed
Sign up free to see the answer and a step-by-step explanation.
A table has 1,000,000 rows and an unindexed column. Roughly how many rows does a search for one value check in the worst case?
1
1,000,000
20
1,000
Sign up free to see the answer and a step-by-step explanation.
Using a balanced binary search over 1,000,000 sorted keys, about how many comparisons are needed?
About 100
About 1,000
About 20
About 500,000
Sign up free to see the answer and a step-by-step explanation.
A B+ tree has a fan-out of 200. About how many leaf entries can a tree with 3 levels (root, internal, leaf) index?
About 200
About 40,000
About 8,000,000
About 600
Sign up free to see the answer and a step-by-step explanation.
Why are B+ tree nodes usually sized to one disk page?
To use less RAM
So each node is read with a single disk I/O
To store fewer keys
Because SQL requires it
Sign up free to see the answer and a step-by-step explanation.
A composite index is on (last_name, first_name). Which query cannot use it efficiently?
WHERE first_name = 'Anil'
WHERE last_name = 'Rao' AND first_name = 'Anil'
WHERE last_name LIKE 'R%'
WHERE last_name = 'Rao'
Sign up free to see the answer and a step-by-step explanation.
A table is clustered on order_id. A report often filters by order_date. What is the best option?
Add a non-clustered (secondary) index on order_date
Sort the table by order_date every night
Add a second clustered index on order_date
Drop the primary key
Sign up free to see the answer and a step-by-step explanation.