Index all columns

前端 未结 6 2100
梦毁少年i
梦毁少年i 2021-02-18 14:58

Knowing that an indexed column leads to a better performance, is it worthy to indexes all columns in all tables of the database? What are the advantages/disadvantages of such ap

6条回答
  •  甜味超标
    2021-02-18 15:09

    Indexes take up space. And they take up time to create, rebuild, maintain, etc. So there's not a guaranteed return on performance for indexing just any old column. You should index the columns that give the performance for the operations you'll use. Indexes help reads, so if you're mostly reading, index columns that will be searched on, sorted by, or joined to other tables relationally. Otherwise, it's more expensive than what benefit you may see.

提交回复
热议问题