Skip to Main Content
  • Questions
  • Does the number of tablespace effact performance?

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Amy.

Asked: September 07, 2000 - 10:34 am UTC

Last updated: February 06, 2013 - 6:49 am UTC

Version: 8.1.6

Viewed 10K+ times! This question is

You Asked

Dear Tom,

One of our application has about 30 tables and table sizes are very different. Considering performance, some one suggests create tablespace for each table. Do you think if it helps or not?

Thanks. Amy

and Tom said...

Using multiple tablespaces will allow you to more closely control where objects are physically. If right now you have 1 big tablespace with files on one disk only -- you can definitely use >1 tablespace to help spread out the load over more then 1 disk. You would create your new tablespaces with files on different devices and move your objects into them.


Using more then 1 tablespace will allow you to tune -- having >1 tablespace does not mean you are tuned. It'll let you place objects where they should be on the disks -- but it won't do it for you. You will use tablespaces to put things where they belong.

So, yes, i would agree you need more then 1 tablespace but consider a means to the end, not the final answer. You'll need to place things correctly (eg: keep data that is frequently accessed together -- like a table and its indexes -- on different devices).

since you'll be rebuilding your objects - suggest you read through:

</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:240014552942 http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:407619241062 http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:652224147530 http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:228413960506 <code>
and seriously consider using locally managed tablespaces with either uniform or system managed exent sizes.

Also, see the "ALTER TABLE T MOVE TABLESPACE ..." command and "ALTER INDEX REBUILD ..." command. They will let you put the existing things into the new places easily (remember to rebuild indexes AFTER moving a table!!)




Rating

  (19 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

How things change

Steve G, April 19, 2005 - 5:24 pm UTC

Tom,
please tell me you dont feel this would be good advice in todays environment!

Tom Kyte
April 19, 2005 - 7:55 pm UTC

Indeed. I'll leave this one here to show that concepts change over time.


the last link above points to me saying "uniform", I've very much evolved that as well - I like system allocated extents today (I was subject to the same FUD in te beginning, uniform seemed really nice, auto allocate scary. Now I know how it works and use that mostly)

and yes, that was a boneheaded comment about the tables and indexes. It was never true. just a single tablespace with datafiles from every device and let oracle stripe the data. Or use raid.



A reader, April 19, 2005 - 5:45 pm UTC

"(eg: keep data that is frequently accessed together -- like a table and its indexes -- on different devices)."

I thought that index->table access was serial, therefor placing indexs and tables in different tablespaces would not generate a real performance gain????



Tom Kyte
April 19, 2005 - 7:58 pm UTC

yes, it is. I made a mistake in saying that.

And Connor McDonald, if you make fun of this I will get that first internet posting of yours that I answered again....

Can I make fun of it instead, then?

Howard J. Rogers, April 19, 2005 - 8:23 pm UTC

Or do I risk starting a discussion on the precise meaning of 'single table lookups"??!!

Just kidding...

Regards
HJR

PS. I was exactly the same about AUTOALLOCATE v. UNIFORM SIZE... and you're right: once the scariness of the mysteries of autoallocate have worn off, it wins hands down.

Tom Kyte
April 19, 2005 - 8:39 pm UTC

ouch, that was a thread that grew four heads and bit. I remember that one....


Excellent

A reader, April 20, 2005 - 1:12 pm UTC

<<I like system allocated extents today >>

Can you elaborate what made you like system allocated instead of uniform? Thanks.

Tom Kyte
April 20, 2005 - 9:11 pm UTC

I got to know them, understand them, tested with them, deployed with them and came to the conclusion "they are good"

before I knew them
before I understood them
before I tested with them
before I deployed with them

I was not so sure I liked the "a" -- the automatic part.

Show me?

Mike, April 22, 2005 - 9:57 am UTC

(slightly tongue-in-cheek)

This Missourian, working for a bunch of Missourians, needs something more than, "I've used system allocated tablespaces, and I know it works, so you should do it, too." (sounds like something a high-priced consultant would say)

Are there some documented tests that I can show to my fellow Missourians to back up the claim "they are good"?

I can't even get permission to try them in test without something more than "Tom Kyte likes them", or even "Oracle recommends them".

The prevailing attitude is "somebody before you took a lot of time to decide to do things this way, so therefore how we do it now must be right."

I'm not trying to ruffle any feathers, but I am 'questioning authority', which I believe you also espouse. So, can you show me?

Tom Kyte
April 22, 2005 - 10:55 am UTC

See my book "Effective Oracle by Design", I spent a large section on this showing

a) how it works
b) how it typically sizes the extents
c) how you'll end up with about 300 or so extents for a 10 gig segment (very reasonable)

