Hi Helmut,
of course there are ways to do character partitioning, but it will be based on how the table is accessed, e.g.
SAP_CODE = 'xxxx', SAP_CODE BETWEEN 'xxxx' and 'yyyy', SAP_CODE LIKE 'X%', etc.
One possible way:
SAP_CODE CHAR(4) UPPERCASE NOT CASESPECIFIC NOT NULL
...
PARTITION BY (RANGE_N(SAP_CODE BETWEEN
'A000' AND 'A999'
,'B000' AND 'B999'
,'C000' AND 'C999'
...
,'Z000' AND 'Z999'),
RANGE_N(SUBSTRING(SAP_CODE FROM 2) (INT) BETWEEN 0 AND 999 EACH 1));
This should work for all of them, but when it's not equality it will access all 1000 subpartitions of a character.
You might get the best partition elimination when the column is split into two, SAP_CODE1 CHAR(1) and SAP_CODE2 SMALLINT, but this would probably require some major rework.
When it's mainly SAP_CODE = 'xxxx' then the existiing partitioning might be ok, too.
Dieter
↧