Let's say I have a table with 5 key columns (I'm picking the number 5 arbitrarily) that I query all the time. If I index too many columns then the index will obviously get large and may end up slowing down queries and inserts/updates/deletes and just end up wasting database ram and disk space.
In the past, if I need to query a table for a single row then I usually create an index which lists all key columns so that the index always goes down to the specific row. Is there a rule of thumb that I should follow to tell me when an index is too specific?
I assume it must be possible to look up the byte size of an index versus the byte size of the corresponding table. Is there a rule of thumb about how the byte size of an index should never be larger than N% of the size of the table it's indexing?