Here is the excerpt actually

<quote>

(2)Use System-Managed LMTs When You Do Not Know How Big Your Objects Will Become

With a system-managed LMT, the system figures out exactly what the extent sizes will be for a table. Oracle will use an internal, undocumented algorithm to allocate space for every object in the tablespace. With this method, the first couple of extents will be small (64KB), and then the extents will get larger and larger over time. They will all be multiples of each other. That fact precludes free space fragmentation in these tablespaces, because every chunk of free space is potentially usable by any other object. This is in contrast to a DMT, where an object will request arbitrary extent sizes, and if there is not a contiguous free extent large enough to satisfy the request, the request will fail. It is true that in a system managed LMT, since there is more than one extent size, a request for space may fail even if there is existing free space.  It is however many times less likely - due mostly to the fact that there is a very limited number of extent sizes. It would be rare to have free space that is not usable in a System managed LMT and in general, the space will be very small. 

In the beginning, I was a little cautious about using this type of tablespace. It just didn't feel right. I was always taught that we should size our objects, watch their space usage like a hawk-micromanage the tablespace. Maybe I'm getting lazy, but I would prefer not to work that way if I can avoid it. With system-managed LMTs. I'm not kept awake at night wondering if a PCTINCREASE is going to go crazy on me or if my tablespace will be fragmented like Swiss cheese, with a lot of different-sized holes in it. Objects grow in a sensible fashion, without a lot of watching or handholding.

To see how space might be allocated in such a tablespace, let's use BIG_TABLE again (as noted in the appendix on "setting up", this is a table created from ALL_OBJECTS and duplicated over and over to have quite a few rows). For this demonstration, I made a copy of this table in an auto-allocate LMT.

big_table@ORA920> create tablespace SYSTEM_MANAGED
 2 extent management local;

Tablespace created.

big_table@ORA920> create table big_table_copy
 2 tablespace SYSTEM_MANAGED
 3 as
 4 select * from big_table;

Table created.

big_table@ORA920> select tablespace_name, extent_id, bytes/1024, blocks
 2 from user_extents
 3 where segment_name = ' BIG_TABLE_COPY'
 4 /

TABLESPACE_NAME    EXTENT_ID BYTES/1024 BLOCKS
------------------------------ ---------- ---------- ----------
SYSTEM_MANAGED      0  64  8
SYSTEM_MANAGED      1  64  8

SYSTEM_MANAGED      14  64  8
SYSTEM_MANAGED      15  64  8
SYSTEM_MANAGED      16  1024  128
SYSTEM_MANAGED      17  1024  128

SYSTEM_MANAGED      77  1024  128
SYSTEM_MANAGED      78  1024  128
SYSTEM_MANAGED      79  8192  1024
SYSTEM_MANAGED      80  8192  1024

SYSTEM_MANAGED      91  8192  1024
SYSTEM_MANAGED      92  8192  1024

93 rows selected.

