Skip to main content

Database Model

This document describes where and in what form the AI stack stores data. There are four repositories, each with a distinct role. For operational procedures, see Database Administration.

Most are not owned by AI

PostgreSQL and Cassandra are shared with the PlantPulse Platform installation. The AI stack does not run its own databases. This means "AI backup" and "Platform backup" overlap — if you don't track who owns what, coverage gaps appear on both sides.

RepositoryOwnerContents
PostgreSQL chAI (separate DB within Platform PG)Chat · incidents · settings · MCP
Cassandra piAIFeature store · anomaly detection outputs
Cassandra ppPlatform (read-only)Raw sensor · alarm · OEE
Neo4jAIOntology knowledge graph
QdrantAIDocument embedding vectors

PostgreSQL ch — Conversation and operational state

A separate database ch within the Platform PostgreSQL instance (jdbc:postgresql://<platform-host>:5432/ch).

GroupTables
Conversationchats · chat_messages · prompts · prompt_history
Usersusers · user_roles · employees · web_push_subscription
Incidentsincident · incident_event · assignees
Anomaly detection operationsanomaly_mute · hourly_anomaly · asset_tag_profile
MCPmcp_server · mcp_tool_call_log · mcp_tool_pref
RAG integrationrag_asset_card · rag_asset_doc_sync · rag_sync_run
Settingsconfig · config_audit_log · metadata
This is the single source of truth for chat history

Before the July 2026 reorganization, chat history also lived in Cassandra. Now it exists only here — chat_messages is the authoritative source. Do not look in Cassandra based on older documentation.


Cassandra pi — Feature store

Twelve tables owned and created by the time series insights service. Prefix is tsi_.

GroupTables
Featurestsi_tag_feature_hourly · tsi_tag_feature_daily · tsi_asset_feature_hourly · tsi_asset_feature_daily
Context · profiletsi_asset_context_daily · tsi_asset_profile
Anomaly · faulttsi_anomaly_embedding · tsi_failure_signature · tsi_precursor_alert
Pipelinetsi_pipeline_status · tsi_pipeline_history · tsi_backfill_status

Tables are created idempotently when the service starts. However, the keyspace pi itself is not created by the application — it is managed by the installation script (provision-platform-db.sh).

Empty features blank out the entire analytics view

The admin console's anomaly detection and forecasting screens read entirely from these tables. If results are empty, check the pipeline first, not the model → admin console Pipeline Status · Run History (AI Admin Console).

The old pp.ti_* does not exist

On 2026-07-30, the pp keyspace was migrated to pi and the old tables were dropped. Queries using the old name will return no results.


Cassandra pp — Platform source (read-only)

AI reads only from Platform-collected data. It does not write here.

TablePurpose
tm_asset_data_based_second / _minute / _hourEquipment sensor time series
tm_tag_pointTag data points
tm_asset_alarmAlarms
tm_asset_oee_historyOEE
tm_asset_ram · tm_asset_ems_historyRAM · EMS
tm_monitor_platform_statusSystem resources (CPU · memory · disk)

Partition key differs by resolution

second : PRIMARY KEY ((asset_id, date, hour), timestamp)
minute : PRIMARY KEY ((asset_id, date), timestamp)
hour : PRIMARY KEY (asset_id, timestamp)
If queries are slow, check resolution first

Second resolution includes equipment · date · time in the partition. Scanning long periods at second resolution touches thousands of partitions. Use _hour for wide ranges, _second only for narrow ranges.

The complete Platform schema is in Platform Database Model.


Neo4j · Qdrant — Knowledge graph and vectors

RepositoryContents
Neo4jOntology — relationship graph of equipment · processes · documents
QdrantDocument chunk embedding vectors

The RAG engine (LightRAG) is configured to store graphs in Neo4j and vectors in Qdrant (LIGHTRAG_GRAPH_STORAGE=Neo4JStorage, LIGHTRAG_VECTOR_STORAGE=QdrantVectorDBStorage).

Recovery requires re-ingesting documents

Both are derived from source documents. Without backups, recovery means re-uploading the original files and rebuilding the indexes — keeping the original files is effectively your backup.

For ontology concepts, see Understanding Ontology.


Backup coverage checklist

RepositoryBacked up byLoss impact
PostgreSQL chMust be handled on AI sideChat · incidents · settings disappear
Cassandra piMust be handled on AI sideFeatures disappear, analytics screens go blank (recalculation possible but slow)
Cassandra ppPlatform backup
Neo4j · QdrantAIDocument indexes disappear (can be regenerated from source)

For procedures, see Database Administration.