|
|
|
|
|
by jiggawatts
1545 days ago
|
|
In a way, it is even deceptive, because naive programmers might be lead to think that repeated(!) table scanning is what real database engines do. It's actually very rare that this happens. For example, SQL Server will create a temporary index on the fly if one is missing. It can create B-Tree, Hash, and Bitmap indexes which might be unexpected for some people because only B-Tree indexes can be created "permanently". So in some ways database engines do even more than just use statically defined indexes. |
|
So I have a little consultancy gig for a few decades now where I spend a few days a month optimising bad software for performance (it is what I like; I don’t do anything else but ‘make shit faster’). I can tell you that the the past 10 years 99% of optimisations I did are fixing MySQL queries and indexes that table scan. I had projects that literally have table scanning queries over 50% of the queries ran. The result, as you know but apparently is not very common knowledge, is that these sites and apps run to a grinding halt (after incurring bizarre bills on aws rds; I moved many app from $100k/month bills to $10/month) when even a little traffic comes in.
Or; table scans should be rare but are not.
Edit; removed ‘time’ as that was not a good way of expressing this