SQL/MX 3.x Query Guide (H06.22+, J06.11+)

SQL/MX Operators
HP NonStop SQL/MX Query Guide640323-001
7-59
SAMPLE_FILE_SCAN Operator
For more information about data mining, see the SQL/MX Data Mining Guide.
The following is an example of the SAMPLE operator:
prepare TestQuery34 from
select [first 180] * from t064t5
sample periodic 1 rows every 100 rows
for read uncommitted access;
DESCRIPTION
fragment_id ............ 2
parent_frag ............ 0
fragment_type .......... dp2
sample_type ............ PERIODIC
sampled_columns ........ NotCovered(DETCAT.DETSCH.T064T5.A),
NotCovered(DETCAT.DETSCH.T064T5.B)
balance_expression ..... ((0 block (0 assign (cast(0 AS
NUMERIC(11) SIGNED) + cast(1 AS
NUMERIC(11) SIGNED)))) block
case(if_then_else((0 <= 0), 0,
if_then_else((0 < 1), 1,
if_then_else((1 > 0), ((0 assign
(1 - 100)) block 1 ), 0)))))
SAMPLE_FILE_SCAN Operator
The SAMPLE_FILE_SCAN operator occurs as a result of a sample clause in a query,
where it is possible to read randomly after satisfying the conditions mentioned in the
query. This operator has no child node. The description field for this operator contains:
balance_expression Expression representing the sampling
expression. A simple random selection, but
could be more complex if the sample clause
contains a balance clause.
expr(text)
sample_type Indicates the type of sampling being
performed. Possible values are RANDOM,
PERIODIC, FIRST, and CLUSTER.
text
required_order Specified order keys for a sample operation. expr(text)
Token Followed by ... Data Type
fragment_id A sequential number assigned to the fragment.
0 is always the master executor and 1 is
reserved for the EXPLAIN plan. Numbers 2 to
n will be ESP or DAM fragments.
integer
parent_frag The fragment_id for the parent of the current
fragment. The value is (none) for the master
executor.
integer
fragment_type Master, ESP, or DP2. text