See my HN comment on the post The 3-minute SQL indexing quiz: Can you spot the five most common mistakes? . Do you agree that my answer ("Not enough information: Definite answer cannot be given") is correct? See proof in psql.txt below.
This question is different. First consider the following index and query:
CREATE INDEX tbl_idx ON tbl (a, date_column)
SELECT date_column, count(*)
FROM tbl
WHERE a = 38
GROUP BY date_column
Let's say this query returns at least a few rows.
To implement a new functional requirement, another condition (b = 1) is added to the where clause:
SELECT date_column, count(*)
FROM tbl
WHERE a = 38
AND b = 1
GROUP BY date_column
How will the change affect performance:
- Same: Query performance stays about the same
- Not enough information: Definite answer cannot be given (my answer)
- Slower: Query takes more time (supposedly correct answer)
- Faster: Query take less time
See: