Home

Getting Started

Utilities

Indexing

Omnidex

Development

Tutorials

Quick Links

 

OMNIDEX

Partitioning

By Column

Into Equal Partitions

By Column into Equal Partitions

Using a Validation Column

Using Expressions

Generate Environment File Entry

Indexes

 

Partitioning

1. Analysis

2. Partition the Table

3. Environment File Entry

4. Indexing

Examples

Examples

These examples demonstrate partitioning a table :

By Column

Into Equal Partitions

By Column into Equal Partitions

Using a Validation Column

Using Expressions

Generate Environment File Entry

Partition the Table

The "By Column" and "Into Equal Partitions" examples are not very efficient approaches to partitioning but are shown to demonstrate exactly how each individual action affects the partitioning. Combining both methods, however, can produce a very effective partitioning scheme, as shown in the "By Column into Equal Partitions" example.

The "Using a Validation Column" and "Using Expressions" examples are good demonstrations of flexible and effective partitioning schemes.

The orders table in these examples has 200 rows of order details. In each example, notice the command "view partition.rpt". This command simply displays the contents of the partition.rpt text file generated by ODXSQL when the PARTITION command is executed.

 

Partition by Column

The table is partitioned into two partitions, because the status column has only two unique values. This partitioning approach is ineffective because 96% of the records are in the first partition. No performance is achieved in this example.

There may be circumstances when this approach is appropriate, for example, partitioning on a YEAR column.

This example is shown to demonstrate exactly how this approach affects the partitions. See the third example below for a better, more effective approach.

Note that the "in dat" statement instructs ODXSQL to place the partitions into the dat subdirectory of the current working directory. This clause is optional.

>partition orders by status in dat
Partitioned 200 rows into 2 partitions

>view partition.rpt

OmniAccess Partitioning Report

Database:
Table:
Approach:

Star:
Orders:
200 rows split by STATUS into individual partitions

Partition Value
-----------------

Cardinality
-------------

Valid
-------

Total %
---------

Valid %
---------

ORDERS01
SH

192
192

 

96.000%
96.000%

96.000%
96.000%

ORDERS02
CN

8
8

 

4.000%
4.000%

4.000%
4.000%

-----------------
Total

-------------
200

-------

---------
100.00%

---------
100.00%

End of report

 

 

 

---------------- End of file --------------

 

 

Into Equal Partitions

The next example shows partitioning a table into equal partitions, not by column.

By itself, this method of partitioning is not very effective because all of the partitions will be searched for every query. It is shown to demonstrate exactly how this method affects partitions. See the third example below for a better partitioning approach.

Note that the "in dat" statement instructs ODXSQL to place the partitions into the dat subdirectory of the current working directory. This clause is optional.

>partition orders into 5 in dat
Partitioned 200 rows into 5 partitions

>view partition.rpt

OmniAccess Partitioning Report

Database:
Table:
Approach:

Star:
Orders:
200 rows split into 5 equal partitions

Partition Value
-----------------

Cardinality
-------------

Valid
-------

Total %
---------

Valid %
---------

ORDERS01
ORDERS02
ORDERS03
ORDERS04
ORDERS05

40
40
40
40
40

 

20.000%
20.000%
20.000%
20.000%
20.000%

20.000%
20.000%
20.000%
20.000%
20.000%

-----------------
Total

-------------
200

-------

---------
100.00%

---------
100.00%

End of report

 

 

 

---------------- End of file --------------

 

Into Equal Partitions By Column

The next example shows partitioning a table into equal partitions by a column.

This method combines the first two methods shown above. It is more effective than both previous approaches because it limits the number of partitions, the partitions are divided as evenly as possible, and unique values in the partition qualifier to be stored together in a single partition. This last item causes queries that specify criteria against the partition qualifier to search only one partition.

Note that the "in dat" statement instructs ODXSQL to place the partitions into the dat subdirectory of the current working directory. This clause is optional.

>partition orders into 5 by product_no in dat
Partitioned 200 rows into 5 partitions

>view partition.rpt

OmniAccess Partitioning Report

Database:
Table:
Approach:

Star:
Orders:
200 rows split by PRODUCT_NO into 5 equal partitions

Partition Value
-----------------

Cardinality
-------------

Valid
-------

Total %
---------

Valid %
---------

ORDERS01
H672
H100
A940
HL6P
MPOP

40
9
9
8
8
6

 

20.000%
4.500%
4.500%
4.000%
4.000%
4.000%

20.000%
0.000%
0.000%
0.000%
0.000%
0.000%

ORDERS02
G523
DM20
P900
G520
IC9S
T750

39
7
7
7
7
6
5

 

19.500%
3.500%
3.500%
3.500%
3.500%
3.000%
2.500%

20.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%

ORDERS03
B290
B390
B455
P225
HO30
H400
P224
B190
BRSP

40
5
5
5
5
5
5
4
4
2

 

20.000%
2.500%
2.500%
2.500%
2.500%
2.500%
2.500%
2.000%
2.000%
1.000%

20.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%

ORDERS04
H736
N820
N972
PH65
S100
OSER
HPMP
EDMP
DM23
C478
3MTP
GEHE

40
4
4
4
4
4
3
3
3
3
3
3
2

 

20.000%
2.000%
2.000%
2.000%
2.000%
2.000%
1.500%
1.500%
1.500%
1.500%
1.500%
1.500%
1.000%

20.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%

ORDERS05
P160
L722
HLTC
L433
3SAD
MTAC
3DST
PBSP
SCFP
CGPP
BTCT
SSST
SWFL
AEWP
OSTC
AQPP
GTLC
3RGS
3P23
BMLF
PDMP
PGMP
BMED
XPCP
S25P
SCDR
ACPC
ADLB
AAWP
GUOC
MMRB

41
3
3
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

 

20.500%
1.500%
1.500%
1.000%
1.000%
1.000%
1.000%
1.000%
1.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%

20.500%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%
0.000%

-----------------
Total

-------------
200

-------

---------
100.00%

---------
100.00%

End of report

 

 

 

---------------- End of file --------------

 

Top