95 lines
11 KiB
SQL
95 lines
11 KiB
SQL
ATTACH TABLE _ UUID '7bd174b0-5008-4e6d-8361-55c0442b52bf'
|
|
(
|
|
`hostname` LowCardinality(String) COMMENT 'Hostname of the server executing the query.',
|
|
`type` Enum8('QueryStart' = 1, 'QueryFinish' = 2, 'ExceptionBeforeStart' = 3, 'ExceptionWhileProcessing' = 4) COMMENT 'Type of an event that occurred when executing the query.',
|
|
`event_date` Date COMMENT 'Query starting date.',
|
|
`event_time` DateTime COMMENT 'Query starting time.',
|
|
`event_time_microseconds` DateTime64(6) COMMENT 'Query starting time with microseconds precision.',
|
|
`query_start_time` DateTime COMMENT 'Start time of query execution.',
|
|
`query_start_time_microseconds` DateTime64(6) COMMENT 'Start time of query execution with microsecond precision.',
|
|
`query_duration_ms` UInt64 COMMENT 'Duration of query execution in milliseconds.',
|
|
`read_rows` UInt64 COMMENT 'Total number of rows read from all tables and table functions participated in query. It includes usual subqueries, subqueries for IN and JOIN. For distributed queries read_rows includes the total number of rows read at all replicas. Each replica sends it\'s read_rows value, and the server-initiator of the query summarizes all received and local values. The cache volumes do not affect this value.',
|
|
`read_bytes` UInt64 COMMENT 'Total number of bytes read from all tables and table functions participated in query. It includes usual subqueries, subqueries for IN and JOIN. For distributed queries read_bytes includes the total number of rows read at all replicas. Each replica sends it\'s read_bytes value, and the server-initiator of the query summarizes all received and local values. The cache volumes do not affect this value.',
|
|
`written_rows` UInt64 COMMENT 'For INSERT queries, the number of written rows. For other queries, the column value is 0.',
|
|
`written_bytes` UInt64 COMMENT 'For INSERT queries, the number of written bytes (uncompressed). For other queries, the column value is 0.',
|
|
`result_rows` UInt64 COMMENT 'Number of rows in a result of the SELECT query, or a number of rows in the INSERT query.',
|
|
`result_bytes` UInt64 COMMENT 'RAM volume in bytes used to store a query result.',
|
|
`memory_usage` UInt64 COMMENT 'Memory consumption by the query.',
|
|
`current_database` LowCardinality(String) COMMENT 'Name of the current database.',
|
|
`query` String COMMENT ' Query string.',
|
|
`formatted_query` String COMMENT 'Formatted query string.',
|
|
`normalized_query_hash` UInt64 COMMENT 'A numeric hash value, such as it is identical for queries differ only by values of literals.',
|
|
`query_kind` LowCardinality(String) COMMENT 'Type of the query.',
|
|
`databases` Array(LowCardinality(String)) COMMENT 'Names of the databases present in the query.',
|
|
`tables` Array(LowCardinality(String)) COMMENT 'Names of the tables present in the query.',
|
|
`columns` Array(LowCardinality(String)) COMMENT 'Names of the columns present in the query.',
|
|
`partitions` Array(LowCardinality(String)) COMMENT 'Names of the partitions present in the query.',
|
|
`projections` Array(LowCardinality(String)) COMMENT 'Names of the projections used during the query execution.',
|
|
`views` Array(LowCardinality(String)) COMMENT 'Names of the (materialized or live) views present in the query.',
|
|
`exception_code` Int32 COMMENT 'Code of an exception.',
|
|
`exception` String COMMENT 'Exception message.',
|
|
`stack_trace` String COMMENT 'Stack trace. An empty string, if the query was completed successfully.',
|
|
`is_initial_query` UInt8 COMMENT 'Query type. Possible values: 1 — query was initiated by the client, 0 — query was initiated by another query as part of distributed query execution.',
|
|
`user` LowCardinality(String) COMMENT 'Name of the user who initiated the current query.',
|
|
`query_id` String COMMENT 'ID of the query.',
|
|
`address` IPv6 COMMENT 'IP address that was used to make the query.',
|
|
`port` UInt16 COMMENT 'The client port that was used to make the query.',
|
|
`initial_user` LowCardinality(String) COMMENT 'Name of the user who ran the initial query (for distributed query execution).',
|
|
`initial_query_id` String COMMENT 'ID of the initial query (for distributed query execution).',
|
|
`initial_address` IPv6 COMMENT 'IP address that the parent query was launched from.',
|
|
`initial_port` UInt16 COMMENT 'The client port that was used to make the parent query.',
|
|
`initial_query_start_time` DateTime COMMENT 'Initial query starting time (for distributed query execution).',
|
|
`initial_query_start_time_microseconds` DateTime64(6) COMMENT 'Initial query starting time with microseconds precision (for distributed query execution).',
|
|
`authenticated_user` LowCardinality(String) COMMENT 'Name of the user who was authenticated in the session.',
|
|
`interface` UInt8 COMMENT 'Interface that the query was initiated from. Possible values: 1 — TCP, 2 — HTTP.',
|
|
`is_secure` UInt8 COMMENT 'The flag whether a query was executed over a secure interface',
|
|
`os_user` LowCardinality(String) COMMENT 'Operating system username who runs clickhouse-client.',
|
|
`client_hostname` LowCardinality(String) COMMENT 'Hostname of the client machine where the clickhouse-client or another TCP client is run.',
|
|
`client_name` LowCardinality(String) COMMENT 'The clickhouse-client or another TCP client name.',
|
|
`client_revision` UInt32 COMMENT 'Revision of the clickhouse-client or another TCP client.',
|
|
`client_version_major` UInt32 COMMENT 'Major version of the clickhouse-client or another TCP client.',
|
|
`client_version_minor` UInt32 COMMENT 'Minor version of the clickhouse-client or another TCP client.',
|
|
`client_version_patch` UInt32 COMMENT 'Patch component of the clickhouse-client or another TCP client version.',
|
|
`script_query_number` UInt32 COMMENT 'The query number in a script with multiple queries for clickhouse-client.',
|
|
`script_line_number` UInt32 COMMENT 'The line number of the query start in a script with multiple queries for clickhouse-client.',
|
|
`http_method` UInt8 COMMENT 'HTTP method that initiated the query. Possible values: 0 — The query was launched from the TCP interface, 1 — GET method was used, 2 — POST method was used.',
|
|
`http_user_agent` LowCardinality(String) COMMENT 'HTTP header UserAgent passed in the HTTP query.',
|
|
`http_referer` String COMMENT 'HTTP header Referer passed in the HTTP query (contains an absolute or partial address of the page making the query).',
|
|
`forwarded_for` String COMMENT 'HTTP header X-Forwarded-For passed in the HTTP query.',
|
|
`quota_key` String COMMENT 'The quota key specified in the quotas setting (see keyed).',
|
|
`distributed_depth` UInt64 COMMENT 'How many times a query was forwarded between servers.',
|
|
`revision` UInt32 COMMENT 'ClickHouse revision.',
|
|
`log_comment` String COMMENT 'Log comment. It can be set to arbitrary string no longer than max_query_size. An empty string if it is not defined.',
|
|
`thread_ids` Array(UInt64) COMMENT 'Thread ids that are participating in query execution. These threads may not have run simultaneously.',
|
|
`peak_threads_usage` UInt64 COMMENT 'Maximum count of simultaneous threads executing the query.',
|
|
`ProfileEvents` Map(LowCardinality(String), UInt64) COMMENT 'ProfileEvents that measure different metrics. The description of them could be found in the table system.events',
|
|
`Settings` Map(LowCardinality(String), LowCardinality(String)) COMMENT 'Settings that were changed when the client ran the query. To enable logging changes to settings, set the log_query_settings parameter to 1.',
|
|
`used_aggregate_functions` Array(LowCardinality(String)) COMMENT 'Canonical names of aggregate functions, which were used during query execution.',
|
|
`used_aggregate_function_combinators` Array(LowCardinality(String)) COMMENT 'Canonical names of aggregate functions combinators, which were used during query execution.',
|
|
`used_database_engines` Array(LowCardinality(String)) COMMENT 'Canonical names of database engines, which were used during query execution.',
|
|
`used_data_type_families` Array(LowCardinality(String)) COMMENT 'Canonical names of data type families, which were used during query execution.',
|
|
`used_dictionaries` Array(LowCardinality(String)) COMMENT 'Canonical names of dictionaries, which were used during query execution.',
|
|
`used_formats` Array(LowCardinality(String)) COMMENT 'Canonical names of formats, which were used during query execution.',
|
|
`used_functions` Array(LowCardinality(String)) COMMENT 'Canonical names of functions, which were used during query execution.',
|
|
`used_storages` Array(LowCardinality(String)) COMMENT 'Canonical names of storages, which were used during query execution.',
|
|
`used_table_functions` Array(LowCardinality(String)) COMMENT 'Canonical names of table functions, which were used during query execution.',
|
|
`used_executable_user_defined_functions` Array(LowCardinality(String)) COMMENT 'Canonical names of executable user defined functions, which were used during query execution.',
|
|
`used_sql_user_defined_functions` Array(LowCardinality(String)) COMMENT 'Canonical names of sql user defined functions, which were used during query execution.',
|
|
`used_row_policies` Array(LowCardinality(String)) COMMENT 'The list of row policies names that were used during query execution.',
|
|
`used_privileges` Array(LowCardinality(String)) COMMENT 'Privileges which were successfully checked during query execution.',
|
|
`missing_privileges` Array(LowCardinality(String)) COMMENT 'Privileges that are missing during query execution.',
|
|
`transaction_id` Tuple(UInt64, UInt64, UUID) COMMENT 'The identifier of the transaction in scope of which this query was executed.',
|
|
`query_cache_usage` Enum8('Unknown' = 0, 'None' = 1, 'Write' = 2, 'Read' = 3) COMMENT 'Usage of the query cache during query execution. Values: \'Unknown\' = Status unknown, \'None\' = The query result was neither written into nor read from the query result cache, \'Write\' = The query result was written into the query result cache, \'Read\' = The query result was read from the query result cache.',
|
|
`asynchronous_read_counters` Map(LowCardinality(String), UInt64) COMMENT 'Metrics for asynchronous reading.',
|
|
`is_internal` UInt8 COMMENT 'Indicates whether it is an auxiliary query executed internally.',
|
|
`ProfileEvents.Names` Array(LowCardinality(String)) ALIAS mapKeys(ProfileEvents),
|
|
`ProfileEvents.Values` Array(UInt64) ALIAS mapValues(ProfileEvents),
|
|
`Settings.Names` Array(LowCardinality(String)) ALIAS mapKeys(Settings),
|
|
`Settings.Values` Array(LowCardinality(String)) ALIAS mapValues(Settings)
|
|
)
|
|
ENGINE = MergeTree
|
|
PARTITION BY toYYYYMM(event_date)
|
|
ORDER BY (event_date, event_time)
|
|
SETTINGS index_granularity = 8192
|
|
COMMENT 'Contains information about executed queries, for example, start time, duration of processing, error messages.\n\nIt is safe to truncate or drop this table at any time.'
|