The Databases for PostgreSQL data component

The IBM® Cloud Databases for PostgreSQL data component provides intermediate length storage of your IoT data.

Overview

Databases for PostgreSQL is a database for your recent historical IoT data.

Databases for PostgreSQL also makes up the data lake, which is used as input for the analytics service. Analytics Service writes function output to the data lake.

Data flow

Platform Service collects and retains IoT data for direct access and processing and also for historical storage and analytics with Platform Service.

The following steps constitute the data flow:

  1. Your IoT devices send data to the Platform Service, which acts as a message broker and real-time handler of IoT data.
  2. Device type data is immediately written to the Databases for PostgreSQL table (iot_devicetype).
    To store IoT data from your connected devices your environment must meet the IBM Maximo Asset Monitor, messaging, and Databases for PostgreSQL requirements.
  3. Analytics Service: Derived function data is written to function specific tables.
  4. IoT device data and the Analytics Service derived function data is not automatically purged but must be managed manually.

Platform Service offering architecture diagram. This graphic is explained in the surrounding text.

Access information

Access information and credentials for the Databases for PostgreSQL user interface and REST API can be found on the user interface. For detailed steps, see the Get Databases for PostgreSQL credentials section.

Requirements

In addition, to store IoT data from your connected devices in Databases for PostgreSQL, your environment must meet the following requirements:

Maximo Asset Monitor requirements

The following requirements apply to messaging and to your Maximo Asset Monitor instance.

Databases for PostgreSQL requirements

The following requirements apply to your Databases for PostgreSQL instance.

Default settings for Databases for PostgreSQL

The following default configuration settings are used:

Schemas and tables

In Databases for PostgreSQL, IoT device data is stored as tables. Maximo Asset Monitor automatically creates all schemas and tables to manage all data insertion.

General Platform Service tables

All user-accessible IoT data is stored in tables according to device type and uses the following naming convention: iot_devicetype.

The following tables are available:

Table Details
iot_devicetype This device type main table contains all device data for the current schema.
iot_devicetype_v+timestamp These tables are automatically created when the schema is updated and contain data for the replaced schema, which is identified by the time stamp. For more information, see the Requirements section.

Tip: All tables use the Cloudant NoSQL DB '_ID' parameter as the primary key.

The following identifiers are used in the previous table:

The iot_devicetype tables are used by and controlled by Platform Service and must not be the target for any SQL operations except QUERY.

The following Platform Service logical interface driven schema upgrades can be automatically merged in Databases for PostgreSQL:

Analytics Service tables

All user-accessible Analytics Service data is stored in tables according to device type and uses the following naming convention: dm_entity_grainid.

The following tables are available:

Table Details
dm_entity_grainid The derived metrics table that contains the output of a function at a certain grain.

The following identifiers are used in the previous table:

The Analytics Service tables are used by and controlled by IBM Maximo Asset Monitor and must not be the target for any SQL operations except QUERY.

Data access

Use an external database tool or the Databases for PostgreSQL API to extract and process the IoT data that you need. For more information about service API access, see REST APIs.

Tip: with the Analytics Service, you can access PostgreSQL data directly from the data lake with the Monitor dashboard, and use it as input for analytics functions.

Step 1: Get Databases for PostgreSQL credentials

In the Maximo Asset Monitor user interface, click View Details for the Databases for PostgreSQL service to get the following parameters. These parameters are required to connect to and retrieve IoT data from the database:

Databases for PostgreSQL Credentials
Username
An alphanumeric string.
Example: ibmcloudunique_identifier
Password
An alphanumeric string.
Example: 15645 ... bb201
Database name
Default: ibmclouddb
Default schema: public
Host
A URI that identifies your Databases for PostgreSQL host.
Example: unique_identifier.databases.appdomain.cloud.
Port
A port number to access your Databases for PostgreSQLL instance.
Example: 50000
Optional: Certificate
Base64 encoded version of the certificate used to enabled SSL connection.
Example: MIIDD ... Q3oaUA==

For more information about Databases for PostgreSQL authorization and how to provide credentials in API calls, see Databases for PostgreSQL documentation.

Step 2: Find your IoT device data

Use an external database tool to connect to Databases for PostgreSQL and access your data. You can also access the data by using the API.

Databases for PostgreSQL recommends the PGAdmin tool. For more information, see the Administration Tools section of the Databases for PostgreSQL documentation.

To explore your IoT data, complete the following steps:

  1. In your database tool, connect to your Databases for PostgreSQL database.
  2. Explore the Databases for PostgreSQL tables and data.

The iot_devicetype tables are used by and controlled by IBM Maximo Asset Monitor and must not be the target for any SQL operations except QUERY.

Step 3: Retrieve IoT device data

If your plan includes the Analytics Service add-on, the Monitor tab lets you derive key performance indicators (KPIs) from device data by using the built-in analytics functions. Line-of-business users can easily enrich and interact with the raw metrics data that comes from IoT entities by using the built-in configurable analytics functions. Data scientist developers can extend and customize the standard functions by using a set of APIs.

For more information, see the following Databases for PostgreSQL documentation topics: