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.

 

Using a Validation Column

In this example, the a list of "valid" product numbers is retrieved from the database and exported to an OST (Omnidex Stand-alone Table) using the ODXSQL EXPORT command. This OST is then "ATTACHed" and used with the PARTITION command in a WITH options clause.

When the data is partitioned, all records with "invalid" product numbers will be stored in a partition together, while records with valid product numbers will be stored in partitions according to the settings in the PARTITION command. The partition with invalid product numbers can be removed, updated with correct data, or ignored.

The partition.rpt file is now slightly different from other example. the "Valid" and "Valid %" columns have more meaningful data in them, as shown below.

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.

First, valid product numbers are selected and exported to an ost named x. The physical export file name will be x.ost.

> export (select product_no) from products where product_no >= 'A') to x with ost, delete
93 rows exported to x

Next, the ost is attached and named "VALID" so it can be referenced in the PARTITION command's WITH clause.

> attach ost x as VALID
Table VALID attached

Finally, the PARTITION command is executed using the WITH option VALIDATION_COLUMN='VALID.product_no'

>partition orders into 5 by product_no in dat with validation_column='valid.product_no'
Partitioned 200 rows into 5 partitions

The records with valid product numbers are partitioned between the first 4 partitions. The records with invalid product numbers are grouped together in the 5th partition.

>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
G523
DM20
BRSP

50
9
9
8
8
7
7
2

Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid

25.000%
4.500%
4.500%
4.000%
4.000%
3.500%
3.500%
1.000%

26.178%
4.712%
4.712%
4.188%
4.188%
3.665%
3.665%
1.047%

ORDERS02
P900
G520
MPOP
IC95
T750
B290
B390
B455
P224

50
7
7
6
6
5
5
5
5
4

Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid

25.000%
3.500%
3.500%
3.000%
3.000%
2.500%
2.500%
2.500%
2.500%
2.000%

26.178%
3.665%
3.665%
3.141%
3.141%
2.618%
2.618%
2.618%
2.618%
2.094%

ORDERS03
P225
HO30
H400
B190
H736
N820
N972
PH65
S100
OSER
HPMP
EDMP
GEHE

50
5
5
5
4
4
4
4
4
4
3
3
3
2

Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid

25.000%
2.500%
2.500%
2.500%
2.000%
2.000%
2.000%
2.000%
2.000%
2.000%
1.500%
1.500%
1.500%
1.000%

26.178%
2.618%
2.618%
2.618%
2.094%
2.094%
2.094%
2.094%
2.094%
2.094%
1.571%
1.571%
1.571%
1.047%

ORDERS04
DM23
C478
P160
L722
HLTC
L433
MTAC
PBSP
SCFP
CGPP
BTCT
SSST
SWFL
AEWP
OSTC
AQPP
GTLC
BMLF
PDMP
PGMP
BMED
XPCP
S25P
SCDR
ACPC
ADLB
AAWP
GUOC
MMRB

41
3
3
3
3
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

Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid
Valid

20.500%
1.500%
1.500%
1.500%
1.500%
1.000%
1.000%
1.000%
1.000%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%
0.500%

20.500%
1.571%
1.571%
1.571%
1.571%
1.047%
1.047%
1.047%
1.047%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%
0.524%

ORDERS05
3MTP
3SAD
3DST
3RGS
3P23

9
3
2
2
1
1

Invalid
Invalid
Invalid
Invalid
Invalid
Invalid

4.500%
1.500%
1.000%
1.000%
0.500%
0.500%

0.000%
0.000%
0.000%
0.000%
0.000%
0.000%

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

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

-------

---------
100.00%

---------
100.00%

End of report

 

 

 

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

 

 

Using Expressions

In this example, an expression is used to partition the table according to the first letter in the product number. This is useful if the product numbers or in some way codified. For example, all computers and computer accessories begin with the letter C and furniture begins with the letter F. This expression keeps these items grouped together in the partitions.

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 "substring(product_no from 1 for 1)" in dat
Partitioned 200 rows into 5 partitions

>view partition.rpt

OmniAccess Partitioning Report

Database:
Table:
Approach:

Star:
Orders:
200 rows split by substring(product_no from 1 for 1) into 5 equal partitions

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

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

Valid
-------

Total %
---------

Valid %
---------

ORDERS01
H

45
45

 

22.500%
22.500%

22.500%
0.000%

ORDERS02
P
D
X

38
27
10
1

 

19.000%
13.500%
5.000%
0.500%

19.000%
0.000%
0.000%
0.000%

ORDERS03
B
A

37
24
13

 

18.500%
12.000%
6.500%

18.500%
0.000%
0.000%

ORDERS04
G
M
S

36
18
9
9

 

18.000%
9.000%
4.500%
4.500%

18.000%
0.000%
0.000%
0.000%

ORDERS05
3
N
I
L
T
O
C
E

44
9
8
6
5
5
4
4
3

 

22.000%
4.500%
4.000%
3.000%
2.500%
2.500%
2.000%
2.000%
1.500%

22.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