When I wrote Reddit Gold (now called Reddit Premium) I intentionally left the paying-user table index-free, looking forward to the day it would become necessary. It hadn’t happened by the time I left the company, even though sales were exceeding expectations.
Wow really? This seems really surprising to me.
Cases where full scans are better than indexes
11–20 of 226 posts
Re: Cases where full scans are better than indexes
#12CloudWatch Logs Insights, Snowflake, Grafana Loki all do minimally indexed queries with highly parallel brute force scans of tons and tons of smallish s3 objects. A lot of data, especially data like logs, the ratio of “retrieved:ingested” can be in excess of 1:100. That makes it very much worth while to not index up front but to pay the retrieval cost for that rare amount of data that is actually retrieved. The minim…
And the common thing in this list of tools? They're all laggy and not a nice experience to use.
Even if queries are rare, there is often an actual human sitting waiting for the results of a query. Whereas while ingesting logs, there is no human waiting. I would prefer to burn more CPU time to save some human time.
Re: Cases where full scans are better than indexes
#13When I wrote Reddit Gold (now called Reddit Premium) I intentionally left the paying-user table index-free, looking forward to the day it would become necessary. It hadn’t happened by the time I left the company, even though sales were exceeding expectations.
What was the reasoning?
Re: Cases where full scans are better than indexes
#14If the data is small, then the index will also be small, so it doesn't really matter either way. The reason to avoid indexes is if you can't accept the time or space cost. Only the last of OP's examples is a situation where choosing an index causes a problem; the rest are examples where an index isn't necessary but does not cause problems. Several examples are so trivial that you'd be crazy to use an external databas…
Unless the small data changes often -- then DBMS needs to change both data and each index.
[1] Edited per discussion; a large number of indices on a small table can still get you in trouble.
Re: Cases where full scans are better than indexes
#15When I wrote Reddit Gold (now called Reddit Premium) I intentionally left the paying-user table index-free, looking forward to the day it would become necessary. It hadn’t happened by the time I left the company, even though sales were exceeding expectations.
Re: Cases where full scans are better than indexes
#16I usually index any columns that are used in joins, or frequently used in predicates.
Re: Cases where full scans are better than indexes
#17Earlier quoted context omitted.
Wow really? This seems really surprising to me.
Speculating, but presumably this table only needed consultation during creation of a new user session. That’s probably a pretty heavyweight operation to begin with, so adding a scan of a few KB (user IDs being modestly sized integers) for every thousand currently paying users is NBD.
Re: Cases where full scans are better than indexes
#18Edit: believe me, I tried it all... refining my queries, multiple tables, bigger hardware, faster disks, changing all the tuneables... nothing was as good as adding a whack-tonne of indexes.
Re: Cases where full scans are better than indexes
#19EDIT: JOINs
Re: Cases where full scans are better than indexes
#20When I wrote Reddit Gold (now called Reddit Premium) I intentionally left the paying-user table index-free, looking forward to the day it would become necessary. It hadn’t happened by the time I left the company, even though sales were exceeding expectations.
Indexes are such an easy thing to add. I don't get it. Seems like under optimization when you consider the tradeoffs.