Questions about distributed tables

146 views
Skip to first unread message

tdingus

unread,
May 10, 2018, 5:14:49 PM5/10/18
to ClickHouse
1. Can Distributed table belong to a database (i.e., my_db) other than default?
    For example, 
       For local table
       CREATE TABLE my_db.ontime_local (...) ENGINE = MergeTree(FlightDate, (Year, FlightDate), 8192);
       For distributed table
           CREATE TABLE my_db.ontime_all AS my_db.ontime_local ENGINE = Distributed(perftest_3shards_1replicas, default, ontime_local, rand());

     I tried this, and it doesn't seem to work.

2. If I drop the distributed table and create it again, how long clickhouse-server would pick up the changes?
    For example, I changed Distributed table name from ontime_all to my_db.ontime_all, the change was picked up by the query very shortly. However, the ingestion only goes to the local table but not the remote. I waited for quite long time but I don't know if it would ever pick up. 

Thanks!

tatiana....@revjet.com

unread,
May 11, 2018, 11:54:11 AM5/11/18
to ClickHouse
1. I'm not sure I understand the question.
Maybe try CREATE TABLE my_db.ontime_all AS my_db.ontime_local ENGINE = Distributed(perftest_3shards_1replicas, my_db, ontime_local, rand());

2. If you drop and create a distributed table, CH will pick up changes immediately.
Check the data directory for the distributed table to see where it is sending data and CH logs to see if there are any errors
Message has been deleted

tdingus

unread,
May 11, 2018, 4:16:53 PM5/11/18
to ClickHouse
Tatiana, Thanks.

When I tried again, it works!

I don't know why it didn't work the first time.

Reply all
Reply to author
Forward
0 new messages