
Datenbanken unterliegen einem grundlegenden Wandel, der durch künstliche Intelligenz vorangetrieben wird. So wie KI die Softwareentwicklung neu gestaltet, revolutioniert sie auch die Art und Weise, wie Datenbanken entworfen, betrieben und abgefragt werden. Dies umfasst drei große Bereiche:
Datenbanken unterliegen einem grundlegenden Wandel, der durch künstliche Intelligenz vorangetrieben wird. So wie KI die Softwareentwicklung neu gestaltet, revolutioniert sie auch die Art und Weise, wie Datenbanken entworfen, betrieben und abgefragt werden. Dies umfasst drei große Bereiche:
In diesem Artikel wird untersucht, wie KI und Datenbanken zu einer einheitlichen intelligenten Datenplattform zusammenwachsen.
Eine autonome Datenbank nutzt KI und maschinelles Lernen, um routinemäßige DBA-Aufgaben zu automatisieren – Bereitstellung, Optimierung, Patching, Sicherung, Skalierung und Fehlerbehebung. Oracle war mit seiner Autonomous Database Vorreiter und alle großen Anbieter sind diesem Beispiel gefolgt.
| Aufgabe | Traditioneller DBA | Autonome Datenbank |
|---|---|---|
| Indexverwaltung | Manuelle Analyse, INDEX ERSTELLEN | Automatische Indexerstellung basierend auf Abfragemustern |
| Abfrageoptimierung | Analysieren Sie EXPLAIN-Pläne und Hinweise | KI sagt optimale Verbindungsreihenfolgen und Indizes voraus |
| Speicheroptimierung | Passen Sie shared_buffers und work_mem an | Dynamische Speicherzuweisung pro Workload |
| Speicherskalierung | Festplatten hinzufügen, neu partitionieren | Automatische Shard-Neuausrichtung |
| Patchen | Planen Sie Wartungsfenster | Fortlaufende Upgrades, keine Ausfallzeiten |
| Sicherung/Wiederherstellung | Cron konfigurieren, Backups überprüfen | Kontinuierliche Sicherung, sofortige Wiederherstellung |
| Anomalieerkennung | Abfrageleistungs-Dashboards | KI erkennt langsame Abfragen und sagt Fehler voraus |
| Sicherheit | Manuelle Erstellung von Prüfregeln | KI erkennt anomale Zugriffsmuster |
-- Oracle Autonomous Database — self-tuning SQL
SELECT /*+ MONITOR */
o.customer_id, SUM(o.total) as revenue
FROM orders o
WHERE o.created_at > SYSDATE - 30
GROUP BY o.customer_id
HAVING SUM(o.total) > 1000;
-- Behind the scenes, the autonomous engine:
-- 1. Creates partial indexes if beneficial
-- 2. Adjusts parallel execution degree automatically
-- 3. Caches frequently accessed data
-- 4. Compresses data based on access patterns
-- 5. Monitors for SQL injection attempts
KI-gestützte automatische Indexverwaltung:
-- Oracle: automatic indexing report
SELECT
dbms_auto_index.report_last_activity() as report
FROM dual;
-- Sample output:
-- Recommended: idx_orders_customer_date ON orders(customer_id, created_at)
-- Estimated benefit: 85% reduction in query time
-- Action: Created (validated, then made visible)
-- Rejected: idx_orders_total ON orders(total) — never used
class QueryPerformancePredictor:
"""AI model that predicts query runtime before execution"""
def __init__(self):
self.model = load_model('query_predictor_v2.pkl')
self.features = [
'table_scan_type', # sequential, index, bitmap
'join_count', # number of JOINs
'join_type', # hash, nested loop, merge
'filter_selectivity', # estimated filter fraction
'sort_required',
'group_by_columns',
'result_rows_estimate',
'concurrent_queries',
'buffer_cache_hit_ratio',
]
def predict_runtime(self, query_plan: dict) -> float:
features = self.extract_features(query_plan)
predicted_ms = self.model.predict([features])[0]
confidence = self.model.predict_proba([features]).max()
if predicted_ms > 5000:
alert_team(f"Slow query predicted ({predicted_ms:.0f}ms, "
f"confidence: {confidence:.1%})")
return self.suggest_optimization(query_plan)
return predicted_ms
Moderne Datenbanken integrieren jetzt die Vektorsuche nativ:
PostgreSQL mit pgvector:
CREATE EXTENSION vector;
-- Create table with vector column
CREATE TABLE documents (
id UUID PRIMARY KEY,
title TEXT,
content TEXT,
embedding vector(1536) -- OpenAI embedding dimension
);
-- Create IVFFlat index for fast ANN search
CREATE INDEX ON documents
USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 100);
-- Create HNSW index (pgvector 0.7+)
CREATE INDEX ON documents
USING hnsw (embedding vector_cosine_ops);
-- Semantic search query
SELECT title, content,
1 - (embedding <=> $1) as similarity
FROM documents
ORDER BY embedding <=> $1 -- Cosine distance
LIMIT 10;
SQL Server – Vector-Unterstützung:
-- SQL Server 2026+ vector support
CREATE TABLE documents (
id INT PRIMARY KEY,
content NVARCHAR(MAX),
embedding VECTOR(1536)
);
-- Create vector index
CREATE VECTOR INDEX idx_doc_embeddings
ON documents (embedding)
WITH (DISTANCE = COSINE, ALGORITHM = HNSW);
-- Semantic search
SELECT id, content,
VECTOR_DISTANCE(embedding, @query_vector) as distance
FROM documents
ORDER BY VECTOR_DISTANCE(embedding, @query_vector)
OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY;
Kombinieren Sie traditionelle SQL-Filter mit semantischer Suche:
-- Hybrid: filter by category, search by meaning
SELECT d.title, d.content,
1 - (d.embedding <=> $query_embedding) as relevance
FROM documents d
JOIN document_categories c ON d.category_id = c.id
WHERE c.name IN ('Engineering', 'Product')
AND d.created_at > '2025-01-01'
AND d.status = 'published'
ORDER BY relevance DESC
LIMIT 20;
Führen Sie ML-Modelle direkt in der Datenbank-Engine aus:
PostgreSQL mit ONNX-Laufzeit:
-- Load a trained model into PostgreSQL
CREATE MODEL churn_predictor
FROM 's3://models/churn/v3/churn.onnx'
WITH (task = 'classification',
labels = '{not_churned, churned}');
-- Run inference in SQL
SELECT customer_id,
name,
predict(churn_predictor,
ARRAY[age, tenure, total_orders, avg_order_value, support_tickets]
) as churn_probability
FROM customers
WHERE last_login > NOW() - INTERVAL '30 days'
ORDER BY churn_probability DESC
LIMIT 100;
BigQuery ML:
-- Train a model directly on your data
CREATE OR REPLACE MODEL `project.dataset.churn_model`
OPTIONS (
model_type='LOGISTIC_REG',
input_label_cols=['churned'],
regularization=0.01
) AS
SELECT
age, tenure, total_orders,
avg_order_value, support_tickets,
churned
FROM `project.dataset.training_data`;
-- Use the model for predictions
SELECT
customer_id,
predicted_churned_probs[OFFSET(1)] as churn_risk
FROM ML.PREDICT(
MODEL `project.dataset.churn_model`,
(SELECT * FROM `project.dataset.customers_to_score`)
)
WHERE predicted_churned_probs[OFFSET(1)] > 0.7;
Sprechen Sie in natürlicher Sprache mit Ihrer Datenbank:
-- What AI translates your question to:
-- User: "Show me the top 5 customers by revenue this month"
SELECT c.name,
SUM(o.total) as revenue
FROM customers c
JOIN orders o ON c.id = o.customer_id
WHERE DATE_TRUNC('month', o.created_at) = DATE_TRUNC('month', CURRENT_DATE)
GROUP BY c.id, c.name
ORDER BY revenue DESC
LIMIT 5;
-- User: "Which products have not sold in the last 90 days?"
SELECT p.name, p.sku,
p.quantity_in_stock,
MAX(o.created_at) as last_sold
FROM products p
LEFT JOIN order_items oi ON p.id = oi.product_id
LEFT JOIN orders o ON oi.order_id = o.id
GROUP BY p.id, p.name, p.sku, p.quantity_in_stock
HAVING MAX(o.created_at) IS NULL
OR MAX(o.created_at) < CURRENT_DATE - INTERVAL '90 days'
ORDER BY p.name;
Ein Feature Store ist ein zentralisiertes Repository für ML-Funktionen, das Data Engineering und MLOps verbindet:
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Raw Data │ │ Feature │ │ ML Model │
│ (OLTP) │──▶│ Store │──▶│ Training │
└──────────┘ └──────────┘ └──────────┘
│
├─► Online serving (Redis)
├─► Offline training (Parquet)
└─► Point-in-time joins (Spark)
Feast Feature Store:
from feast import FeatureView, Entity, Field
from feast.types import Float32, Int32
# Define features
customer_features = FeatureView(
name="customer_features",
entities=["customer_id"],
ttl=timedelta(days=30),
schema=[
Field(name="total_orders", dtype=Int32),
Field(name="lifetime_value", dtype=Float32),
Field(name="days_since_last_order", dtype=Int32),
Field(name="avg_order_value", dtype=Float32),
],
source=BigQuerySource(
query="SELECT * FROM analytics.customer_features"
),
)
# Retrieve features for training
training_df = store.get_historical_features(
entity_df=entity_df,
features=[
"customer_features:total_orders",
"customer_features:lifetime_value",
"customer_features:days_since_last_order",
]
).to_df()
# Retrieve features for online inference
feature_vector = store.get_online_features(
features=[
"customer_features:total_orders",
"customer_features:lifetime_value",
],
entity_rows=[{"customer_id": customer_id}]
).to_dict()
Verfolgen Sie ML-Experimente und Artefakte:
# MLMD — ML Metadata
pipeline:
- pipeline_name: "churn_prediction"
run_id: "run_2026_05_24_001"
steps:
- step_name: "data_extraction"
artifacts:
- type: "dataset"
uri: "s3://data/raw/orders_2026_05.parquet"
size: "2.3 GB"
- step_name: "feature_engineering"
artifacts:
- type: "feature_set"
uri: "s3://features/churn_v3/train.parquet"
columns: 24
rows: 500000
- step_name: "training"
parameters:
model_type: "XGBoost"
n_estimators: 500
learning_rate: 0.05
max_depth: 8
metrics:
f1_score: 0.87
accuracy: 0.91
auc_roc: 0.94
artifacts:
- type: "model"
uri: "s3://models/churn/v3/model.pkl"
format: "pickle"
# MLflow model registry — version and stage management
from mlflow.tracking import MlflowClient
client = MlflowClient()
# Register model version
client.create_model_version(
name="churn_predictor",
source="runs:/abc123/model",
run_id="abc123",
description="XGBoost with engineered features v3"
)
# Promote to production
client.transition_model_version_stage(
name="churn_predictor",
version=3,
stage="Production"
)
# Stage = "Staging" | "Production" | "Archived"
Herkömmliche Indizes (B-Tree, LSM) werden durch erlernte Modelle ersetzt, die den Datenstandort vorhersagen:
Learned Index:
Input: search key (e.g., "Alice")
Model: neural network → predicts page location
Output: "Page 42, offset 128"
Instead of: B-Tree traversal (O(log N))
AI does: Single model inference (O(1))
Leistungsvergleich:
| Indextyp | Suchzeit | Erinnerung | Bauzeit |
|---|---|---|---|
| B-Baum | O(log N) ~50ns | 1x | 1x |
| Gelernt (RMI) | O(1) ~10ns | 0,5-2x | 2-10x |
| Hash | O(1) ~20ns | 1,5x | 1x |
KI sagt die Anzahl der Zeilen voraus, die eine Abfrage zurückgeben wird – entscheidend für die Optimierung des Abfrageplans:
-- PostgreSQL classic (statistics-based)
EXPLAIN SELECT * FROM orders WHERE status = 'shipped';
-- Estimated: 50,000 rows (often wrong)
-- Actual: 125,000 rows
-- AI-enhanced estimation:
-- Model considers: column correlations, data drift, join patterns
-- Estimated: 127,000 rows (within 2% accuracy)
| Schätzer | Genauigkeit (durchschnittlicher Fehler) | Verbesserung der Abfrageplanung |
|---|---|---|
| Traditionell (Histogramme) | 40-200 % | Grundlinie |
| Stichprobenbasiert | 10-50 % | +15% |
| ML-basiert (XGBoost, NN) | 5-15 % | +30% |
| Deep Learning (Abfragediagramm) | 3-8 % | +40% |
┌─────────────────────────────────────────────────────┐
│ Intelligent Data Platform │
├────────────┬───────────┬──────────┬──────────┬──────┤
│ Relational│ Document │ Graph │ Vector │ Time │
│ Tables │ (JSON) │ (Nodes) │ (EMBED) │Series│
├────────────┴───────────┴──────────┴──────────┴──────┤
│ AI-Powered Query Engine │
│ ┌──────────────────────────────────────────────┐ │
│ │ Learned Indexes │ AI Cardinality Est. │ │
│ │ Auto Tuning │ Query Pattern Analysis │ │
│ │ Auto Indexing │ Anomaly Detection │ │
│ └──────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────┤
│ ML Execution Engine │
│ │ Model Inference │ Embedding Gen. │ NL2SQL │
├─────────────────────────────────────────────────────┤
│ Storage Layer │
│ │ Row Store │ Column Store │ Blob │ Vector Index │
└─────────────────────────────────────────────────────┘
| Heute | Morgen |
|---|---|
| Separates DB + ML-System | Einheitliche Abfrage: SQL + Vektoren + ML |
| Manuelle Indexabstimmung | Automatische Indexerstellung/-löschung |
| Abfrageoptimierung durch Experten | KI-optimierte Abfragepläne |
| Separates Feature-Engineering | Integrierte Feature-Berechnung |
| Schreiben Sie ETL-Pipelines | Deklarative Datentransformation |
| Batch-Modell-Inferenz | Datenbankinterne Inferenz in Echtzeit |
-- Step 1: Create table with vector + text + structured columns
CREATE TABLE products (
id UUID PRIMARY KEY,
name TEXT,
description TEXT,
price NUMERIC(10,2),
category TEXT,
embedding vector(1536),
-- AI-generated embedding stored here
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Step 2: AI creates embeddings automatically (trigger)
CREATE OR REPLACE FUNCTION update_embedding()
RETURNS TRIGGER AS $$
BEGIN
NEW.embedding := ai_embedding(
CONCAT(NEW.name, ': ', NEW.description),
model => 'text-embedding-3-small'
);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER auto_embed_products
BEFORE INSERT OR UPDATE OF name, description
ON products
FOR EACH ROW
EXECUTE FUNCTION update_embedding();
-- Step 3: Query with AI
-- "Find affordable wireless headphones similar to AirPods"
SELECT name, price,
1 - (embedding <=> $query_embedding) as similarity
FROM products
WHERE price < 200
AND category = 'Electronics'
ORDER BY similarity DESC
LIMIT 10;
Die Grenze zwischen Datenbanken und KI löst sich auf. Moderne Datenbanken werden zu intelligenten Plattformen, die:
Die Datenbank der Zukunft ist autonom, intelligent und KI-nativ. Entwickler, die diese Funktionen nutzen, werden leistungsfähigere Anwendungen mit weniger Betriebsaufwand erstellen.
Noch keine freigegebenen Kommentare sichtbar. Neue Antworten können moderiert werden.