Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 576 Bytes

File metadata and controls

45 lines (35 loc) · 576 Bytes

=======

create town table

SELECT create_town_table('table_name');

insert

Insert to town table:

INSERT INTO
    table_name(ts, tags, data)
VALUES
    (Now(), '{town, db, timeseries}', '{"val": 21324}');

select by tag

SELECT
    ts, tags, data->>'val' as val
FROM
    table_name
WHERE
    'town'=ANY(tags);

select in time range

SELECT
    ts, tags, data->>'val' as val
FROM
    table_name
WHERE
    ts BETWEEN '2021-08-02 00:00:00'::timestamp AND Now()::timestamp;