Limit the size of data with time windows
You can limit the amount of data in a data mart for time series data by using time windows.
Create time windows
ifx_TSDW_createWindow('demo_dwa', 'demo_mart', 'informix', 'ts_data_v', 0, 3);
ifx_TSDW_createWindow('demo_dwa', 'demo_mart', 'informix', 'ts_data_v', 12, 15);
ifx_TSDW_createWindow('demo_dwa', 'demo_mart', 'informix', 'ts_data_v', 24, 27);
ifx_TSDW_createWindow('demo_dwa', 'demo_mart', 'informix', 'ts_data_v',
'2010-01'::datetime year to month, '2010-04'::datetime year to month);
ifx_TSDW_createWindow('demo_dwa', 'demo_mart', 'informix', 'ts_data_v',
'2011-01'::datetime year to month, '2011-04'::datetime year to month);
ifx_TSDW_createWindow('demo_dwa', 'demo_mart', 'informix', 'ts_data_v',
'2012-01'::datetime year to month, '2012-04'::datetime year to month);
This figure shows three time windows that each contain three virtual partitions:
The initial window for a time series virtual table must be created before the data mart is initially loaded (the data mart must be in LoadPending state). Subsequent time windows can be created either before the data mart is initially loaded, or when the data mart is in Active state. When you create a time window in an Active data mart, the time series data for the new time window is loaded to the data mart immediately.
Remove time windows
ifx_TSDW_dropWindow('demo_dwa', 'demo_mart', 'informix', 'ts_data_v', 0);
Or
by using a time stamp to identify the time window:ifx_TSDW_dropWindow('demo_dwa', 'demo_mart', 'informix', 'ts_data_v',
'2010-01'::datetime year to month);
This figure shows two time windows that each contain three virtual partitions.
You can remove time windows when the data mart is in LoadPending or Active state. When you remove a time window in an Active data mart, the time series data for the time window is removed from the data mart immediately.Move time windows
After you create time windows and load the data into the data mart, you can move the time windows forward or backward by a specified number of virtual partitions. When you move a time window, any virtual partition that is no longer contained in the time window is dropped from the data mart. Any virtual partition that is included in the moved time window is loaded into the data mart. You move time windows by running the ifx_TSDW_moveWindows() routine. The virtual partition default value is 1.
ifx_TSDW_moveWindows('demo_dwa', 'demo_mart', 'informix', 'ts_data_v');
That
is equivalent to: ifx_TSDW_moveWindows('demo_dwa', 'demo_mart', 'informix', 'ts_data_v', 1);
This figure shows that two time windows are moved forward in time by one time interval: