How do you know what a good index is?

后端 未结 6 655
误落风尘
误落风尘 2020-12-14 23:54

When working with tables in Oracle, how do you know when you are setting up a good index versus a bad index?

6条回答
  •  春和景丽
    2020-12-15 00:32

    @Infamous Cow -- you must be thinking of primary keys, not indexes.

    @Xenph Yan -- Something others have not touched on is choosing what kind of index to create. Some databases don't really give you much of a choice, but some have a large variety of possible indexes. B-trees are the default but not always the best kind of index. Choosing the right structure depends on the kind of usage you expect to have. What kind of queries do you need to support most? Are you in a read-mostly or write-mostly environment? Are your writes dominated by updates or appends? Etc, etc.

    A description of the different types of indexes and their pros and cons is available here: http://20bits.com/2008/05/13/interview-questions-database-indexes/ .

提交回复
热议问题