AI applications are increasingly being connected to business databases instead of operating as isolated chatbot systems. An AI assistant may need customer records, product information, support history, orders, documents, and application metadata before it can produce a useful response.
That creates a database challenge. The application needs to store normal relational data while also supporting AI-oriented workloads such as semantic search, embeddings, retrieval, and agent memory.
MariaDB Enterprise Platform 2027 provides a database platform that can be considered for these workloads while keeping application data in a familiar relational environment.
The important part is not simply adding AI features to a database. A production AI application needs a clear data model, controlled retrieval, secure access, predictable performance, and a way to keep AI-generated information connected to trusted application data.
This article explains how to approach AI application development with MariaDB Enterprise Platform.
What an AI Application Needs From a Database
A typical AI application contains more than a prompt and a model.
For example, an enterprise support assistant may need:
Users
Tickets
Products
Knowledge Documents
Conversation History
Embeddings
AI Responses
Tool Results
Agent StateA simplified architecture looks like this:
User
|
v
AI Application
|
+----------------------+
| |
v v
AI Model MariaDB
|
+-----------+-----------+
| | |
v v v
Business AI Data Agent State
Data Embeddings SessionsThe database becomes part of the application's AI architecture.
Keep Business Data and AI Data Organized
One common mistake is putting everything into a single generic AI table.
Instead, separate different types of information.
For example:
customers
---------
customer_id
name
email
status
documents
---------
document_id
title
content
updated_at
document_chunks
---------------
chunk_id
document_id
content
embedding
conversations
-------------
conversation_id
customer_id
created_at
messages
--------
message_id
conversation_id
role
content
created_atThis separation makes the application easier to maintain.
Business tables contain trusted application data, while AI-related tables store information used for retrieval, conversations, and model interaction.
Store Embeddings Alongside Application Data
Retrieval-augmented generation applications commonly convert documents or text into embeddings.
An embedding represents semantic information as numerical values.
For example:
Document
|
v
Embedding Model
|
v
Vector
|
v
DatabaseThe application can later convert a user question into another vector and use similarity search to identify relevant content.
A conceptual table could contain:
document_chunks
---------------
chunk_id
document_id
content
embedding
created_at
updated_atKeeping the source document identifier with the embedding is important.
The application should always be able to answer:
Which document produced this chunk?This allows the application to retrieve the original content and provide appropriate context to the AI model.
Design the Retrieval Pipeline
A basic AI retrieval flow can be implemented as:
User Question
|
v
Embedding Model
|
v
Query Embedding
|
v
MariaDB Retrieval
|
v
Relevant Chunks
|
v
Prompt Construction
|
v
AI Model
|
v
ResponseThe database is responsible for retrieving relevant information. The model is responsible for generating the response.
Keeping these responsibilities separate makes the system easier to debug.
Example AI Retrieval Workflow
Suppose a user asks:
How can I reset my company account password?The application can process the request as follows:
Convert the question into an embedding.
Search the document chunks for relevant content.
Select the highest-quality results.
Add those results to the model context.
Ask the AI model to generate the answer.
Return the response to the user.
The application should not send the entire knowledge base to the model.
Only relevant information should be included in the context.
Store Source Metadata With AI Content
AI-generated and retrieved information should contain enough metadata to trace its source.
For example:
document_id
chunk_id
source_type
source_name
created_at
updated_atThis is useful when the application needs to show where an answer came from or determine whether an indexed document is outdated.
A retrieval result without source information is difficult to audit.
Keep AI-Generated Data Separate From Trusted Data
An AI model can generate incorrect information.
Therefore, avoid treating AI-generated output as equivalent to verified application data.
For example, an AI assistant might generate:
customer_status = "approved"That does not mean the application's customer table should be updated automatically.
Instead:
Trusted Database Data
|
v
AI Application
|
v
AI-generated suggestion
|
v
Validation
|
v
Business OperationThe AI system should follow application rules before modifying important business data.
Use AI as a Layer Around the Database
A useful architecture is to keep the database as the source of structured business information while the AI layer provides reasoning and natural-language interaction.
For example:
AI Application
|
+--------------+--------------+
| | |
v v v
AI Model Retrieval Agent Logic
|
v
MariaDB
/ \
/ \
v v
Business Tables AI DataThis architecture avoids making the AI model responsible for storing business truth.
Add Agent Memory Carefully
AI agents often need memory between requests.
For example, an agent may need to remember:
User preferences
Previous decisions
Current task
Tool results
Conversation stateThis information can be stored in MariaDB.
A simple session model might look like:
agent_sessions
--------------
session_id
user_id
status
created_at
updated_at
agent_messages
--------------
message_id
session_id
role
content
created_atFor larger workflows, additional tables can store tool calls and intermediate state.
agent_tool_calls
----------------
tool_call_id
session_id
tool_name
arguments
result
status
created_atThis makes long-running agent workflows easier to resume and investigate.
Design for Conversation History
Do not keep an entire conversation in one large database field.
A message-based design is easier to query:
conversation
|
+-- message
+-- message
+-- message
+-- messageEach message can contain:
Role
Content
Timestamp
Token-related metadata
Tool information
Request identifier
The application can then retrieve only the history required for the next model request.
Manage Context Size
Storing unlimited conversation history does not mean sending unlimited history to the model.
A better approach is:
Full History
|
+-- Recent messages
|
+-- Important facts
|
+-- Summary
|
+-- Relevant retrieved documents
|
v
Model ContextThe database can retain the complete history while the application selects the context needed for each AI request.
This keeps model requests manageable.
Secure AI Data
AI applications can process sensitive information.
Database security should therefore cover both traditional business data and AI-specific information.
Consider:
Database authentication
Role-based permissions
Encryption
Secret management
Access logging
Data retention
Tenant isolation
Sensitive field protection
Prompt and response storage policies
Do not assume that AI tables are harmless because they contain embeddings or generated text.
Embeddings and conversation history can still reveal sensitive business information.
Multi-Tenant AI Applications
If the application serves multiple organizations, retrieval must respect tenant boundaries.
For example:
Tenant A
|
+-- Documents
+-- Conversations
+-- Embeddings
Tenant B
|
+-- Documents
+-- Conversations
+-- EmbeddingsA retrieval query should never return Tenant B's documents to Tenant A.
Store tenant identifiers with relevant AI records and enforce tenant filtering consistently.
For example:
SELECT
chunk_id,
content
FROM document_chunks
WHERE tenant_id = ?
AND document_id = ?;The exact retrieval strategy depends on the application's data model, but tenant isolation should be designed from the beginning.
Handle Document Updates
AI retrieval systems need an indexing strategy.
Suppose a company changes its password policy document.
The original document may already have embeddings stored in the database.
The application needs to detect the change and update the affected chunks.
A common workflow is:
Document Updated
|
v
Split Into Chunks
|
v
Generate New Embeddings
|
v
Replace Old Chunks
|
v
Update MetadataDo not leave old embeddings active indefinitely.
Otherwise, the AI application may retrieve outdated information.
Monitor AI Database Workloads
AI workloads can create different database access patterns compared with traditional applications.
Monitor:
Retrieval latency
Query frequency
Conversation growth
Embedding storage
Agent session size
Failed retrievals
Database connections
Slow queries
Storage growth
A system may work correctly during initial development but become difficult to operate when thousands of conversations and documents are stored.
Monitoring should therefore be part of the initial architecture.
Common Mistakes
Treating the Database as AI Memory Without a Data Model
Simply storing prompts and responses does not create a useful memory system.
Define sessions, messages, facts, tool results, and retrieval data separately.
Mixing AI Output With Trusted Business Data
Model output should be validated before it changes important business records.
Storing Entire Conversations in One Field
A message-based structure provides better control over history, retention, and retrieval.
Sending All Database Data to the Model
Only relevant context should be provided to the AI model.
Ignoring Tenant Isolation
A retrieval system must enforce the same security boundaries as the main application.
Forgetting to Reindex Changed Documents
Outdated embeddings can cause the AI application to provide outdated answers.
Best Practices
Keep business data and AI data logically separated.
Store source metadata with retrieved content.
Use structured conversation and agent-session tables.
Treat AI-generated information as untrusted until validated.
Store embeddings with references to their source records.
Design tenant isolation before adding retrieval.
Update embeddings when source documents change.
Keep full conversation history separate from model context.
Apply access controls to AI-generated and retrieved data.
Monitor retrieval latency and database growth.
Test retrieval quality with realistic user questions.
Define data retention rules for conversations and agent sessions.
Advantages
Keeps AI application data close to existing relational business data.
Provides a structured foundation for conversations and agent sessions.
Can support retrieval workflows without creating a completely separate application data layer.
Makes source metadata and business relationships easier to manage.
Allows traditional SQL application patterns to remain part of the AI architecture.
Disadvantages and Considerations
AI workloads can create additional database storage and query pressure.
Vector and retrieval workloads require careful indexing and query design.
Conversation data can grow rapidly.
Sensitive prompts and responses require strong security controls.
AI-generated data must not automatically be treated as authoritative business data.
Large AI applications may require additional infrastructure for model inference and background processing.
When MariaDB Fits an AI Application
MariaDB can be a practical choice when an AI application already relies on relational business data and needs database support for AI-related information such as document chunks, embeddings, conversation history, and agent state.
It is especially useful when the application benefits from keeping structured business data and AI application metadata within a consistent database architecture.
However, the database should not be expected to solve every AI infrastructure problem. Model inference, document processing, embedding generation, orchestration, and background jobs are separate concerns and should be designed independently.
Summary
Building AI applications with MariaDB Enterprise Platform 2027 is primarily about connecting AI workloads with reliable application data.
A strong design keeps business records, document content, embeddings, conversation history, and agent state organized instead of putting everything into a single AI-oriented table.
Use the database to store and retrieve trusted application information, while the AI layer handles reasoning and natural-language interaction. Keep source metadata with retrieved content, validate AI-generated changes before updating business records, and enforce tenant and security boundaries throughout the retrieval process.
As the application grows, pay attention to document reindexing, conversation history, retrieval latency, storage growth, and database workload. A clear data model and controlled retrieval pipeline provide a much stronger foundation for production AI applications than simply adding an AI model to an existing database.

Join the conversation! Your thoughts help the community grow.