Hacker News new | ask | show | jobs
by rmetzler 4262 days ago
Ok, thank you. Now you got me thinking, what did I do wrong with this Oracle 9 DB several years ago? :/
1 comments

Perhaps you selected the last ten orders for a particular customer, or something like that. In that case, the query planner would have to choose whether to scan the entire table, or to scan the timestamp index and then filter by customer. If you had a lot of customers, it is reasonable to choose the table scan.

Of course, for that query, you could create an index on customer_id & timestamp, and then it would be near-instant again!