CodeStudy.net
Toggle Menu
Home
Online Java Compiler
Tutorials
Java Tutorial
Python Tutorial
SQL Database Design
Blog
All Posts
Indexing and Query Optimization
Test your ability to improve database performance and efficiency.
1. Which index type is most commonly used for range queries in relational databases?
B-tree
Hash
Bitmap
GIN
2. Which of the following are benefits of using indexes? (Select all that apply)
Faster read queries
Faster write operations (INSERT/UPDATE/DELETE)
Reduced disk I/O for queries
Lower storage space usage
3. A covering index includes all columns needed by a query, so the database doesn't need to access the table data.
True
False
4. What term describes the process of rearranging index pages to reduce fragmentation?
5. Which SQL clause is often used to suggest the optimizer use a specific index?
FORCE INDEX
USE INDEX
INDEX HINT
OPTIMIZE INDEX
6. Which factors affect query performance? (Select all that apply)
Index usage
Table size
Query complexity
Operating system version
7. Hash indexes are suitable for range queries (e.g., WHERE age > 30).
True
False
8. What acronym refers to the structure showing steps a database takes to execute a query?
9. Which index type is best for columns with low cardinality (few distinct values)?
Bitmap index
B-tree index
Hash index
GIN index
10. Which are types of query optimizers? (Select all that apply)
Cost-based
Rule-based
Heuristic-based
Random-based
11. Normalization always improves query performance.
True
False
12. What term refers to the selectivity of an index (percentage of rows a query returns)?
13. Which join operation benefits most from indexes on join columns?
Nested loop join
Hash join
Merge join
Cartesian join
14. Which are 'bad practices' for query optimization? (Select all that apply)
Using SELECT *
Applying functions on indexed columns in WHERE
Using prepared statements
Avoiding indexes on large tables
15. Hash indexes provide faster lookups than B-tree indexes for equality queries.
True
False
16. What is the process of rewriting a query to improve performance without changing results?
17. Which factor does a cost-based optimizer primarily use to choose execution plans?
Predefined rules
Statistical data (e.g., table size)
User preferences
Index names
18. Which are common index types? (Select all that apply)
B-tree
Hash
Bitmap
Vector
19. Adding more indexes to a table always improves query performance.
True
False
20. What acronym is used for the optimization approach that relies on predefined rules rather than statistics?
Reset
Answered 0 of 0 — 0 correct