> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-trino-dialect.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Definitions of database concepts and ClickHouse terminology, with emphasis on behavior that differs from transactional databases.

# Glossary

export const Glossary = ({children, metadata = {}}) => {
  const nodeText = node => {
    if (node === null || node === undefined || typeof node === 'boolean') return '';
    if (typeof node === 'string' || typeof node === 'number') return String(node);
    if (Array.isArray(node)) return node.map(nodeText).join(' ');
    return nodeText(node.props && node.props.children);
  };
  const entries = [];
  const childNodes = Array.isArray(children) ? children : [children];
  let currentEntry;
  childNodes.forEach(node => {
    const id = node && node.props && node.props.id;
    if (id) {
      currentEntry = {
        id,
        term: nodeText(node),
        content: [],
        ...metadata[id] || ({})
      };
      entries.push(currentEntry);
    } else if (currentEntry && node !== null && node !== undefined) {
      currentEntry.content.push(node);
    }
  });
  const [query, setQuery] = useState('');
  const searchForms = value => {
    const text = String(value);
    const lowercase = text.toLowerCase();
    const words = text.replace(/([a-z0-9])([A-Z])/g, '$1 $2').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
    return [...new Set([lowercase, words])];
  };
  const queryForms = searchForms(query.trim()).filter(Boolean);
  const matches = (value, exact = false) => searchForms(value).some(valueForm => queryForms.some(queryForm => exact ? valueForm === queryForm : valueForm.includes(queryForm)));
  const matchRank = entry => {
    if (matches(entry.term, true)) return 2;
    if ((entry.aliases || []).some(value => matches(value, true))) return 1;
    return 0;
  };
  const visibleEntries = queryForms.length > 0 ? entries.filter(entry => [entry.term, ...entry.aliases || [], nodeText(entry.content)].some(value => matches(value))).sort((a, b) => matchRank(b) - matchRank(a)) : entries;
  return <div className="not-prose glossary-browser">
      <div className="glossary-search-row">
        <label className="sr-only" htmlFor="glossary-search">Search glossary terms and definitions</label>
        <div className="glossary-search-wrap">
          <svg aria-hidden="true" viewBox="0 0 20 20" className="glossary-search-icon">
            <path d="m17 17-3.7-3.7m1.7-4.8A6.5 6.5 0 1 1 2 8.5a6.5 6.5 0 0 1 13 0Z" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
          </svg>
          <input id="glossary-search" type="search" value={query} onChange={event => setQuery(event.target.value)} placeholder="Search terms and definitions..." autoComplete="off" />
        </div>
        <span className="glossary-count" aria-live="polite">
          {visibleEntries.length} {visibleEntries.length === 1 ? 'term' : 'terms'}
        </span>
      </div>

      {visibleEntries.length > 0 ? <div className="glossary-grid">
          {visibleEntries.map(entry => <article key={entry.id} className="glossary-entry">
              <h2 id={entry.id} className="glossary-entry-title">
                {entry.code ? <code>{entry.term}</code> : entry.term}
              </h2>
              {(entry.legacyIds || []).map(id => <span key={id} id={id} className="glossary-entry-legacy-anchor" aria-hidden="true" />)}
              <div className="glossary-entry-description">{entry.content}</div>
              {entry.learnMore && <a className="glossary-entry-link" href={entry.learnMore}>
                  Learn more <span aria-hidden="true">→</span>
                </a>}
            </article>)}
        </div> : <div className="glossary-empty">
          <p>No glossary terms match “{query}”.</p>
          <button type="button" onClick={() => setQuery('')}>Clear search</button>
        </div>}

      <style>{`
        .glossary-browser { margin-top: 1.5rem; }
        .glossary-search-row { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
        .glossary-search-wrap { position: relative; flex: 1; }
        .glossary-search-icon { position: absolute; top: 50%; left: .85rem; width: 1rem; height: 1rem; color: #6b7280; transform: translateY(-50%); pointer-events: none; }
        .glossary-search-wrap input { width: 100%; height: 2.75rem; padding: 0 1rem 0 2.5rem; color: inherit; background: var(--background-light, #fff); border: 1px solid rgb(156 163 175 / .35); border-radius: .5rem; outline: none; }
        .glossary-search-wrap input:focus { border-color: #f1c40f; box-shadow: 0 0 0 3px rgb(253 255 117 / .35); }
        .dark .glossary-search-wrap input { background: var(--background-dark, #151515); border-color: rgb(107 114 128 / .45); }
        .glossary-count { flex: none; min-width: 4.5rem; color: #6b7280; font-size: .8rem; text-align: right; }
        .dark .glossary-count { color: #9ca3af; }
        .glossary-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .85rem; }
        .glossary-entry { position: relative; padding: 1.15rem 1.25rem; background: var(--background-light, #fff); border: 1px solid rgb(156 163 175 / .3); border-radius: .65rem; }
        .dark .glossary-entry { background: var(--background-dark, #151515); border-color: rgb(107 114 128 / .35); }
        .glossary-entry-title { margin: 0 0 .55rem; scroll-margin-top: 6rem; font-size: 1.05rem; line-height: 1.35; }
        .glossary-entry-legacy-anchor { position: absolute; top: 0; scroll-margin-top: 6rem; }
        .glossary-entry-title code { font-size: .95em; }
        .glossary-entry-description { color: #4b5563; font-size: .9rem; line-height: 1.55; }
        .dark .glossary-entry-description { color: #d1d5db; }
        .glossary-entry-description p { margin: 0; }
        .glossary-entry-link { display: inline-block; margin-top: .75rem; color: inherit; font-size: .85rem; font-weight: 600; text-decoration: none; }
        .glossary-entry-link:hover { text-decoration: underline; }
        .glossary-empty { padding: 2.5rem 1rem; text-align: center; border: 1px dashed rgb(156 163 175 / .45); border-radius: .65rem; }
        .glossary-empty p { margin: 0 0 .75rem; color: #6b7280; }
        .glossary-empty button { padding: .45rem .75rem; color: inherit; background: transparent; border: 1px solid rgb(156 163 175 / .45); border-radius: .4rem; cursor: pointer; }
        @media (min-width: 768px) {
          .glossary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        }
        @media (max-width: 520px) {
          .glossary-search-row { align-items: stretch; flex-direction: column; }
          .glossary-count { min-width: 0; text-align: left; }
        }
      `}</style>
    </div>;
};

