Merge Table Engine

    Reading is automatically parallelized. Writing to a table is not supported. When reading, the indexes of tables that are actually being read are used, if they exist.

    The Merge engine accepts parameters: the database name and a regular expression for tables.

    Example 1:

    Data will be read from the tables in the hits database that have names that match the regular expression ‘^WatchLog’.

    Regular expressions — re2 (supports a subset of PCRE), case-sensitive.
    See the notes about escaping symbols in regular expressions in the “match” section.

    When selecting tables to read, the Merge table itself will not be selected, even if it matches the regex. This is to avoid loops.
    It is possible to create two Merge tables that will endlessly try to read each others’ data, but this is not a good idea.

    The typical way to use the Merge engine is for working with a large number of TinyLog tables as if with a single table.

    Example 2:

    Virtual Columns

    See Also

    Original article