Consider this Oracle docs about indexes, this about speed of insert and this question on StackOverflow lead me to conclusion that:
- Indexes helps us locate information faster
- Primary and Unique Keys are indexed automatically
- Inserting with indexes can cause worse performance
However every time indexes are discussed there are only SELECT
operations shown as examples.
My question is: are indexes used in INSERT
and UPDATE
operations? When and how?
My suggestions are:
UPDATE
can use index inWHERE
clause (if the column in the clause has index)INSERT
can use index when usesSELECT
(but in this case, index is from another table)- or probably when checking integrity constraints
but I don't have such deep knowledge of using indexes.