Moose lets you declare secondary/data-skipping indexes directly in your table definitions.
Moose generates the ClickHouse INDEX clauses on create and
plans ALTER TABLE ADD/DROP INDEX operations when you change them later.
minmax, Set(max_rows), ngrambf_v1(...), bloom_filter.import { OlapTable, ClickHouseEngines } from "@514labs/moose-lib"; interface Events { id: string; user: string; message: string;} export const EventsTable = new OlapTable<Events>("Events", { engine: ClickHouseEngines.MergeTree, orderByFields: ["id"], indexes: [ { name: "idx_user", expression: "user", type: "minmax", granularity: 1 }, { name: "idx_message_ngrams", expression: "message", type: "ngrambf_v1", arguments: ["3", "256", "1", "123"], granularity: 1, }, ],});INDEX ... entries inside CREATE TABLE.ALTER TABLE DROP INDEX <name> then ADD INDEX ... if the definition changed; pure adds/drops are applied as single operations.