Skip to content
RED SAG Skills
hard20 pts · first answer countsindexingquery-tuning

LIMIT 1 takes minutes

The query below takes minutes. EXPLAIN shows an Index Scan on orders_pkey with a Filter on merchant_id. merchant_id = 991 has only 3 orders, all very old. Why is this plan slow?

SELECT * FROM orders
WHERE merchant_id = 991
ORDER BY id DESC
LIMIT 1;
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions