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:
Instead of the database name, you can use a constant expression that returns a string. For example, .
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.
Example 2:
Let’s say you have a old table (WatchLog_old) and decided to change partitioning without moving data to a new table (WatchLog_new) and you need to see data from both tables.
Virtual Columns
See Also