ClickHouse table engines determine how data is stored, indexed, queried, and replicated.
MooseOLAP selects the engine in the OlapTable config:
You set the engine in the OlapTable config with the engine property:
import { OlapTable, ClickHouseEngines } from "@514labs/moose-lib"; interface EngineExampleRow { id: string; timestamp: Date; updated_at: Date; deleted: number; date: Date; page: string; views: number; click_sum: number;}; // MergeTree (default, can omit engine property)const MergeTree = new OlapTable<EngineExampleRow>("merge_tree_table", { orderByFields: ["timestamp", "id"],}); // ReplacingMergeTree (deduplicate by key, optional version + soft delete)const ReplacingMergeTree = new OlapTable<EngineExampleRow>("replacing_merge_tree_table", { engine: ClickHouseEngines.ReplacingMergeTree, orderByFields: ["id"], ver: "updated_at", isDeleted: "deleted",}); // SummingMergeTree (sum numeric columns for the same key)const SummingMergeTree = new OlapTable<EngineExampleRow>("summing_merge_tree_table", { engine: ClickHouseEngines.SummingMergeTree, orderByFields: ["date", "page"], columns: ["views", "click_sum"],});ClickHouseEngines includes the following categories:
SimpleAggregateFunction with AggregatingMergeTree