I have some columns in my database, mostly varchar 255s. They are only accessed once, but they're loaded once per page load/request for logged in users. (Mostly they contain things like the user's preferences).
My question is, should I create indexes on these columns or not? I've already got indexes on other columns which are used in multiple queries as opposed to just read once and stored like these columns.
You only need indexes on columns that are used for sorting or searching.
ie. they appear in JOIN, WHERE, HAVING, GROUP or ORDER BY clauses.
Even then, it is not strictly necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With