As you can see in this example, the first 16 extents each are 64KB (but don't be surprised if you see something slightly different). The next 63 are each 1MB, and the remaining 14 are 8MB. As the object grew, the extents grew as well. That is a total of about 180MB of space in 93 extents, which is perfectly acceptable. For those who believe you must have your objects in one extent, I hope that this Oracle-supported algorithm, which promotes and encourages multiple extents, puts that notion to rest.

In this example, when we quadrupled the size of the BIG_TABLE_COPY to about 650MB, Oracle added another 64 extents, each 8MB, for a total of 512MB more. That table was just taking care of its space needs.

When you do not know how big your objects will become, system-managed LMTs, are the way to go. This type of space management is most useful when you are creating objects for an application, and depending on how the people using the application configure it, some tables might be empty, some might be 100MB, and some might be 2GB. On another installation, the tables that were 2GB are empty, the tables that were empty are 100MB, and the tables that were 100MB tables are 2GB. In other words, you have no idea how big these tables are going to be in the real world. Here, having each object start at 64KB and stay that way for the first couple of extents lets the tables that are nearly empty stay very small. The tables that are going to get large will get large fast. 

If you are using Oracle9i Release 2 with an LMT, you'll find that it uses system-managed extent sizing for the SYSTEM tablespace. For the SYSTEM tablespace, this extent-sizing strategy is the best thing ever. It will prevent dictionary tables from growing exponentially (as PCTINCREASE would have them doing after a while; even a small PCTINCREASE would cause a table to grow by huge amounts after a short period of time) and keep the number of extents at a reasonable maximum. Consider that if you install Oracle and use a ton of PL/SQL, your SYS.SOURCE$ table and the tables that hold the compiled PL/SQL will be huge. On the other hand, your friend may install Oracle and not write any lines of PL/SQL code. With the system-managed approach, Oracle will let the database figure out how big the extents should be.

System-managed LMTs work well, as long as the objects are destined to be 10GB or less. At 10GB, you would be using about 300 extents for the object in this type of tablespace, which is fine. Segments that exceed 10GB are fairly rare. If you are using partitioning, the individual partitions are the segments; 10GB partitions or smaller would be a good size. For tables and indexes that are getting into the 10GB size range, consider partitioning them into smaller, more manageable segments. For segments larger than 10GB, or for those that you prefer to size yourself for some reason, consider using LMTs with uniform extent sizes.


(2)Use Uniform Extent Sizes When You Know the Ultimate Size of an Object

The other type of LMT is one that supports uniformly sized extents. Using this strategy, each and every extent in the tablespace will be exactly the same size as every other extent in that tablespace. To see how this works, let's use the same example we did in the previous section with BIG_TABLE, but with a 5MB uniform extent size.

big_table@ORA920> create tablespace uniform_size
 2 extent management local
 3 uniform size 5m
 4 /
Tablespace created.

big_table@ORA920> create table big_table_copy
 2 tablespace uniform_size
 3 as
 4 select * from big_table
 5 /
Table created.

big_table@ORA920> select tablespace_name, extent_id, bytes/1024, blocks
 2 from user_extents
 3 where segment_name = ' BIG_TABLE_COPY'
 4 /

TABLESPACE_NAME    EXTENT_ID BYTES/1024 BLOCKS
------------------------------ ---------- ---------- ----------
UNIFORM_SIZE       0  5120  640
UNIFORM_SIZE       1  5120  640

UNIFORM_SIZE       34  5120  640

35 rows selected.

As expected, every extent that was and will ever be allocated in that tablespace will be 5MB-not a byte more, not a byte less.

So, when is this type of tablespace useful? It works well when you know the ultimate size of the object. For example, when you are loading a data warehouse, you have a good idea of what size the objects will be. You know that table will have fifty 5GB partitions. 

The trick here is to pick an extent size that will hold your object with the least amount of waste. If this segment is 5GB + 1 byte, it will need to extend one more time for that last byte, effectively wasting .499999GB of storage. In a large data warehouse, that is a drop in the bucket, but every bit (or byte) counts. You might be willing to set a target of 500 extents, which allows you to use a 10MB extent and waste at most 10MB of space.

Another factor to consider when deciding on an extent size is the desired monitoring granularity. An extent size that implies a new extent each month makes abnormal growth easy to spot. If you were to size the extents so that they grow by dozens every day, this spot check would be more difficult.

(2)Some LMT Caveats

Here, I will point out some caveats I've discovered along the way using LMTs. None of these issues are earth-shattering; none would make me stop using LMTs. I just wanted to make sure you are aware of these points.

(3)The Magic Number for Uniformly Sized Extents Is 64KB

There was a common myth when LMTs first came out that an LMT with a uniform extent size would waste its first extent for the bitmap used to manage the file; that is, if you used a 1MB uniform extent size, the first 1MB of the tablespace would be taken over by Oracle. People thought, "Oh my gosh, if I use a 100MB uniform size, I'll waste 100MB of data!" Well, there is overhead, but it is only 64KB, not the size of the extent. 

The problem was that most people were creating their datafiles as an integral multiple of the uniform extent size. For example, if they used a 5MB extent size, they would use 100MB as a datafile size (20  5 = 100). Oracle would look at this 100MB that was just given to it, take away 64KB for itself, divide what was left by 5MB, and truncate the result (no partial extents here). Thus, there were only 19 extents available in this tablespace right after creation! Here is a simple example showing the issue and then how to fix it. We'll start by creating a tablespace with uniform extent sizes of 5MB and a datafile of 100MB.

ops$tkyte@ORA920> create tablespace five_meg
  2  datafile size 100m
  3  uniform size 5m
  4  /

Tablespace created.

Now, we will query how much free space is available in this newly created tablespace.

ops$tkyte@ORA920> select sum(bytes/1024/1024) free_space
 2 from dba_free_space
 3 where tablespace_name = ' FIVE_MEG'
 4 /

FREE_SPACE
----------
  95

So, it would appear that 5MB of overhead was taken, but this is not really the case. Let's increase that file by a measly 64KB.

ops$tkyte@ORA920> column file_name new_val f
ops$tkyte@ORA920> select file_name from dba_data_files
  2  where tablespace_name = 'FIVE_MEG';

FILE_NAME
------------------------------
/usr/oracle/ora920/OraHome1/or
adata/ora920/o1_mf_five_meg_zc
54bj5l_.dbf


ops$tkyte@ORA920> alter database
  2  datafile '&f' resize 102464k;
old   2: datafile '&f' resize 102464k
new   2: datafile '/usr/oracle/ora920/OraHome1/oradata/ora920/o1_mf_five_meg_zc54bj5l_.dbf'
 resize 102464k

Database altered.

ops$tkyte@ORA920> select sum(bytes/1024/1024) free_space
  2  from dba_free_space
  3  where tablespace_name = 'FIVE_MEG';

FREE_SPACE
----------
       100

And there you go. We have all of our space. I'm not sure how many DBAs this feature scared off, but I hope they will come around after seeing this!
Note that this 64KB rule need not apply to system-managed extents! If you ran the above test without the uniform size 5m clause, you would find that there is initially 99.9375MB of available free space, and all but 64KB of it would be usable.

(3)System-Managed LMT Allocates from Files Differently

Ask Tom
"How can you achieve 'poor-man's striping' of a table. That is, without using striping software at the operating-system level and without using partitioning, how would you stripe a table across multiple devices?"
To accomplish this, create a tablespace with many datafiles. Use an LMT, of course. Use a uniform extent size that will cause the table to go into 100 or so extents. Create the table in that tablespace. Allocate extents for it in a round-robin fashion, spreading the data out.

I had tested this in the past using a DMT, and Oracle always tended to go round-robin when allocating space. I had also tested this with an LMT using uniform extent sizes, and it worked the same. However, when the user tried to apply this technique, he used system-managed extents! The results were quite different than what I had experienced. But, after further testing, it seems that the round-robin technique will still kick in when the object gets large enough to mandate striping.
End Ask Tom

To see how the different types of LMT allocate from files, we will consider a small example. We will start by creating two tablespaces, each with four datafiles that are 64KB larger than 2MB (the extra 64KB you need for the bitmap). One will use 64KB uniform extents; the other will be system-managed.

ops$tkyte@ORA920> create tablespace uniform_extents
  2  datafile size 2112k, size 2112k, size 2112k, size 2112k
  3  uniform size 64k
  4  /

Tablespace created.

ops$tkyte@ORA920>
ops$tkyte@ORA920> create tablespace system_managed
  2  datafile size 2112k, size 2112k, size 2112k, size 2112k
  3  /

Tablespace created.
Next, we'll create a table in each tablespace.
ops$tkyte@ORA920> create table uniform_size ( x int, y char(2000) )
  2  tablespace uniform_extents;

Table created.

ops$tkyte@ORA920>
ops$tkyte@ORA920> create table system_size ( x int, y char(2000) )
  2  tablespace system_managed;

Table created.

Now, we'll fill each table to capacity using a loop. Note that the following is an example to illustrate a particular point: how the LMTs will allocate space from multiple files. The goal is to cause the table to extend and grow to fill all available space. In order to accomplish that, we use simple row-at-a-time inserts, followed by a commit. Real production code would use bulk inserts and commit only after all of the inserts were performed, of course. Unfortunately, in order to demonstrate a point, we need to use two extremely bad practices.


ops$tkyte@ORA920> begin
  2   loop
  3     insert into uniform_size values( 1, 'x' );
  4     commit;
  5   end loop;
  6  end;
  7  /
begin
*
ERROR at line 1:
ORA-01653: unable to extend table OPS$TKYTE.UNIFORM_SIZE 
           by 8 in tablespace UNIFORM_EXTENTS
ORA-06512: at line 3


ops$tkyte@ORA920>
ops$tkyte@ORA920> begin
  2   loop
  3     insert into system_size values( 1, 'x' );
  4     commit;
  5   end loop;
  6  end;
  7  /
begin
*
ERROR at line 1:
ORA-01653: unable to extend table OPS$TKYTE.SYSTEM_SIZE 
           by 128 in tablespace SYSTEM_MANAGED
ORA-06512: at line
Now, when we inspect how the extents were allocated, we'll see something very different in the algorithm:
ops$tkyte@ORA920> select segment_name, extent_id, blocks, file_id
  2  from dba_extents
  3  where segment_name in ( 'UNIFORM_SIZE' , 'SYSTEM_SIZE' )
  4  and owner = user
  5  order by segment_name, extent_id
  6  /

SEGMENT_NAME                    EXTENT_ID     BLOCKS    FILE_ID
------------------------------ ---------- ---------- ----------
SYSTEM_SIZE                             0          8         22
SYSTEM_SIZE                             1          8         22
SYSTEM_SIZE                             2          8         22
note extent_id 3..14 were all in FILE_ID 22
SYSTEM_SIZE                            15          8         22
SYSTEM_SIZE                            16        128         23
SYSTEM_SIZE                            17        128         24
SYSTEM_SIZE                            18        128         21
SYSTEM_SIZE                            19        128         22
SYSTEM_SIZE                            20        128         23
SYSTEM_SIZE                            21        128         24
SYSTEM_SIZE                            22        128         21

The output shows the first 16 extents for the system-allocated tablespace all came from the same file (FILE_ID 22 in this case). Oracle did this in order to keep all of the small extents together, to avoid allocating a lot of small extents in many different files in an attempt to reduce any potential fragmentation that might occur if we dropped an object from this tablespace. Only when the extents jumped from 8 blocks (64KB) to 128 blocks (1MB) did the round-robin algorithm come into play. Once we hit 1MB extents, the allocation went to file 23, 24, 21, 22, 23, and so on.

However, with the uniformly sized extents, fragmentation is not a concern, so this method uses round-robin allocation from the start.

UNIFORM_SIZE                            0          8         18
UNIFORM_SIZE                            1          8         19
UNIFORM_SIZE                            2          8         20
UNIFORM_SIZE                            3          8         17
UNIFORM_SIZE                            4          8         18
UNIFORM_SIZE                            5          8         19
UNIFORM_SIZE                            6          8         20
UNIFORM_SIZE                            7          8         17
UNIFORM_SIZE                            8          8         18

UNIFORM_SIZE                          122          8         20
UNIFORM_SIZE                          123          8         17
UNIFORM_SIZE                          124          8         18
UNIFORM_SIZE                          125          8         19
UNIFORM_SIZE                          126          8         20
UNIFORM_SIZE                          127          8         17
151 rows selected.

Most of the time, this difference in allocation doesn't really matter. The round-robin technique will kick in when the object gets large enough to mandate striping. I point it out mostly to show that the round-robin allocation will happen, but a simple test might not make that clear to you. If you allocate fewer than 16 extents in a test, you might be under the impression that it will never round-robin. (In fact, I was under that impression myself; it was only when making a larger test that I discovered the truth.)
</quote> 

I've been shown

Mike, April 22, 2005 - 11:31 am UTC

Thanks.

Perfect.

How to design tablespace

Sean, May 02, 2005 - 6:05 pm UTC

We have multiple applications in the same database. Basically one application is using one schema, though there are interactions among these schemas.

Currently, there are three LMT system-managed tablespaces with block size 32k, 16k and 8k, built on raid 5 file system. We didn’t strictly follow the principle of putting big table into big block size table, since those schemas are managed by different project managers.

Now, we are going to move tablespaces to new storage device, which is configured by SAME technology ( I LEARNED this idea on this site too). Now we are debating whether we should keep the same tablespace structure or design tablespace according to schema. Basically one tablespace is for one schema (or application). The problem is that we don’t have enough information to help us decide which one is better. I need your help to give us some guideline.

Thanks so much for your help.


Tom Kyte
May 03, 2005 - 8:39 am UTC

I would lose the multiple blocksizes -- use tablespaces to make your life easier (whatever makes sense for you) but I don't see the purpose of the multiple blocksizes here.

guideline to design tablespace

Sean, May 03, 2005 - 12:52 pm UTC

Hi Tom,

You mentioned before that using tablespace with different block sizes for different sizes of tables. Is it still valid if we follow the rule?

Becaue of SAME technology, I didn't see any reason to put data in different tablespace in order to decrease I/O.

We just need some GENERAL guideline to design tablespace. Otherwise, we may just put all data in one tablespace, or just organize tablspace by function of data.

Thanks so much for your help.


Tom Kyte
May 03, 2005 - 2:42 pm UTC

with different EXTENT sizes -- i don't believe i've ever said block sizes!


tablespaces have never *never never never* been for performance -- they are all about administration, you use them to make your life easier.


What makes your life "easiest" -- from a backup, restore, administration perspective.

Big table in tablespace with big block size.

Sean, May 03, 2005 - 6:04 pm UTC

But are there merits to put big tables in tablespace with big block size?

Thanks so much.

Tom Kyte
May 03, 2005 - 7:13 pm UTC

no, none that I've seen

for data warehouse type systems, 16 or even 32k blocks make sense.

for most everything else, 8k.

Very big segment in tablespace with big block size.

Sean, May 05, 2005 - 1:09 pm UTC

We do have a few tables having more than million rows, with size varying from 1G to 20G. Do you think that we should put them in tablespace with big block size? If the answer is yes, then which size of segment go to which block size? Something like anything above 10G go to 32K block, anything between 1 and 10G to go 16k block.

Thanks so much for your help.


Tom Kyte
May 05, 2005 - 1:25 pm UTC

no, i do not.



Partition caused fragmentation affecting performance

Gabriel, December 22, 2010 - 3:12 pm UTC

Hello Tom,

One of our architects advocates that partitioning and partitioning date range rollover creates fragmentation if multiple partitions are stored in the same tablespace and therefore recomends that each partition be stored in its own tablespace. Can you please comment on the statement bellow as to whether it makes sense or not?

Most tables, partitions, and sub-partitions within the database have the same tablespace allocation. A significant amount of effort is required for organization of the data within the database. The current requirement is to keep xxx days of data online. Once all xxx days worth of data is populated the database will have created an inadvertent access pattern to the data it stored. When a query is executed against a table, Oracle will have to traverse the same access pattern that was created at the time the data was written. The positioning of data within the tablespace will be relatively unknown to the database. The way in which the database deals with allocating extents and segments is sequential, so loading multiple source feeds at once will create a Swiss cheese effect when data is written to the tablespace. The pattern that is created is diced to whatever the commit interval is set to in the job flow. This will make querying the database after each data load time prohibitive. When the database uses up an extent the database will request another bucket in which to store data allocated to that partition/subpartition.
The physical contention on the tablespace is exasperated by the number of read, write and update operations on tables, which translate into tablespace IO contention. Each tablespace object has been created with the nonparallel option specified; this means that the whole database has to slowdown when a process has to scan multiple partitions of data. Oracle will not spawn any workers when it has to scan partitions unless the parallel hint is specified in the query. This interesting thing about this type of contention is that it’s not easily recognized by storage and UNIX support groups because they will not see any unusual disk activity, namely saturation of the fibre channel devices.
Having no control over where the data is stored in a tablespace presents many issues with respect to archiving, and partition administration. If data is truncated, dropped, or deleted from a partition, holes will appear in the tablespace. With the lack of parallelism, the IO contention and the unorganized data blocks this design needs to be overhauled.

Thank you very much,
Tom Kyte
December 22, 2010 - 5:22 pm UTC

ask the architect "so what effect does the striping we use on our volumes have on this"

and site back and watch some really artistic double speak start happening.

This is utter nonsense as written. It sounds really scientific and wise, but it has no foundation in reality.


a statement like this is really funny:

The pattern that is
created is diced to whatever the commit interval is set to in the job flow.


what does the commit interval have to do with space allocation? (rhetorical question, it has nothing to do with it)

IO contention happens to files. A tablespace is simply a logical container - it is not a physical thing at all - not at all. A tablespace is there to make the life of a DBA easier, nicer. It is not a tuning device.

Each tablespace object has been created with the nonparallel option
specified; this means that the whole database has to slowdown when a process
has to scan multiple partitions of data.


wholly moley - tell this archictect to go back to what architects do - design buildings and bridge - because they don't really know how the database functions. I don't even know what to say about that statement. It is a nonsense statement, it means nothing.

Oracle will not spawn any workers when
it has to scan partitions unless the parallel hint is specified in the query.


what does that, what WOULD that, what COULD that have to do with tablespaces??? Besides being a non sequitor - it is also false. You don't need a hint, if you wanted parallel query on a segment, you can just alter the segment to be parallel - whenever you want.

This interesting thing about this type of contention is that it’s not easily
recognized by storage and UNIX support groups because they will not see any
unusual disk activity, namely saturation of the fibre channel devices.


Oh my gosh, that is brilliant. Does anyone else see what he's done there? He's basically said "you are going to experience performance issues you cannot a) see nor b) measure. They are really bad that way - they are really tricky (and I used the word saturation in a sentence - isn't that cool)".

Imagine - a performance/contention issue you cannot see.


Having no control over where the data is stored in a tablespace presents many
issues with respect to archiving, and partition administration. If data is
truncated, dropped, or deleted from a partition, holes will appear in the
tablespace.


and that should continue with "and oracle will gladly use those holes as it needs more space for other segments later". So what.


There is no lack of parallelism.
There is no contention issue (you would be striping files at the OS level).
There is no such thing as "unorganized data blocks"


there is nothing to read here, move on.




On a serious note - we tend to read data in one of two ways:

a) by rowid (index range scan/table index by rowid)
b) by full scan


