Columnar Analytics
View as MarkdownNucleus can store a typed SQL table in its columnar engine. Use ordinary SQL
aggregates over declared numeric columns. The separate COLUMNAR_* ingestion
functions accept untyped key-value data and have a narrower aggregation contract.
Typed SQL Tables
CREATE TABLE analytics_events (
user_id INT,
action TEXT,
duration DOUBLE PRECISION
) WITH (engine='columnar');
INSERT INTO analytics_events VALUES
(42, 'click', 1.5),
(43, 'view', 3.2),
(42, 'purchase', 12.0);
SELECT COUNT(*), SUM(duration), AVG(duration), MIN(duration), MAX(duration)
FROM analytics_events;
Typed columns give SQL aggregation a numeric schema. This path differs from native untyped ingestion; it does not infer numbers from text values.
Native Untyped Ingestion
SELECT COLUMNAR_INSERT('raw_events', 'user_id', '42', 'duration', '1.5');
SELECT COLUMNAR_INSERT('raw_events', 'user_id', '43', 'duration', '3.2');
SELECT COLUMNAR_COUNT('raw_events');
-- Counts the two ingested rows.
COLUMNAR_SUM, COLUMNAR_AVG, COLUMNAR_MIN, and COLUMNAR_MAX refuse untyped
values with SQLSTATE 0A000. Use a typed SQL table for numeric analytics.
Storage and Failures
A declared columnar SQL table uses disk-backed storage when the database has a data directory, and memory storage in memory mode. A failed durable open refuses the operation or startup instead of silently selecting memory storage.
Native ingestion is durable only when its WAL is attached and the selected commit mode synchronizes it. WAL failures propagate to the caller. An I/O error can leave an uncertain outcome that requires recovery; an error is not a durable acknowledgement. These boundaries do not establish power-loss survival from a successful process-restart test.