A glossary of database concepts and ClickHouse terminology, including how familiar database terms differ in ClickHouse.

export const glossaryMetadata = {
  delete: {
    learnMore: '/deletes/overview'
  },
  deduplication: {
    aliases: ['duplicate rows', 'unique constraint'],
    learnMore: '/guides/developer/deduplication'
  },
  dictionary: {
    learnMore: '/dictionary'
  },
  'distributed-table': {
    learnMore: '/engines/table-engines/special/distributed'
  },
  final: {
    aliases: ['still see duplicates', 'query-time merge'],
    code: true,
    learnMore: '/sql-reference/statements/select/from#final-modifier'
  },
  granule: {
    learnMore: '/guides/clickhouse/data-modelling/sparse-primary-indexes#clickhouse-index-design'
  },
  'incremental-materialized-view': {
    aliases: ['insert trigger'],
    learnMore: '/materialized-view/incremental-materialized-view'
  },
  json: {
    code: true,
    learnMore: '/sql-reference/data-types/newjson'
  },
  'materialized-view': {
    aliases: ['MV', 'stored query', 'insert trigger', 'dynamic table', 'dynamic tables'],
    learnMore: '/materialized-views'
  },
  merge: {
    learnMore: '/merges'
  },
  mergetree: {
    code: true,
    learnMore: '/engines/table-engines/mergetree-family/mergetree'
  },
  mutation: {
    aliases: ['ALTER UPDATE', 'ALTER DELETE', 'MERGE statement'],
    learnMore: '/concepts/best-practices/avoid-mutations'
  },
  'nullable-column': {
    aliases: ['NULL', 'NULL vs default value'],
    learnMore: '/sql-reference/data-types/nullable'
  },
  parts: {
    learnMore: '/concepts/core-concepts/parts'
  },
  partition: {
    aliases: ['PARTITION BY', 'partition pruning'],
    learnMore: '/partitions'
  },
  'partitioning-key': {
    learnMore: '/concepts/core-concepts/partitions'
  },
  'primary-key': {
    aliases: ['ORDER BY', 'sorting key', 'unique key', 'unique constraint'],
    learnMore: '/concepts/core-concepts/primary-indexes'
  },
  projection: {
    aliases: ['projection vs materialized view', 'alternate ordering'],
    learnMore: '/data-modeling/projections'
  },
  'refreshable-materialized-view': {
    aliases: ['scheduled materialized view', 'refresh materialized view', 'scheduled query', 'scheduled queries'],
    learnMore: '/materialized-view/refreshable-materialized-view'
  },
  replacingmergetree: {
    aliases: ['upsert', 'deduplication', 'still have duplicates', 'MERGE statement'],
    code: true,
    learnMore: '/guides/replacing-merge-tree'
  },
  'secondary-index': {
    learnMore: '/optimize/skipping-indexes'
  },
  'skipping-index': {
    learnMore: '/optimize/skipping-indexes'
  },
  'sorting-key': {
    aliases: ['ORDER BY', 'primary key', 'on-disk order', 'clustering key', 'clustering columns', 'clustered table', 'CLUSTER BY'],
    learnMore: '/concepts/best-practices/choosing-a-primary-key'
  },
  'sparse-index': {
    learnMore: '/guides/clickhouse/data-modelling/sparse-primary-indexes'
  },
  'table-engine': {
    learnMore: '/engines/table-engines'
  },
  transaction: {
    learnMore: '/guides/developer/transactional'
  },
  ttl: {
    aliases: ['expiration', 'retention', 'data retention'],
    code: true,
    learnMore: '/concepts/features/operations/delete/ttl'
  },
  update: {
    aliases: ['row update', 'lightweight update'],
    legacyIds: ['lightweight-update'],
    learnMore: '/updating-data/overview'
  },
  upsert: {
    aliases: ['ON CONFLICT', 'insert or update', 'MERGE statement'],
    learnMore: '/guides/replacing-merge-tree'
  },
  warehouse: {
    aliases: ['compute-compute separation', 'virtual warehouse', 'virtual warehouses'],
    learnMore: '/cloud/reference/warehouses'
  }
};

