MySQL

    See a detailed description of the CREATE TABLE query.

    The table structure can differ from the original MySQL table structure:

    • Column names should be the same as in the original MySQL table, but you can use just some of these columns and in any order.
    • host:port — MySQL server address.
    • database — Remote database name.
    • table — Remote table name.
    • user — MySQL user.
    • replace_query — Flag that converts INSERT INTO queries to . If replace_query=1, the query is substituted.
    • on_duplicate_clause — The ON DUPLICATE KEY on_duplicate_clause expression that is added to the INSERT query.

      Example: INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1, where on_duplicate_clause is UPDATE c2 = c2 + 1. See the to find which you can use with the ON DUPLICATE KEY clause.

    Simple WHERE clauses such as are executed on the MySQL server.

    The rest of the conditions and the LIMIT sampling constraint are executed in ClickHouse only after the query to MySQL finishes.

    Table in ClickHouse, retrieving data from the MySQL table created above: