Which queries does a B-tree index (the PostgreSQL default) suit?
- A.Checking whether an array contains a given element
- B.Computing the nearest distance between coordinate points
- C.Comparisons with =, <, >, BETWEEN and ORDER BY sorting
- D.Full-text search inside long text content
Answer: C
Ordered comparisons: =, <, <=, >, >=, BETWEEN, IN, and also ORDER BY on that column. Because B-tree stores values already sorted, it supports point lookups, range scans, and correctly ordered results with no extra sort.
References