Given that, look at the IO's issued by each

a) by rowid... we are given a file/block and slot on block. We do a random IO to a given FILE and a given BLOCK in that file. We don't care about the organization (or lack thereof) of the blocks on disk - we just do a random IO

b) by full scan... We find out about the extents in the table - their file# and lo-block/hi-block.

We then start issues IO's using the multi-block read count (we don't read entire extents in an IO, we read blocks). Now, does it matter if we read blocks that are right next to each other? I hope not because in many cases - our IO size is larger than your stipe size - and even if they are perfect (IO size = strip size) then the IO's we issue are *never* to contiguous sets of blocks.

This is true with parallel query as well.




The bit about this all not being measurable has made my day - that is the best bit of "cover your butt" I've ever heard! "Hey guys, you have bad performance and you cannot see it, you cannot measure it - but believe me - you are"

contigous io

Mark, December 23, 2010 - 8:27 am UTC

Hi Tom,
Please clarify this statement:
"...and even if they are perfect (IO size = strip size) the IO's we issue are *never* to contiguous sets of blocks"

re. stripe size, did you mean RAID or file striping?
But, regardless, when doing table scan you use multiblock read count, so at the tablespace level it is a set of contiguous blocks, and if i remember correctly, you never read multiple extents at once even if the multiblock read count is bigger. So if you set your raid stripe size, extent size, and multiblock read count so that they correlate, then you should be reading contiguous blocks, and if that's the case, we may consider the tablespace as a performance factor because of its allocation unit (extent) size.

