Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In this lesson, we're going to take
a look at our next large unit of space, which are segments.
And there are many different kinds of segments,
as we will see.
But segments have in common that they are composed of extents.
So normally, we are most concerned with table segments.
And so segments are composed of extents.
And extents are composed of blocks.
So to look at the structure of a segment,
we have many extents here.
Let's say we have five extents, one
of these being the first or initial extent, and each one
subsequently being the next extent.
We refer to this set of extents as a segment.
And a segment is going to be sort
of the physical analog of something logical,
like a table.
So a table itself isn't a physical object.
It's a name that we give and that we use to deal with it.
But the underlying structure that's there
is called a segment.
We have many different kinds of segments,
our most common being table segments, which
are going to store row data.
So tables that store rows of data--
those rows are stored in blocks, which form extents,
which compose segments.
We also have index segments.
An index is a storage structure that
takes a portion or a column of a table.
It takes those values.
And it puts them in a structure so
that the values can be more easily discovered and queried
from.
So indexes can greatly speed the performance of some queries.
But that is a physical structure.
It requires blocks being put together in a structure.
And so it is stored in a segment.
We have undo segments.
So anytime we do a transaction, we
need to store the before image of the data.
And so those blocks are put into extents
that form an undo segment.
We have temporary segments.
Anytime we do something like a sorting operation--
so we select from a table and then order by a certain
column--
that's called a sort.
And sorting occurs in memory.
When a sort is too big to occur 100% in memory,
the sorting information is written out
to temporary segments, out to a place in disk
called a temporary tablespace.
And there are temporary segments within
that temporary tablespace.
And then once the sorting operation is complete,
part of it being in memory, part of it being on disk,
it's all read back together again,
reconstructed, and then presented to the user.
We also have partition segments.
So if we use table partitioning, which allows us to take a table
and split it into partitions according to a certain value--
so we may have a 10 million row table
that contains one million rows of yearly data that
goes back 10 years--
we may choose to partition it by year so that each partition is
a year by itself.
And so whenever we're querying based on the year,
we are able to exclude the other partitions,
if you will, and only look at the data
that we wish to see for that particular year.
So those are stored in segments much in the same way
that a table would be.
And in the same way that an index
would be stored in a segment, index partitions are stored.
So they're a slightly different kind of index.
That index is based on a partition
or the structure of a partition rather than just
a table itself.
And then we have LOB and LOB index segments.
So LOB stands for Large Object.
So that might be something like the BLOB,
or Binary Large Object, data type.
And those are used to store binary data.
So we can actually store a video or an MP3 or a PDF document.
We can store all of those things in an Oracle database.
It requires a certain data type and-- called a BLOB.
And that data isn't really contiguous with the kind
of data that we have in a typical table, where
we have numbers and strings of data and so forth.
So those types of objects are actually
stored in their own segments.
And when we query a table, there's
really just a pointer in the table
that points to the LOB segment.
And LOBs can be indexed just in the same way that any data can.
And so those are used in their own segments as well.
So there's a high degree of specialization
with the segment.
And this has really developed over time in Oracle
as Oracle has refined the database.
There used to be, really, two or three different kinds
of segments.
But Oracle has continued to refine
the way that segments are stored and the types of data that
are in them and how they're structured to be
more consistent with high performance.
So we mentioned that a segment is a physical analog,
in some cases, of a database object,
such as a table, whereas we call a table something like the EMP
table.
There's actually a segment of the same name.
So let's take a look at that.
If we were to do a query, like select star from user_tables
where table_name equals EMP, and user_tables is the data
dictionary view that gives us the list of tables
that our user owns, it's very much like what we see here
when we expand out the tables frame over here
in the connections.
So this tells us that we have a table called
EMP and its tablespace name and lots of other information.
But a table is only a logical name.
It's not a physical construct.
So to see that there is also a physical construct here,
we could query user_segments where segment_name equals EMP.
And indeed, we see that we have a segment called EMP.
It's the segment type table.
So we discussed the different types
of segments that were available.
This is a table segment, tablespace information
about it, the number of bytes, the number of blocks
that are in the segment.
So again, segments are composed of extents.
And extents are composed of blocks and other information
as well.
So that kind of shows this, that there
is a relationship or an analog between a table
and its physical segment.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.