Skip to content

pt_histogram_intervals

ptrb edited this page Jun 9, 2013 · 1 revision

Name and Parameters

pt_histogram_intervals( PostTIME , text ) : SET of PostTIME

Description

This function divides the first argument's temporal bounding box into single histogram-intervals. The duration of this intervals is specified by the second argument as ISO8601-duration-string. The function tries to produce even interval boundaries. The resulting intervals are returned as a SET of type PostTIME.

Examples

SELECT pt_histogram_intervals('2012/2020','P1Y');
-- result
'CAL0012012-01-01T00:00:00.000Z/2013-01-01T00:00:00.000Z'
'CAL0012013-01-01T00:00:00.000Z/2014-01-01T00:00:00.000Z'
'CAL0012014-01-01T00:00:00.000Z/2015-01-01T00:00:00.000Z'
'CAL0012015-01-01T00:00:00.000Z/2016-01-01T00:00:00.000Z'
'CAL0012016-01-01T00:00:00.000Z/2017-01-01T00:00:00.000Z'
'CAL0012017-01-01T00:00:00.000Z/2018-01-01T00:00:00.000Z'
'CAL0012018-01-01T00:00:00.000Z/2019-01-01T00:00:00.000Z'
'CAL0012019-01-01T00:00:00.000Z/2020-01-01T00:00:00.000Z'
'CAL0012020-01-01T00:00:00.000Z/2021-01-01T00:00:00.000Z'

SELECT pt_histogram_intervals('2012-3-5/2020-8-5','P1Y');
-- result
'CAL0012012-01-01T00:00:00.000Z/2013-01-01T00:00:00.000Z'
'CAL0012013-01-01T00:00:00.000Z/2014-01-01T00:00:00.000Z'
'CAL0012014-01-01T00:00:00.000Z/2015-01-01T00:00:00.000Z'
'CAL0012015-01-01T00:00:00.000Z/2016-01-01T00:00:00.000Z'
'CAL0012016-01-01T00:00:00.000Z/2017-01-01T00:00:00.000Z'
'CAL0012017-01-01T00:00:00.000Z/2018-01-01T00:00:00.000Z'
'CAL0012018-01-01T00:00:00.000Z/2019-01-01T00:00:00.000Z'
'CAL0012019-01-01T00:00:00.000Z/2020-01-01T00:00:00.000Z'
'CAL0012020-01-01T00:00:00.000Z/2021-01-01T00:00:00.000Z'

SELECT pt_histogram_intervals('2012-3-5/2020-8-5','P1Y6M');
-- result
'CAL0012012-03-01T00:00:00.000Z/2013-09-01T00:00:00.000Z'
'CAL0012013-09-01T00:00:00.000Z/2015-03-01T00:00:00.000Z'
'CAL0012015-03-01T00:00:00.000Z/2016-09-01T00:00:00.000Z'
'CAL0012016-09-01T00:00:00.000Z/2018-03-01T00:00:00.000Z'
'CAL0012018-03-01T00:00:00.000Z/2019-09-01T00:00:00.000Z'
'CAL0012019-09-01T00:00:00.000Z/2021-03-01T00:00:00.000Z'

Processable Objects

| CAL | TCS | ORD ---|---|---|--- TM_Instant | ✗ | ✗ | ✗ TM_Period | ✔ | ✔ | ✗ MultiInstant | ✗ | ✗ | ✗ MultiPeriod | ✗ | ✗ | ✗ RegularMultiInstant | ✗ | ✗ | - RegularMultiPerid | ✗ | ✗ | - ✔ : Processable

✗ : Call will cause an error

∼ : Callable without error, but returns only a pseudo result

Related functions


List of SQL Functions