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.
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.
| Repository | Owner | Contents |
|---|---|---|
PostgreSQL ch | AI (separate DB within Platform PG) | Chat · incidents · settings · MCP |
Cassandra pi | AI | Feature store · anomaly detection outputs |
Cassandra pp | Platform (read-only) | Raw sensor · alarm · OEE |
| Neo4j | AI | Ontology knowledge graph |
| Qdrant | AI | Document embedding vectors |
PostgreSQL ch — Conversation and operational state
A separate database ch within the Platform PostgreSQL instance
(jdbc:postgresql://<platform-host>:5432/ch).
| Group | Tables |
|---|---|
| Conversation | chats · chat_messages · prompts · prompt_history |
| Users | users · user_roles · employees · web_push_subscription |
| Incidents | incident · incident_event · assignees |
| Anomaly detection operations | anomaly_mute · hourly_anomaly · asset_tag_profile |
| MCP | mcp_server · mcp_tool_call_log · mcp_tool_pref |
| RAG integration | rag_asset_card · rag_asset_doc_sync · rag_sync_run |
| Settings | config · config_audit_log · metadata |
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_.
| Group | Tables |
|---|---|
| Features | tsi_tag_feature_hourly · tsi_tag_feature_daily · tsi_asset_feature_hourly · tsi_asset_feature_daily |
| Context · profile | tsi_asset_context_daily · tsi_asset_profile |
| Anomaly · fault | tsi_anomaly_embedding · tsi_failure_signature · tsi_precursor_alert |
| Pipeline | tsi_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).
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).
pp.ti_* does not existOn 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.
| Table | Purpose |
|---|---|
tm_asset_data_based_second / _minute / _hour | Equipment sensor time series |
tm_tag_point | Tag data points |
tm_asset_alarm | Alarms |
tm_asset_oee_history | OEE |
tm_asset_ram · tm_asset_ems_history | RAM · EMS |
tm_monitor_platform_status | System 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)
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
| Repository | Contents |
|---|---|
| Neo4j | Ontology — relationship graph of equipment · processes · documents |
| Qdrant | Document 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).
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
| Repository | Backed up by | Loss impact |
|---|---|---|
PostgreSQL ch | Must be handled on AI side | Chat · incidents · settings disappear |
Cassandra pi | Must be handled on AI side | Features disappear, analytics screens go blank (recalculation possible but slow) |
Cassandra pp | Platform backup | — |
| Neo4j · Qdrant | AI | Document indexes disappear (can be regenerated from source) |
For procedures, see Database Administration.
Related documents
- Database Administration — access · inspection · operations
- AI Admin Console — pipeline status
- Service Port Map
- Platform Database Model