Question 154Asked in DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)
What is the difference between a B-tree and a Hash index in a database?
AA B-tree index is used to sort data in a table, while a Hash index is used to filter data in a table.
BA B-tree index is used for exact match queries and sorts data using a hash function, while a Hash index is used for range queries and sorts data in a hierarchical structure.
CA B-tree index is used for range queries and sorts data in a hierarchical structure, while a Hash index is used for exact match queries and sorts data using a hash function.
DThere is no difference between a B-tree and a Hash index.
Show answerHide answer
Correct answer: (C) A B-tree index is used for range queries and sorts data in a hierarchical structure, while a Hash index is used for exact match queries and sorts data using a hash function.
Explanation
B-tree indexes keep keys in sorted, hierarchical order, so they handle range queries well. Hash indexes use a hash function, which is good for exact-match lookups but not ranges.
From DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 3 (4:30 PM)