I want to find the starting- and ending point of a DB2 range partition with a query. Is it possible to query these values from any of the system-tables?
A little more context for my problem:
We modified some of our huge tables so they're partitioned in daily parts:
CREATE TABLE orders(id INT, CRDTTM TIMESTAMP, …)
PARTITION BY RANGE(CRDTTM)
(
(STARTING ('2014-10-01') ENDING ('2015-15-31') EVERY 1 DAY)
)
Is it possible to query the starting- and ending point with normal SQL afterwards? I need to modify a stored procedure that we use so it filters rows that have a timestamp outside of this range (the tables are in a data ware house that's only loaded with data from a short timeframe).
As for the environment:
We're running a DB2 LUW Version 10.5 on a SUSE Enterprise 11 server. The tables in question are row-based.
Look at the table SYSCAT.DATAPARTITIONS
, specifically the LOWVALUE
, HIGHVALUE
and the LOWINCLUSIVE
and HIGHINCLUSIVE
columns.