4 ms·
Could you explain how db indexes are costs having no reason at all?
by tomas_nort 4y ago
Could you explain how db indexes are costs having no reason at all?
- Thorrez 4y agoI assume tluyben2 means that if the db's index is bad the query has to do a much more expensive scan of the database. By adding correct indices this can be fixed.
- tluyben2 4y agoThat is indeed what I meant; with very little effort and not having much knowledge about database internals, you can save a ton of money. It won’t be perfect that way, but goes a long way vs no indices at all. So that’s why ‘no reason’. Aka very low hanging fruit. Sorry for not being clear and thanks for explaining.
- tinus_hn 4y agoNo to mention adding an index is practically without risk, the outcome of queries is the same except probably faster.
- thegabez 4y agoNot true, as always it depends.
- adamckay 4y agoNot true. An index isn't free so you can impact the write performance, depending on the workload and usecases slower writes could have more of an impact than faster reads. But even in a read heavy application it's possible that your databases query planner is "tricked" into using a specific index which can actually be slower than another (or even none) so you should always measure the impact that adding an index can have on your application.
- tinus_hn 4y agoYes it could be slower, but it’s very unlikely to actually break the application.
- nikau 4y agoTell me you haven't used spanner without telling me...