Tom Kyte
December 23, 2010 - 11:20 am UTC

stripe size is whatever your disks are striped to - raid striping, asm striping, whatever.


blocks are logically contiguous - but on todays typical file systems they are NOT physically contiguous. they are scattered all over the place. All discussion of "we want to leave the heads in place so we can avoid sync times" is laughable. On todays multi-user systems, with raid/striping, with todays file systems - it doesn't even begin to hold water.

Two things to look at here

a) the concept of "blocks are contiguous". they are NOT. The are logically contiguous - but spread out all over the place on disk. Files are fragmented into pieces all over the place. Even with out raid striping

b) the concept of "it is more efficient on the disk seeking time because the blocks are contiguous". Assume for a moment that blocks are stored physically contiguous - just assume that (it is not true, but go ahead and pretend for a minute). If you read blocks 1-64, and then 65-128 - would there be any efficiencies gained over reading blocks 1-64 and blocks 1001-1064? Answer: no - why? because in between the time you read the first and second sets - someone ELSE would have requested an IO and would have sent the disk heads off else where. We have to seek anyway.

Furthermore since the blocks are only logically contiguous - not physically - there is as good of a chance that blocks 1-64/1001-1064 are next to each other (even better really) than 1-64 and 65-128 are next to each other.



And don't forget - tablespaces are logical containers, not physical. the physical container is a FILE. A tablespace contains many files (in general). Your table is spread over many files (that is good!!) Extents are our way of STRIPING - we want the effect of the data being spread out - our very design makes it so the data is spread out, we do it on purpose.

