Comment

Comment by thinkharderdev

I don't understand why ``` SELECT total(amount) FROM orders WHERE createdAt BETWEEN '2020-01-01 00:00:00' AND '2020-12-31 23:59:59'; ```

would do a full table scan. Wouldn't the engine be able to use the index to find just the correct rows and then only do the total on those?

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton