-
CREATE TABLE cl_test7 ON CLUSTER '{cluster}' (
idString,month_bucketInt32,process_atDateTime,environment_idString,channel_idString,user_idString,bot_idString,bot_revisionString,channel_typeString,created_atDateTime,day_bucketString,durationInt32,flowString,intentString,lognameString,message_typeString,messagesString,othersString,prev_sessionString,received_atDateTime,responsesString,sent_atDateTime,sessionString,session_startDateTime,stateString,textString,user_created_atDateTime ) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{cluster}/{shard}/cl_test7', '{replica}') PARTITION BY toYYYYMM(process_at) ORDER BY (process_at, environment_id, channel_id, id);insert into cl_test10 ( id, month_bucket, process_at, environment_id, channel_id, user_id, bot_id, bot_revision, channel_type, created_at, day_bucket, duration, flow, intent, logname, message_type, messages, others, prev_session, received_at, responses, sent_at, session, session_start, state, text, user_created_at) select * from conversation_logs_stream_update where process_at >= toDate('2021-12-01') and process_at < toDate('2021-12-03');
select count(distinct user_id) as counts from cl_test5 where process_at >= toDateTime(1638403199000/1000) AND process_at < toDateTime(1638489596000/1000) AND message_type != 'command' AND environment_id = '1a30f39f-f305-473f-813f-8d16b56c2d7d' AND channel_id ='38565907-c95f-4301-9797-c1a713613934'
Please register or sign in to comment