Adjectives for data architects

Ken Banyas, December 23, 2010 - 12:33 pm UTC

There are too many hilarious sentences in the paragraphs provided.

This one:
Once all xxx days worth of
data is populated the database will have created an inadvertent access pattern to the data it
stored.

An inadvertent access path?

And this:
The physical contention on the tablespace is exasperated by the number of read, write and update
operations on tables..

Huh?

Tom, I realize my comment adds nothing to the discussion, but I have had bad experiences with such database "professionals" in the past.
These people, their analyses, and their language need to be publicized and exposed, and then maybe they won't be able to get any more gigs.

Tom Kyte
December 24, 2010 - 12:08 pm UTC

it is the amazing amount of doublespeak and nonsense-speak in there that caused me to turn the sarcasm up to 11.

If you don't get the meaning of 11,

http://tinyurl.com/377pc6r

all about spinal tap

Thank you, thank you, thank you!!!

Gabriel, December 23, 2010 - 1:10 pm UTC

Thank you soooo much Tom for your quick reply! Priceless.

Techno-Gobbledygook

SeanMacGC, December 24, 2010 - 4:05 am UTC

That's one of the funniest pieces I've seen in a while.

All that were missing was the assertion that the earth is actually flat after all, and how you might have liked to purchase a vial of the Elixir of Youth :)

