Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,420 --> 00:00:04,510
In this lesson, we're going to
look at our next larger unit
2
00:00:04,510 --> 00:00:07,270
of space, called the extent.
3
00:00:07,270 --> 00:00:11,560
Now the extent used to be a
structure of great importance
4
00:00:11,560 --> 00:00:15,340
to a DBA, but now because of
some changes that have occurred
5
00:00:15,340 --> 00:00:18,330
in the Oracle architecture
that we'll discuss,
6
00:00:18,330 --> 00:00:19,870
the extent is almost
something that's
7
00:00:19,870 --> 00:00:22,300
not even considered anymore.
8
00:00:22,300 --> 00:00:25,600
But it is something for us to
take a look at and understand
9
00:00:25,600 --> 00:00:28,780
to have a more complete
understanding of how database
10
00:00:28,780 --> 00:00:31,700
storage structures work.
11
00:00:31,700 --> 00:00:35,270
So a database extent
is the next larger unit
12
00:00:35,270 --> 00:00:37,040
of space from a block.
13
00:00:37,040 --> 00:00:41,060
So an extent is
composed of blocks.
14
00:00:41,060 --> 00:00:47,180
So we have an extent that's
composed of four 8K blocks.
15
00:00:47,180 --> 00:00:50,420
So let's say our database
block size is 8K.
16
00:00:50,420 --> 00:00:55,700
We have four of them, and
that gives us a 32K extent.
17
00:00:55,700 --> 00:00:59,930
So that is the full extent
size of the four blocks
18
00:00:59,930 --> 00:01:03,470
that form together
to become an extent.
19
00:01:03,470 --> 00:01:06,470
Now the number of
blocks in the extent
20
00:01:06,470 --> 00:01:08,660
is really dependent on
the size of the extent,
21
00:01:08,660 --> 00:01:11,910
and that used to be something
that DBAs would control.
22
00:01:11,910 --> 00:01:14,840
So if we specified
a 16K extent, we'd
23
00:01:14,840 --> 00:01:17,530
have two 8K blocks instead.
24
00:01:17,530 --> 00:01:19,280
And there was a certain
amount of rounding
25
00:01:19,280 --> 00:01:22,340
that could go into
this, but generally DBAs
26
00:01:22,340 --> 00:01:25,580
took a lot of time trying to
determine the proper extent
27
00:01:25,580 --> 00:01:26,880
size.
28
00:01:26,880 --> 00:01:30,500
So in structure, the
way an extent works
29
00:01:30,500 --> 00:01:34,460
is that there is always
an initial extent, so
30
00:01:34,460 --> 00:01:36,740
that first extent size.
31
00:01:36,740 --> 00:01:39,080
Again, that was something
that an Oracle DBA would
32
00:01:39,080 --> 00:01:41,400
calculate for any given table.
33
00:01:41,400 --> 00:01:44,000
So a table would be
made up of extents,
34
00:01:44,000 --> 00:01:45,770
which were made up of blocks.
35
00:01:45,770 --> 00:01:49,410
So we would determine the
size of the initial extent,
36
00:01:49,410 --> 00:01:51,190
and then we'd have
a next extent.
37
00:01:51,190 --> 00:01:53,730
So when the initial
extent was full,
38
00:01:53,730 --> 00:01:56,340
all of the blocks
inside of it were full,
39
00:01:56,340 --> 00:02:00,180
it would extend
to a next extent,
40
00:02:00,180 --> 00:02:04,290
and then another extent
once that was full.
41
00:02:04,290 --> 00:02:07,500
And the extent size, at
least the next extent size,
42
00:02:07,500 --> 00:02:10,020
could be changed on the fly.
43
00:02:10,020 --> 00:02:12,510
So if a database
administrator saw
44
00:02:12,510 --> 00:02:15,030
that there were three
extents in a table
45
00:02:15,030 --> 00:02:18,120
and that it was filling up
these extents very quickly,
46
00:02:18,120 --> 00:02:22,410
he or she could say, let's
just make the next extent size
47
00:02:22,410 --> 00:02:23,280
larger.
48
00:02:23,280 --> 00:02:26,430
So when the three
extents filled up,
49
00:02:26,430 --> 00:02:28,440
and it was time
for another extent,
50
00:02:28,440 --> 00:02:30,270
that one would be larger.
51
00:02:30,270 --> 00:02:32,820
And then we even had the
ability-- and still do,
52
00:02:32,820 --> 00:02:33,960
if we wish--
53
00:02:33,960 --> 00:02:38,310
to put a percentage of
increase on the extent size.
54
00:02:38,310 --> 00:02:43,860
So every subsequent extent
would be, say, 20% larger
55
00:02:43,860 --> 00:02:45,580
than the previous one.
56
00:02:45,580 --> 00:02:48,720
And this helps us slow
the amount of growth
57
00:02:48,720 --> 00:02:51,420
that occurs in our extents.
58
00:02:51,420 --> 00:02:55,170
The reason that we used to
have strategies like this
59
00:02:55,170 --> 00:03:00,690
is because one of the DBAs most
common jobs in the old days,
60
00:03:00,690 --> 00:03:04,480
if you will, was managing
the number of extents
61
00:03:04,480 --> 00:03:06,180
in all of the tables.
62
00:03:06,180 --> 00:03:11,880
So having a large number of
extents was seen as a bad thing
63
00:03:11,880 --> 00:03:16,000
because it was seen as a sort of
fragmentation that would occur.
64
00:03:16,000 --> 00:03:17,970
So you had more
and more extents.
65
00:03:17,970 --> 00:03:21,150
There was nothing wrong with the
five extents that you see here,
66
00:03:21,150 --> 00:03:24,680
but if the extents
grew to 500 in number,
67
00:03:24,680 --> 00:03:29,040
700, 1,000 in number, then
that was seen as a performance
68
00:03:29,040 --> 00:03:33,240
problem because during
a full table scan,
69
00:03:33,240 --> 00:03:35,700
each of those extents
would have to be read.
70
00:03:35,700 --> 00:03:37,950
And they would be
actually located
71
00:03:37,950 --> 00:03:40,830
on different spots on
disk, and so it could
72
00:03:40,830 --> 00:03:42,730
create performance problems.
73
00:03:42,730 --> 00:03:45,270
So one of the DBA's
main tasks was
74
00:03:45,270 --> 00:03:47,500
to reduce the number of extents.
75
00:03:47,500 --> 00:03:50,640
So it was common practice
that if the number of extents
76
00:03:50,640 --> 00:03:54,090
in a table grew
to 1,000, the DBA
77
00:03:54,090 --> 00:03:57,660
would have to reorganize the
table, which basically meant
78
00:03:57,660 --> 00:04:00,270
dumping all of the
data out, recreating
79
00:04:00,270 --> 00:04:04,110
the table with a very
large initial extent--
80
00:04:04,110 --> 00:04:06,030
probably if you
calculate it out,
81
00:04:06,030 --> 00:04:10,230
it would be the total size
of all the extents together--
82
00:04:10,230 --> 00:04:14,010
make that the initial extent,
and then import all the data
83
00:04:14,010 --> 00:04:15,330
back in.
84
00:04:15,330 --> 00:04:19,020
However, around
version 8i, Oracle
85
00:04:19,020 --> 00:04:22,740
put out a paper called,
"How to Stop Defragmenting
86
00:04:22,740 --> 00:04:24,330
and Start Living."
87
00:04:24,330 --> 00:04:26,700
And the conclusion
of that paper was
88
00:04:26,700 --> 00:04:31,740
that, after extensive testing,
advances in disk speeds
89
00:04:31,740 --> 00:04:34,540
had actually made
this irrelevant.
90
00:04:34,540 --> 00:04:38,220
So that if you just studied
the performance of a table
91
00:04:38,220 --> 00:04:41,340
with a lot of extents versus
a table with a few amount
92
00:04:41,340 --> 00:04:45,750
of extents, that you'd see that
these days, or at that point
93
00:04:45,750 --> 00:04:49,620
in time, the performance hit
was not really considerable,
94
00:04:49,620 --> 00:04:53,910
really was negligible, because
disk speeds had improved.
95
00:04:53,910 --> 00:04:56,130
And there were new
technologies like RAID,
96
00:04:56,130 --> 00:04:59,280
which actually were
moving the data around
97
00:04:59,280 --> 00:05:01,350
beneath the Oracle layer.
98
00:05:01,350 --> 00:05:06,210
But then in 9i, Oracle
came out with a feature
99
00:05:06,210 --> 00:05:10,920
for extents that pretty much
solved the issue, even if you
100
00:05:10,920 --> 00:05:13,380
didn't accept their
idea that having
101
00:05:13,380 --> 00:05:16,080
a large number of extents
was a performance problem.
102
00:05:16,080 --> 00:05:20,550
So prior to 9i, our only option
really in dealing with extents
103
00:05:20,550 --> 00:05:23,520
was something called
dictionary managed extents
104
00:05:23,520 --> 00:05:26,340
and what's called
dictionary managed tables.
105
00:05:26,340 --> 00:05:31,110
And dictionary managed
extents were actually recorded
106
00:05:31,110 --> 00:05:32,920
in the data dictionary.
107
00:05:32,920 --> 00:05:36,990
So when Oracle needed
to find a certain extent
108
00:05:36,990 --> 00:05:39,390
for a piece of data--
because remember
109
00:05:39,390 --> 00:05:44,050
that extents contain blocks,
and blocks contain rows of data.
110
00:05:44,050 --> 00:05:46,080
So if we needed a
particular row of data,
111
00:05:46,080 --> 00:05:47,460
it would have to
find the extent.
112
00:05:47,460 --> 00:05:50,040
So how would it find
the right extent?
113
00:05:50,040 --> 00:05:51,990
Well it would actually
look in the underlying
114
00:05:51,990 --> 00:05:53,880
tables of the data dictionary.
115
00:05:53,880 --> 00:05:56,010
And that's fine for
small databases,
116
00:05:56,010 --> 00:05:59,130
but it got to the point
where databases were so large
117
00:05:59,130 --> 00:06:02,250
that any time an
extent was needed,
118
00:06:02,250 --> 00:06:05,010
this huge amount of data
in the data dictionary
119
00:06:05,010 --> 00:06:06,870
would have to be queried.
120
00:06:06,870 --> 00:06:09,480
And that really did
impact performance.
121
00:06:09,480 --> 00:06:12,420
So Oracle introduced
something in version 9i
122
00:06:12,420 --> 00:06:16,920
called locally managed table
spaces, where Oracle actually
123
00:06:16,920 --> 00:06:18,820
managed the extents.
124
00:06:18,820 --> 00:06:22,080
So instead of storing that
extent information in the data
125
00:06:22,080 --> 00:06:25,080
dictionary, it actually
stores that information
126
00:06:25,080 --> 00:06:30,180
about free extents in the table
space in the data file itself.
127
00:06:30,180 --> 00:06:32,610
It's actually stored in
something called a bitmap.
128
00:06:32,610 --> 00:06:36,300
So the extent information
becomes a part of the data
129
00:06:36,300 --> 00:06:40,380
file itself, and that is
much quicker to retrieve
130
00:06:40,380 --> 00:06:42,250
in terms of performance.
131
00:06:42,250 --> 00:06:45,180
So locally managed
table spaces with Oracle
132
00:06:45,180 --> 00:06:49,740
managed extents, if you
will, allows Oracle to decide
133
00:06:49,740 --> 00:06:51,760
how big to make the extents.
134
00:06:51,760 --> 00:06:56,130
So rather than the DBA deciding,
I want an initial extent that
135
00:06:56,130 --> 00:06:58,680
is this size, and then
a next extent that's
136
00:06:58,680 --> 00:07:02,340
this size, and maybe a
percentage increase the next,
137
00:07:02,340 --> 00:07:05,920
Oracle determines based
on its own algorithms
138
00:07:05,920 --> 00:07:08,950
how big to make the extents,
and it controls that.
139
00:07:08,950 --> 00:07:11,320
So right now, at
this point in time,
140
00:07:11,320 --> 00:07:15,760
locally managed table spaces are
really by far the most common.
141
00:07:15,760 --> 00:07:18,580
It's actually quite unusual
to see tablespaces that
142
00:07:18,580 --> 00:07:20,680
are dictionary managed anymore.
143
00:07:20,680 --> 00:07:22,510
There's almost no
reason for that
144
00:07:22,510 --> 00:07:24,550
because time has
shown that Oracle
145
00:07:24,550 --> 00:07:30,090
can manage the extents and
their sizing very effectively.
11949
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.