The question says it all. I’ve ever put indexes for columns that I used on WHERE statements for optimization and help sites scale nicely. I’m talking with my co-worker who says it’s best to not put those indexes and leave place for optimization when needed.
What do you think it’s the best practice here?
The question says it all. I’ve ever put indexes for columns that I used
Share
The answer, as always, is “it depends”.
If the WHERE clause uses a column in such a way that indexing is broken, then why bother? You’ll want to rewrite those, if possible.
Indexes have to be calculated when you INSERT, so there’s a cost to be weighed against querying. If you read mostly, then indexing might make sense. If your database is heavily transactional, indexes will slow down INSERTs. Especially bulk uploads.