<Glossary metadata={glossaryMetadata}>
  <h2 id="atomicity">
    Atomicity
  </h2>

  Atomicity means an operation is observed either in full or not at all. In ClickHouse, an insert into one partition of one `MergeTree`-family table is atomic when its rows are written as a single block. An insert spanning partitions is atomic separately for each partition, and an insert into a distributed table is atomic separately for each shard. Multi-statement transactions remain experimental and restricted.

  <h2 id="block">
    Block
  </h2>

  A block is a self-describing columnar batch of rows used for query processing and data transfer. Blocks are runtime and wire units; data parts and granules are separate storage and indexing concepts. Processing column values in blocks enables vectorized execution.

  <h2 id="cluster">
    Cluster
  </h2>

  A collection of nodes (servers) that work together to store and process data.

  <h2 id="cmek">
    CMEK
  </h2>

  In ClickHouse Cloud, customer-managed encryption keys (CMEK) allow a customer's key-management service (KMS) key to protect the data encryption key (DEK) used for data at rest.

  <h2 id="delete">
    Delete
  </h2>

  For `MergeTree`-family tables, deleting rows can mean marking them as deleted with `DELETE FROM`, rewriting affected data parts with `ALTER TABLE ... DELETE`, or efficiently removing an entire partition. Lightweight deletes hide rows from subsequent queries before the data is physically removed during background merges.

  <h2 id="deduplication">
    Deduplication
  </h2>

  Deduplication can refer to different mechanisms in ClickHouse. For row-version deduplication, engines such as `ReplacingMergeTree` identify duplicate versions by the sorting key and resolve them during background merges within a partition. Replicated table engines can separately deduplicate retried insert blocks by their block identifiers.

  <h2 id="dictionary">
    Dictionary
  </h2>

  A dictionary provides key-value access to reference data from an in-memory or external source. For compatible key-based lookups, dictionary functions or a direct dictionary `JOIN` can avoid repeatedly scanning a reference table.

  <h2 id="distributed-table">
    Distributed table
  </h2>

  A distributed table in ClickHouse is a special type of table that doesn't store data itself but provides a unified view for distributed query processing across multiple servers in a cluster.

  <h2 id="final">
    `FINAL`
  </h2>

  `FINAL` is a query modifier that applies an engine's merge-time transformations while reading data, without physically merging the stored parts. It can return reconciled results from engines such as `ReplacingMergeTree` before background merges finish, at the cost of additional query-time compute and memory.

  <h2 id="granule">
    Granule
  </h2>

  A granule is the smallest logical group of rows ClickHouse reads for primary-index pruning. It contains up to 8,192 rows by default, but adaptive index granularity can create smaller granules. The primary index normally stores one entry per granule.

  <h2 id="incremental-materialized-view">
    Incremental materialized view
  </h2>

  An incremental materialized view runs its query as data is inserted into a source table and writes the result to a target table. It processes only the newly inserted blocks, not the source table's complete current state, and changes to joined right-side tables don't retrigger it.

  <h2 id="json">
    `JSON`
  </h2>

  The `JSON` type stores semi-structured documents whose paths and types may vary between rows. ClickHouse stores discovered paths as subcolumns so queries can read individual fields efficiently. Use typed columns or structural types such as `Tuple` when the schema is stable.

  <h2 id="mark-file">
    Mark file
  </h2>

  A mark file stores offsets that locate granules in compressed column data. Each mark records an offset in the compressed file and an offset within the corresponding decompressed block, allowing ClickHouse to seek to a granule without reading the entire column.

  <h2 id="materialized-view">
    Materialized view
  </h2>

  ClickHouse has two materialized-view models. An incremental materialized view acts like an insert-time trigger that processes newly inserted blocks, while a refreshable materialized view periodically reruns its query over the full dataset. Features with similar names in other databases may combine these behaviors, so there isn't always a one-to-one mapping.

  <h2 id="merge">
    Merge
  </h2>

  A merge in ClickHouse is a background storage operation that combines smaller immutable data parts into larger parts within the same partition. Depending on the table engine, merges can also aggregate, collapse, or replace rows; they aren't the same as a transactional SQL `MERGE` statement.

  <h2 id="mergetree">
    `MergeTree`
  </h2>

  A `MergeTree` in ClickHouse is a table engine designed for high data ingest rates and large data volumes. It is the core storage engine in ClickHouse, providing features such as columnar storage, custom partitioning, sparse primary indexes, and support for background data merges.

  <h2 id="mutation">
    Mutation
  </h2>

  For `MergeTree`-family tables, a mutation modifies or deletes existing data with commands such as `ALTER TABLE ... UPDATE` or `ALTER TABLE ... DELETE`. Unlike an OLTP row update, it rewrites affected data parts and normally proceeds asynchronously; parts are replaced as they become ready, so the operation isn't an atomic table-wide transaction.

  <h2 id="nullable-column">
    Nullable column
  </h2>

  A column must use `Nullable(T)` to distinguish `NULL` from ordinary values of type `T`, including values such as `0` or an empty string. ClickHouse stores a separate null mask, which adds storage and processing overhead, so use nullable columns when missing values have meaningful semantics rather than as a default choice.

  <h2 id="on-the-fly-mutation">
    On-the-fly mutation
  </h2>

  When `apply_mutations_on_fly` is enabled for both a mutation and subsequent reads, ClickHouse applies pending updates or deletes during `SELECT` queries so their results are visible before the stored parts are rewritten. The mutation is still materialized asynchronously in the background.

  <h2 id="parts">
    Parts
  </h2>

  A data part is an immutable collection of files on storage containing a portion of a table's rows. Parts are created by inserts and combined by background merges within a partition. Unlike a partition, which is a logical grouping of data, a part is a physical storage unit managed by ClickHouse.

  <h2 id="partition">
    Partition
  </h2>

  A partition is a logical grouping of data parts in a `MergeTree`-family table. Partitioning is primarily for data-management operations such as dropping, moving, and applying retention policies to groups of data. Partition pruning can help queries that select only a few partitions, but the sorting and primary keys are usually more important for query performance.

  <h2 id="partitioning-key">
    Partitioning key
  </h2>

  A partitioning key is the expression in a table's `PARTITION BY` clause. Rows that produce the same partition ID belong to the same logical partition, while separate inserts can create separate data parts inside that partition. The grouping enables operations such as dropping, moving, or archiving an entire partition.

  <h2 id="primary-key">
    Primary key
  </h2>

  Unlike a primary key in many transactional databases, a ClickHouse primary key isn't a row-level uniqueness constraint. It defines the columns in a sparse primary index that helps ClickHouse skip granules while reading. By default it matches the sorting key defined by `ORDER BY`; if defined separately, it must be a prefix of the sorting key.

  <h2 id="projection">
    Projection
  </h2>

  A projection is an automatically maintained representation of a table's data with an alternate ordering, a subset of columns, or a precomputed aggregation. ClickHouse can choose it automatically while querying the original table. Projections may duplicate stored data and add write overhead, although `_part_offset` projections can trade storage for additional reads from the base table.

  <h2 id="refreshable-materialized-view">
    Refreshable materialized view
  </h2>

  A refreshable materialized view periodically reruns its query over the full dataset and replaces or appends the stored result on a schedule. Unlike an incremental materialized view, it isn't triggered by each inserted block and can use complex queries. It can replace a scheduled query that materializes a `SELECT` result, but it isn't a general-purpose scheduler for arbitrary DDL or DML statements.

  <h2 id="replacingmergetree">
    `ReplacingMergeTree`
  </h2>

  `ReplacingMergeTree` models updates and upserts by accepting multiple versions of rows with the same sorting key and retaining one version during background merges. Deduplication is eventual rather than an insert-time uniqueness guarantee, so queries may see multiple versions until they use `FINAL`, equivalent query logic, or the relevant parts merge.

  <h2 id="replica">
    Replica
  </h2>

  A replica is a server or compute instance that maintains or accesses the same logical table data as other replicas for availability and query capacity. With `ReplicatedMergeTree`, replicas maintain independent copies of data; ClickHouse Cloud replicas using `SharedMergeTree` share object storage instead.

  <h2 id="secondary-index">
    Secondary index
  </h2>

  In ClickHouse, the closest analogue to a conventional secondary index is usually a data skipping index. Instead of locating individual rows through a B-tree, it stores metadata for groups of granules so ClickHouse can avoid reading blocks that can't contain matching values.

  <h2 id="shard">
    Shard
  </h2>

  A shard is a logical subset of table data assigned to one server or replica group in a distributed deployment. Sharding divides data and query work across servers; replicas provide redundant or parallel access to the data within each shard.

  <h2 id="skipping-index">
    Skipping index
  </h2>

  A data skipping index stores compact metadata for one or more consecutive granules so ClickHouse can avoid reading blocks that cannot match a query. It is most effective when indexed values correlate with the table's ordering and may provide little benefit when matching values occur in most indexed blocks.

  <h2 id="sorting-key">
    Sorting key
  </h2>

  For a `MergeTree`-family table, the `ORDER BY` clause defines the sorting key: the physical row order within each data part. It serves a similar purpose to clustering columns or clustering keys in other analytical databases, but ClickHouse uses it to maintain a defined lexicographic row order. If no separate primary key is specified, the sorting key also becomes the primary key; the two keys are related but aren't required to be identical.

  <h2 id="sparse-index">
    Sparse index
  </h2>

  A sparse primary index stores key values for each granule rather than one entry per row. ClickHouse uses these entries to identify candidate granules and then reads their rows. Because its size scales with granules rather than rows, the index is usually small enough to keep in memory.

  <h2 id="table-engine">
    Table engine
  </h2>

  Table engines in ClickHouse determine how data is written, stored and accessed. `MergeTree` is the most common table engine, and allows quick insertion of large amounts of data which get processed in the background.

  <h2 id="transaction">
    Transaction
  </h2>

  In ClickHouse, transactional guarantees are scoped differently from those in a typical OLTP database. Qualifying inserts are atomic at the block or partition level, while conventional multi-statement transactions with `COMMIT` and `ROLLBACK` remain experimental and have significant restrictions.

  <h2 id="ttl">
    `TTL`
  </h2>

  `TTL` rules move, delete, or roll up data after an expression becomes eligible. Expiration isn't immediate: ClickHouse normally applies expired-data actions during background merges, so expired rows can remain on disk and be returned by queries until a merge processes the relevant parts.

  <h2 id="update">
    Update
  </h2>

  ClickHouse is optimized for immutable, append-heavy data rather than frequent in-place row updates. Updates are commonly modeled by inserting new versions with specialized table engines or performed as mutations that rewrite affected data parts.

  <h2 id="upsert">
    Upsert
  </h2>

  `MergeTree`-family tables don't perform a transactional `INSERT ... ON CONFLICT` upsert. Upserts are commonly modeled by inserting a newer row version into an engine such as `ReplacingMergeTree`. Older versions are resolved during background merges, so queries may need `FINAL` or equivalent logic until merging occurs.

  <h2 id="warehouse">
    Warehouse
  </h2>

  In ClickHouse Cloud, a warehouse is a set of services that share the same data but have independent compute resources and endpoints. In systems where a warehouse represents one compute cluster, an individual ClickHouse service is the closer analogue; a ClickHouse warehouse groups multiple services.
</Glossary>
