Question 51
MediumWhat does EXPLAIN (or EXPLAIN PLAN) show for a SQL query?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
DBMS
What does EXPLAIN (or EXPLAIN PLAN) show for a SQL query?
The user who ran the query
The plan the optimiser chose, such as which indexes and join methods are used
The table's data types
The query's result rows
Sign up free to see the answer and a step-by-step explanation.
A query joins orders to customers on customer_id. Which index most helps the join?
No index can help joins
An index on customers.name
An index on orders.customer_id
An index on orders.amount
Sign up free to see the answer and a step-by-step explanation.
What is a partial (filtered) index?
An index over only the rows that match a condition, such as WHERE status = 'open'
Half of a B+ tree
A corrupted index
An index on part of a column's name
Sign up free to see the answer and a step-by-step explanation.
Why can LIKE '%kumar' not use an ordinary B+ tree index on name?
The index is case-sensitive
LIKE is never indexed
The leading wildcard means the start of the value is unknown, so there is no place in the sorted order to begin
B+ trees store only numbers
Sign up free to see the answer and a step-by-step explanation.
A B+ tree has order (maximum children per node) 100. Roughly how many keys can a tree of height 3 (root plus two levels) index?
About 300
About 1,000,000
About 10,000
About 100
Sign up free to see the answer and a step-by-step explanation.
Why is a B+ tree usually preferred over a B tree for database indexes?
All data pointers are in linked leaves, so internal nodes hold more keys and range scans are sequential
B trees can't be balanced
B+ trees need no keys
B+ trees use less disk space for data
Sign up free to see the answer and a step-by-step explanation.
A query has WHERE LOWER(email) = '[email protected]', and there is an ordinary index on email. Why might the index not be used?
The WHERE clause is invalid
Indexes never work with strings
LOWER() deletes the index
The function applied to the column means the stored index values don't match; a function-based index is needed
Sign up free to see the answer and a step-by-step explanation.
In extendible hashing, what happens when a bucket overflows and its local depth equals the global depth?
The overflow is ignored
The directory doubles in size, and then the bucket is split
All buckets are merged
The bucket is deleted
Sign up free to see the answer and a step-by-step explanation.
Which is a good candidate for an index?
A column in a table with 10 rows
A column that is updated constantly and rarely searched
A column often used in WHERE clauses and joins on a large table, with many distinct values
A column with only two distinct values in an OLTP table
Sign up free to see the answer and a step-by-step explanation.
What does a clustered index on a table's primary key mean for a range query such as WHERE id BETWEEN 100 AND 200?
The matching rows are stored together in key order, so they can be read with few page reads
Each row needs a separate random read
The index can't be used for ranges
The whole table must be scanned
Sign up free to see the answer and a step-by-step explanation.