SQL/MX 2.x Query Guide (G06.24+, H06.03+)

Accessing SQL/MX Data
HP NonStop SQL/MX Query Guide523728-003
2-18
MDAM’s Use of DENSE and SPARSE Algorithms
When the compiler chooses a SPARSE algorithm, the executor executes only the
SPARSE algorithm and does not attempt to switch to a DENSE algorithm.
You can force the choice by specifying the SPARSE or DENSE option in the
CONTROL QUERY SHAPE statement. If you force a DENSE algorithm, the executor
does an adaptive DENSE or SPARSE and switches accordingly when it finds that the
chosen algorithm is not efficient for the column it is accessing. If you force a SPARSE
algorithm, the executor uses only the SPARSE algorithm.
In the next figure, Table A shows that Col. 1 has values that always increase by one. If
the compiler chooses MDAM DENSE, the executor starts with DENSE until it discovers
a gap in the useful information requested, and then it switches to SPARSE. With the
SPARSE algorithm, the executor must retrieve a row to determine the next actual
value in a column. If the compiler chooses SPARSE, the executor does not attempt
DENSE.
TABLE A, Col 1
VST027.vsd
5
6
7
Dense
15
16
17
18
19
Sparse
Dense