This is nothing

Gabriel, January 07, 2011 - 10:33 am UTC

Thank you very much for your help again Tom. The phone calls were even funnier, you should hear them talk about the "commingling of tablespaces". However I was not able to convince them that the stuff they were talking about did not exist even if I pointed them to the Concepts documentation.

Does data tablespace and index tablespace affect performance?

A reader, April 25, 2012 - 10:49 am UTC

Tom,
Is there a performance reason for separating data and indexes in different tablespaces? or is about simplify administration.
Tom Kyte
April 25, 2012 - 1:34 pm UTC

it is all about book-keeping and nothing about performance.

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1641403100346018269

And materialized views

Alwin Dieperink, February 04, 2013 - 10:22 am UTC

Hello,

What about materialized views which are rebuilt every night. Would you leave them in the same tablespace as the data or would a separate tablespace be better (performance, fragmentation, ...) ? Both tablespaces would be on the same device in our case.

Regards
-- Alwin

Tom Kyte
February 06, 2013 - 6:49 am UTC

it is entirely a "what makes you feel better" situation.

performance wise - I'd assume everything is striped anyway so every tablespace is more or less the same as any other tablespace performance wise (every tablespace is interleaved with every other tablespace - all of the disks you have for tablespaces are striped).

fragmentation wise, if you are doing a complete refresh - that should be done as a truncate + direct path load. truncate = free all space, direct path load will reuse that. Assuming a locally managed tablespace - no issues with fragmentation. (use atomic=>false during the refresh, else you are using delete+insert for the complete refresh - truncate+direct path load should be more efficient although the materialized views will 'dsiappear' during the refresh.


you don't have to backup materialized views (or indexes) since they can easily be reconstructed from the source tables so you could consider their own tablespace and skipping that one during backup if they are sizable.

Tablespaces

A reader, February 06, 2013 - 6:54 am UTC