4. Database Schema
This chapter describes the database tables and schema used for data storage and management.
Database Integration Adapter automatically creates two database tables:
Data Tables store DDS samples and associated metadata for each registered Topic.
The Types Table stores type information for registered DDS types.
4.1. Data Tables
For each DDS Topic, Database Integration Adapter creates a data table with the structure detailed in the table below:
Column Name |
Type |
Description |
|---|---|---|
|
INT/SERIAL (auto-increment) |
Unique identifier for each sample. This column is created only when
|
|
INT |
Per-instance ordering field used to identify the oldest stored
sample when |
|
INT |
Seconds portion of the sample reception timestamp. |
|
INT |
Nanoseconds portion of the sample reception timestamp. |
|
BINARY(16) / BYTEA |
DDS instance handle. Always part of the primary key. |
|
VARCHAR |
Contains the serialized JSON representation of the DDS sample data. |
4.1.1. Primary key configuration
The primary key structure depends on the instance_history option:
instance_history = 0 or 1: Primary key is
(sampleInfo_instance_handle)Only the latest sample per instance is stored
New samples with the same instance handle replace existing ones
instance_history > 1 or instance_history = -1 : Primary key is
(RTI_HISTORY_ID, sampleInfo_instance_handle)Multiple samples per instance can be stored
RTI_HISTORY_IDensures uniqueness across all samplesRTI_HISTORY_ORDERis used to find the oldest sample for replacement when the per-instance limit is reached
4.1.2. Table naming convention
Data tables are named using the pattern <topic_name>@<domain_id>.
For example, a Topic named ShapeType in domain 0 would create a table
named ShapeType@0.
4.2. Types Table
Database Integration Adapter also creates a types table to track which DDS types have been registered. This table maintains type information for data processing and analysis. The structure of the types table is as follows:
Column Name |
Type |
Description |
|---|---|---|
|
VARCHAR |
Name of the DDS Topic. |
|
VARCHAR |
Name of the DDS type used by the Topic. |
|
VARCHAR or binary (database dependent) |
Serialized type representation. Its storage type depends on the
|