We value your privacy

This site uses cookies to improve your browsing experience, analyze site traffic, and show personalized content. See our Privacy Policy.

  1. MooseStack
  2. Table Engines

Table Engines

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"],});

Options

ClickHouseEngines includes the following categories:

MergeTree Family

  • MergeTree
  • ReplacingMergeTree
  • SummingMergeTree
  • AggregatingMergeTree
  • CollapsingMergeTree
  • VersionedCollapsingMergeTree

Replicated

  • See Replicated Engines

Special Purpose

  • S3Queue
  • S3
  • IcebergS3
  • Buffer
  • Distributed
  • Kafka
  • Merge

See Also

  • Tables — Full table configuration reference
  • Aggregate Types — Using SimpleAggregateFunction with AggregatingMergeTree

On this page

OptionsMergeTree FamilyReplicatedSpecial PurposeSee Also
FiveonefourFiveonefour
Fiveonefour Docs
MooseStackHostingTemplatesGuides
Release Notes
Source531
  • Overview
Build a New App
  • 5 Minute Quickstart
  • Browse Templates
  • Existing ClickHouse
Add to Existing App
  • Next.js
  • Fastify
Fundamentals
  • Moose Runtime
  • MooseDev MCP
  • Language Server
  • Data Modeling
Moose Modules
  • Moose OLAP
  • Moose Streaming
  • Moose Workflows
  • Moose APIs & Web Apps
Deployment & Lifecycle
  • Moose Dev
  • Moose Migrate
  • Moose Deploy
Reference
  • API Reference
  • Data Types
  • Table Engines
  • CLI
  • Configuration
  • Observability Metrics
  • Help
  • Release Notes
Contribution
  • Documentation
  • Framework

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"],});