If you're going to be querying on every field in the table, should you index every field?
Suppose you'开发者_C百科ll query them the same amount, a LOT.
You could, but indexes follow the law of diminishing returns: the more you create and the more data you have, the worse their performance becomes. The perf of your indexes will also depend greatly upon your specific indexing algorithm and whether or not it's appropriate for the amount of data you have stored.
But, in practice, it's always best to index what you need. So, if you need to index every field, go ahead and index every field. Like I said though, you'll want to keep an eye on performance of your indexes.
精彩评论