Monokot Server 1.x
  • What is Monokot Server?
  • Quickstart
  • 🐸Basics
    • Supported OS and Hardware
    • Installation
    • Licensing
    • OPC UA
      • UA TCP Endpoint
      • UA Settings
      • Client Certificates
      • Aliases
      • Access to Object Settings
      • Troubleshooting
    • Security Certififcate
    • Users & Roles
    • Administrator GUI
      • Event Log
      • Users in Monokot Server Administrator
      • Roles in Monokot Server Administrator
    • Startup Parameters
  • 🦊Tags & Devices
    • Devices
      • Diagnostics
      • Devices in the Monokot Server Administrator
    • Tags
      • Parameters
      • Change Trigger
      • Tags in Monokot Server Administrator
        • Go Online
        • Group Action
        • Import & Export
    • Modbus Connectivity
      • Parameters
      • Addressing
      • Diagnostics
    • Siemens Connectivity
      • Parameters
      • Addressing
      • Access to DBs area in S7-1200/S7-1500
    • IEC 60870-5-104 Connectivity
      • Parameters
      • Addressing
      • Time Conversion
      • Diagnostics and Commands
    • OPC UA Connectivity
      • Parameters
      • Addressing
      • Diagnostics
      • How to: Importing OPC UA items
      • How to: Pulling Security Certificate
    • InfluxDB Connectivity (Connector)
      • Parameters
      • Addressing
      • Query Result and Data Mapping
      • Diagnostics
      • How to: Configure for InfluxDB 2.x
    • SNMP Connectivity
      • Parameters
      • Addressing
      • UDP Considerations
  • 🐺Time Series & Stores
    • Stores
      • Backlog
      • Diagnostics
      • Stores in Monokot Server Administrator
    • Time Series
      • Parameters
      • Deadband
      • Sampling
      • Last Sample Repeat
      • Time Series in Monokot Server Administrator
        • Group Action
        • Import & Export
    • InfluxDB Connectivity (Store)
      • Parameters
      • Addressing
      • Data Structure
      • About Metadata
      • Diagnostics
      • How to: Configure for InfluxDB 2.x
    • PostgreSQL Connectivity
      • Parameters
      • Addressing
      • Database Design
      • Data Compression
    • REST Connectivity
      • Parameters
      • Addressing
      • Message Script
      • RestRequestMessage
      • DataContext
      • TimeSeries
  • 🐻Scripts
    • Overview
    • Expression
      • Parameters
      • Import & Export
      • Go Online
    • Programming Examples
      • How to: Calculate Arithmetic Mean
      • How to: DoNothing
      • How to: Writing to Tag
      • How to: Inverting Bits
      • How to: Execute SQL
      • How to: Run Ping
      • How to: Do Simulation
      • How to: String Formatting
      • How to: OPC UA Method
      • How to: Initialize Device Settings from File
    • API
      • Bundle
      • BundlePair
      • Context
      • DataMap
      • DataMapPair
      • DataTriggerInfo
      • Expression
      • MosCrypto
      • MosDirectories
      • MosFiles
      • MosOdbc
      • MosOdbcReader
      • MosProcess
      • MosProcessExecuteResult
      • MosText
      • MosUtils
      • ValueState
Powered by GitBook
On this page
  1. Time Series & Stores
  2. PostgreSQL Connectivity

Database Design

By default, the store creates a database and two tables: tssamples_metadata and tssamples_data. Metadata of the time series associated with the store is placed In tssamples_metadata, while the time series values are written in tssamples_data.

Structure of the time series metadata table (tssamples_metadata):

tag_set [PK]

jsonb

server_uid

text

store_uid

text

ts_uid

text

ts_path

text

ts_comment

text

tag_set_id

integer

  • tag_set: The column is the primary key of the table and is of the JSONB type. The column is a set of attributes or tags (key-value pairs) identifying a time series. By default, the set contains only one tag, tsid, representing the address of the time series. However, by changing parameters from the Advanced category, you can add additional tags. For example, if you set the parameter Add Time Series Comment to Tag, a tsc tag will be added to the set containing a comment to the series.

  • server_uid: The column is of the TEXT type and contains a unique server identifier.

  • store_uid: The column is of the TEXT type and contains unique store identifier.

  • ts_uid: The column is of the TEXT type and contains unique time series identifier.

  • ts_path: The column is of the TEXT type and contains path to time series. The values of this column are indexed.

  • ts_comment: The column is of the TEXT type and contains comment for time series.

  • tag_set_id: The column is of the INTEGER type, is auto-incremental and contains unique numeric identifier for time series.

Structure of the time series data table (tssamples_data):

sample_time

timestamp without time zone

tag_id

integer

sample_value

double precision

sample_status

integer

  • sample_time: The column is of the TIMESTAMP WITHOUT TIME ZONE type and contains measurement time. The values of this column are indexed.

  • tag_id: The column is of the INTEGER type and contains the link to the tag_set_id column from the tssamples_metadata table. The values of this column are indexed.

  • sample_value: The column is of the FLOAT8 type and contains the sample value.

  • sample_status: The column is of the INTEGER type and contains the sample status.

Below is an example of a database query that will return data for a 5-minute interval for time series with the paths MySeries.Temperature and MySeries.Pressure:

SELECT m.ts_path, d.sample_time, d.sample_value, d.sample_status
FROM public.tssamples_data d
JOIN public.tssamples_metadata m ON m.tag_set_id = d.tag_id
WHERE d.sample_time BETWEEN '2020-03-20T09:20:00' AND '2020-03-20T09:25:00'
AND (m.ts_path = 'MySeries.Temperature' OR m.ts_path = 'MySeries.Pressure')
ORDER BY m.tag_set_id, d.sample_time DESC

Note that the time of this query is in the UTC format.

PreviousAddressingNextData Compression

Last updated 2 years ago

🐺