DURATION...BEFORE
DURATION...AFTER
DURATION...FROM/TO
SEARCH
The DURATION clause is used in the SELECT statement to set the data retrieval scope as a time reference. The biggest advantage of this DURATION is that it greatly affects SELECT performance because the database narrows the range of data to visit. As mentioned above, Machbase is extremely easy to access data based on specific time because all data is partitioned based on time axis. One important point is that the reference time for this duration is not the user-specified column, but the ‘_arrival_time’ column, which is an internal data type. Therefore, to use Machbase most efficiently, you do not need to define a separate time column, but rather use the internal column ‘_arrival_time’, which is specified at the moment when data is stored in Machbase.
Machbase outputs data in the reverse order. That is from the latest data to old data and all the basic data operations follow this order. However, because it is also common to actually retrieve data from a certain point in the past to future directions, Machbase supports AFTER command. The syntax is defined as follows.
Syntax:
DURATION time_expression [BEFORE time_expression | TO_DATE(time) ]; DURATION time_expression [AFTER TO_DATE(time)]; time_expression - ALL - n year - n month - n week - n day - n hour - n minute - n second