A tablespace extent map is created with the creation of a DMS tablespace. In simpler words it depicts how data is actually laid out on the containers of the tablespace. Data across different containers of a DMS tablespace is laid out one extent at a time.
For example:
CREATE TABLESPACE DMSTBSP1
MANAGED BY DATABASE
USING (FILE '/data/dmstbsp.cont0' 64)
USING (FILE '/data/dmstbsp.cont1' 48)
USING (FILE '/data/dmstbsp.cont2' 64)
USING (FILE '/data/dmstbsp.cont3' 80)
EXTENTSIZE 8;
This command will create a DMS tablespace DMSTBSP1 with four containers of different size.
The tablespace extent map for this tablespace would look something like this:
|
Stripes |
Container0 |
Container1 |
Container2 |
Container3 |
|
0 |
0 |
1 |
2 |
3 |
|
1 |
4 |
5 |
6 |
7 |
|
2 |
8 |
9 |
10 |
11 |
|
3 |
12 |
13 |
14 |
15 |
|
4 |
16 |
17 |
18 |
19 |
|
5 |
20 |
|
21 |
22 |
|
6 |
23 |
|
24 |
25 |
|
7 |
26 |
|
27 |
28 |
|
8 |
|
|
|
29 |
|
9 |
|
|
|
30 |
For the sake of simplicity we have assumed that all extents in the containers are useable. In actuality, there are atleast 4 extents in a container which are reserved for storing things like the container tag and the tablespace metadata.
Notice how the extents are striped across the containers one extent at a time. The tablespace map for such a distribution would be something similar to this:
Table space map:
Range Stripe Stripe Max Max Start End Adj. Containers
Number Set Offset Extent Page Stripe Stripe
[0] [0] 0 19 159 0 4 0 4(0,1,2,3)
[1] [0] 0 28 231 5 7 0 3(1,2,3)
[2] [0] 0 30 247 8 9 0 1(3)
Now let us consider two scenarios where we extend the containers 0,1 and 2 and make all of them 80 pages to match container 3.
Alter tablespace DMSTBSP1 resize (FILE '/data/dmstbsp.cont0' 80, FILE '/data/dmstbsp.cont1' 80, FILE '/data/dmstbsp.cont2' 80);
1. Tablespace has data till extent number 14
In this case, since all the data is in range [0] and it is uniformly spread across all the 4 containers there would be no need for a data rebalance.
2. Tablespace has data till extent number 29
In this case, when extending the containers 0,1 and 2 to match the size of container 3, db2 will move the data around such that the extents are laid out evenly across all the containers. The new tablespace map would look something like:
|
Stripes |
Container0 |
Container1 |
Container2 |
Container3 |
|
0 |
0 |
1 |
2 |
3 |
|
1 |
4 |
5 |
6 |
7 |
|
2 |
8 |
9 |
10 |
11 |
|
3 |
12 |
13 |
14 |
15 |
|
4 |
16 |
17 |
18 |
19 |
|
5 |
20 |
21 |
22 |
23 |
|
6 |
24 |
25 |
26 |
27 |
|
7 |
28 |
29 |
30 |
31 |
|
8 |
32 |
33 |
34 |
35 |
|
9 |
36 |
37 |
38 |
39 |
Table space map:
Range Stripe Stripe Max Max Start End Adj. Containers
Number Set Offset Extent Page Stripe Stripe
[0] [0] 0 39 319 0 9 0 4(0,1,2,3)
Remember the best practice is to always have equally sized containers in your DMS tablespaces. If you need to reduce/extend the container size, do it across all the containers in your tablespace.
| Comments |
|





