Why Column-Store OLAP Engines Are Exploding in the AI Era
The most significant shift in data infrastructure isn't a single-component performance breakthrough—it's the repositioning of analytical databases for AI workloads. This article explains why column-store OLAP engines fit AI inference logging so well, breaks down the layered design techniques behind petabyte-scale millisecond query response, and provides a practical selection checklist and risk analysis for engineering teams.
Why Column-Store OLAP Engines Are Taking Off in the AI Era
Over the past while, the most notable development in data infrastructure hasn’t been a point-product speed record — it’s the repositioning of analytical databases for AI workloads. An open-source columnar database originally designed over a decade ago for real-time web analytics on search engines has now become the core data foundation for a large number of AI applications and AI labs. The commercial company built around it has likewise expanded from a single query engine into a broader data platform.
This phenomenon is often attributed to “the AI hype,” but from an engineering perspective, the real reasons are architectural fit with the workload, plus a set of layered design methodologies built around that workload. This article strips away specific vendors and focuses only on the reusable technical logic.
1. Workload Profile: What AI Inference Logs Actually Look Like
To understand why certain engines get chosen, start with the data itself. A single LLM API call produces a record with high structural regularity, many fields, and append-only writes. Typical fields include:
- Identity: request ID, session ID, tenant ID, calling application ID
- Time: request time, first-token time, completion time
- Model: model name and version, routing policy, cache hit or miss
- Metering: input tokens, output tokens, billing basis, price version
- Performance: queue time, inference time, end-to-end latency
- Resources: device ID, cluster/availability zone, batch size
- Governance: safety-filter flags, content moderation results, error codes, retry count
This data has three defining characteristics: append-only, many high-cardinality dimensions (tenants, sessions, and device IDs have enormous value spaces), and queries dominated by scan–filter–aggregate over time windows. It is not a typical transactional workload, and it rarely needs frequent point updates of single rows by primary key.
2. Why Columnar Storage: Fit on Three Levels
2.1 Write Pattern Matches Storage Structure
Append-only writes mean there is essentially no in-place update or random rewriting. The storage layer can organize data as immutable blocks plus background merging (an LSM-style merge tree), converting random write pressure into sequential writes and batched compaction. This is exactly what columnar engines do best: controllable write amplification and high compression ratios.
2.2 Scan Efficiency on High-Cardinality Columns
In a “query only three columns, but scan a billion rows” scenario, row-oriented storage reads large amounts of irrelevant column data, amplifying I/O. Columnar storage encodes each column independently, and combined with dictionary encoding, RLE, Delta, and general-purpose compression such as LZ4/ZSTD, the data volume read per column drops significantly. Layer on vectorized execution and late materialization (filter first, fetch columns later), and CPU branch prediction and cache utilization both improve.
It’s worth emphasizing: high cardinality itself is not the problem — equality filtering on a high-cardinality column is the problem. The correct engineering fix is not switching engines, but adjusting the sort key so high-cardinality filter columns are sorted first, or using low-cardinality mapped types (such as enum or low-cardinality dictionary types) to reduce comparison cost.
2.3 Pushing Aggregation and Precomputation Down
High-frequency queries in AI scenarios are highly templated: token consumption by tenant/model/time window, P95/P99 latency, error rates, cache hit ratios. These queries suit incremental pre-aggregation at write time via materialized views, turning full scans at query time into reads of small aggregate tables.
3. Example: A Usable Inference Log Table
CREATE TABLE llm_request_log(req_id String,ts DateTime64(3),tenant_id LowCardinality(String),app_id LowCardinality(String),model_name LowCardinality(String),prompt_tokens UInt32,completion_tokens UInt32,queue_ms UInt32,infer_ms UInt32,e2e_ms UInt32,device_id String,safety_flag UInt8,status_code UInt16)ENGINE = ColumnMergeTree -- generic LSM-style columnar enginePARTITION BY toYYYYMMDD(ts)ORDER BY (tenant_id, model_name, ts);
And a companion pre-aggregating materialized view (illustrative):
CREATE MATERIALIZED VIEW llm_usage_1hENGINE = ColumnMergeTreePARTITION BY toYYYYMMDD(start_hour)ORDER BY (tenant_id, model_name, start_hour)AS SELECTtenant_id,model_name,toStartOfHour(ts) AS start_hour,count() AS req_cnt,sum(prompt_tokens) AS prompt_tokens,sum(completion_tokens) AS completion_tokens,quantile(0.95)(e2e_ms) AS e2e_p95,countIf(status_code >= 500) AS err_cntFROM llm_request_logGROUP BY tenant_id, model_name, start_hour;
4. Millisecond Response at PB Scale: Layered Design, Not Point Tuning
- Partition pruning: daily partitions plus a mandatory time range in every query is the cheapest and most effective filter.
- Sort key design: put frequently used equality-filter columns first so the sparse primary index skips irrelevant data blocks directly.
- Skip indexes: build bloom filters or min/max indexes on high-cardinality columns such as
device_idandreq_idto avoid full table scans. - Materialized views and incremental aggregation: move repeated heavy computation onto the write path.
- TTL and hot/cold tiering: keep hot data on local high-performance storage, sink cold data to object storage, and use partition-level TTL for automatic expiry to control cost.
- Sharding and replication: shard writes by tenant or time hash, scan in parallel on the query side; replicas provide availability and read scaling.
- Read/write and workload isolation: run interactive queries, reporting jobs, and data ingestion in separate resource queues to avoid mutual interference.
5. From Single Engine to Data Platform: The General Integration Logic
A clear industry trend recently: analytical engine vendors expand themselves from “one query engine” into “one data platform” by absorbing application-layer capabilities. This can be abstracted into three threads:
- Infrastructure observability: unify logs, metrics, and traces on the same columnar foundation, using SQL for cross-type correlation analysis instead of stitching together multiple systems.
- AI application observability: model each LLM call as a trace, recording prompt, response, tokens, latency, evaluation scores, and cost attribution, with drill-down by session.
- Completing the transactional story: by integrating or hosting an open-source relational database, cover OLTP needs and form an OLTP + OLAP combination, rather than forcing an analytical engine to handle transactions.
The cost is equally clear: the more application-layer products, the higher the complexity of unified permissions, unified billing, unified metadata, and upgrade compatibility. The benefit of integration comes from “one copy of data, one set of permissions, one query language” — not from stacking feature checklists.
6. Private Deployment and Isolation: Hard Constraints in AI Scenarios
Leading AI organizations are extremely sensitive about data leaving their premises and often require physically isolated (air-gapped) or fully private deployments: no external network dependencies, offline distribution of images and dependencies, disableable telemetry and license checks, and offline-capable upgrades. This requires an architecture where the control plane and data plane are decoupled: the control plane can be hosted, but the data plane must be able to run independently inside the customer’s data center. This is a general engineering constraint, not any single vendor’s unique capability.
7. The General Capability Stack for Cloud Deployment
On public cloud, a typical stack looks like this: object storage for cold data and backups, a message queue for write buffering and peak shaving, a container platform for stateless query nodes, a logging service plus monitoring/alerting for the platform’s own observability, and a key management service for encryption keys. Cloud platforms such as Baidu AI Cloud provide exactly these kinds of generic building blocks, combinable on demand without binding to proprietary interfaces.
8. Selection Checklist
- Are queries dominated by “large-range scan + filter + aggregate”? If yes, prefer columnar.
- Are high-frequency single-row updates/deletes present? If yes, proceed with caution, or adopt replace/merge semantics.
- What is the cardinality of filter columns? Have high-cardinality filter columns been placed in the sort key?
- What is the data retention period and hot/cold ratio? Are TTL and tiering policies defined?
- Is strong cross-tenant isolation required? Are row-level permissions and quotas available?
- Do write peaks and query peaks overlap? Are resource queues isolated?
- Is private deployment or offline upgrade required?
- Does the cost model account separately for storage, compute, and egress traffic?
9. Boundaries and Risks
Columnar engines are not a panacea: they are unsuitable for strong transactions, frequent point updates, and complex multi-table transactional joins; consistency semantics and operational complexity in distributed deployments demand extra investment; materialized views and pre-aggregation introduce storage amplification and the risk of inconsistent metric definitions, so unified metric definitions are mandatory. Additionally, long-term retention of raw prompts and responses raises data compliance concerns — default to masking, tiered retention, and shorter TTLs.
10. Closing Thoughts
The AI wave didn’t introduce a new database paradigm. It made the workload of “massive append-only writes plus high-cardinality analytics” extremely common, bringing a mature columnar analytical architecture back to center stage. Real competitive advantage comes from accurately modeling the workload, systematic layered design, and restraint when expanding from engine to platform.
