[ intro music]
Hi there , I am Chris Saxon , the sequel wizard.
And today we're gonna take a look at Index maintenance overhead.
The first I've got a party to prepare for.
My daughter's got a party coming up soon and
as a tradition at these events ,
At the end we gonna give away bags filled with chocolate.
So I have got a big pile of sweets,candies for the Americans among us
and I put them into these bags here .
Now, those of you who've the young children will know
that they want to be sure that got the same someone's got something different
they'll complain about it .
So to ensure I am keeping track of what's going in which bag.
As I put the sweets in the bags , I will write down the color of the sweets
and which bag is in.
So there we go.
Got bag 1, pick up my first sweet . Its orange
and it goes so I write down orange bag 1.
And next one is Pink in the bag it goes , Pink bag 1.
Next one is Violet , put it in .
Violet bag 1 and so on until bag 1 is full.
Then we repeat the process with Bag 2 until that is full.
and going on until all the sweets are in bags.
I am nearly done , just the last couple of sweets to go .
Blue , goes in bag 16. Write down Blue bag 16.
Last one orange in it goes, write it down and we're done.
I am Now ready for my Party .
Which is great, but what's this got to do with Oracle .
Well, this is a table in my database
and each individual sweet is a row stored in that table.
My document here is an index on the color column of that table.
Just like my document stores
the color of the sweet and location so which bag it is in .
and index stores the value of the row and column,
and the location of it within the database .
so we can locate it
Now notice that , as I am adding sweets in my bag and having to write them down,
which slows me down considerably
and I take them out. Let's say I'm not going to bother writing down the colors
I don't have my index . I can just pull them in , [nice and quick.
which is much faster,
compared to having to pick them up.
Put them in and write down the color
at the same time.
So what's the implication here.
Well, having indexes slows down data modification operations
so Inserts ,Updates and Deletes
the more Indexes you have on a table
the slower this will be.
If this is the case ,
you may be saying to yourself why bother with indexes
if they just slows down all my data modification
Surely I should get rid of them all.
Well , just hang on a second .
A key point benefit of indexes is they improve query performance.
I will take a look that in the next episode.
I am Chris Saxon.
Thanks for watching
Thanks for watching.I am Chris Saxon the sequel wizard.
Subscribe to my YouTube channel to get future updates on more sequel magic .
I will see you next time
[exit music]