For the complete documentation index, see llms.txt. This page is also available as Markdown.

Analytics

Report on sales history in the same database as your live tables. Load it into a ColumnStore table beside your InnoDB tables and join them in one query.

The shop has been taking orders for a few months, and every Monday someone asks the same question: which products earned the most last week? The first answer is a GROUP BY against the order tables, and it works fine until the data grows. Then the report starts scanning millions of rows on the same tables that checkout writes to, and both of them slow down.

The tables aren't the problem. Their layout is. InnoDB, the default storage engine, keeps each row together on disk, which is exactly right for a checkout that reads or writes one order. A report wants the opposite. It reads two or three columns from every row and ignores the rest.

One database, two storage engines. The products table uses InnoDB, which stores whole rows together, so a checkout reads one complete row. The sales table uses a columnar engine, which stores each column apart, so a revenue report reads only the product_id, quantity, and price columns. One SELECT joins both tables.
Each table picks the storage engine that fits how it's read, and one query can join them.

MariaDB ColumnStore stores each column on its own, so a report reads only the columns it names. Because every table in MariaDB Server chooses its own storage engine, the sales history can move to ColumnStore while products and orders stay on InnoDB, all in the same shop database. ColumnStore is open source and ships with MariaDB Community Server and MariaDB Enterprise Server.

To follow along, you need a server with ColumnStore installed, because both the ENGINE=ColumnStore tables and the cpimport loader come from it. The official Docker image from the landing page doesn't include ColumnStore, so use a Linux host for this page. On MariaDB Community Server, install the mariadb-plugin-columnstore package (MariaDB-columnstore-engine on RHEL) from the MariaDB repository. For MariaDB Enterprise Server, the single-node install guide walks through the setup.

Move Sales to ColumnStore

1

Create a ColumnStore Table

Add a sales table to the shop database with ENGINE=ColumnStore. ColumnStore tables don't use primary keys or indexes the way InnoDB tables do, because the engine scans compressed columns instead of looking up rows.

The ColumnStore quickstart explains how the engine stores and compresses each column.

2

Bulk Load With cpimport

The cpimport tool ships with ColumnStore and writes straight to the column files, skipping the SQL layer, which makes it the fastest way to load history. It reads pipe-delimited text by default, so write a small file on the server host and load it.

Reports keep running while the load is in progress. When your order history already lives in an InnoDB table, an INSERT INTO shop.sales SELECT ... statement run outside a transaction becomes the same bulk load. Data Loading with cpimport covers the file formats and options.

3

Join Across Engines

Revenue per product needs the sales figures from ColumnStore and the product names from InnoDB. One SELECT reads both.

ColumnStore reaches the InnoDB table through a cross-engine connection that you set up once with the mcsSetConfig CrossEngineSupport commands in Start and Configure ColumnStore.

With the sales history on ColumnStore, the Monday report reads a few compressed columns and leaves checkout alone. When the sales history outgrows one server, MariaDB Exa, part of MariaDB Enterprise Platform, runs analytics on a separate cluster. MaxScale CDC reads the binary log and loads each change into Exa, and you query the copy there, not in the same query as your InnoDB tables.

Keep Going

This page is: Copyright © 2026 MariaDB. All rights reserved.

spinner

Last updated

Was this helpful?