实时分析数据仓储可观测性AI/MLOSS
ClickHouse 是一个 SQL 数据库,你可以像平时一样编写熟悉的 SELECT 查询来查询数据。例如:
SELECT *
FROM helloworld.my_first_table
ORDER BY timestamp注意,返回结果会以清晰的表格形式显示:
┌─user_id─┬─message────────────────────────────────────────────┬───────────timestamp─┬──metric─┐
│ 102 │ Insert a lot of rows per batch │ 2022-03-21 00:00:00 │ 1.41421 │
│ 102 │ Sort your data based on your commonly-used queries │ 2022-03-22 00:00:00 │ 2.718 │
│ 101 │ Hello, ClickHouse! │ 2022-03-22 14:04:09 │ -1 │
│ 101 │ Granules are the smallest chunks of data read │ 2022-03-22 14:04:14 │ 3.14159 │
└─────────┴────────────────────────────────────────────────────┴─────────────────────┴─────────┘
4 rows in set. Elapsed: 0.008 sec.使用 FORMAT 子句指定 ClickHouse 支持的多种输出格式 中的一种:
SELECT *
FROM helloworld.my_first_table
ORDER BY timestamp
FORMAT TabSeparated在上述查询中,输出将以制表符分隔的形式返回:
Query id: 3604df1c-acfd-4117-9c56-f86c69721121
102 Insert a lot of rows per batch 2022-03-21 00:00:00 1.41421
102 Sort your data based on your commonly-used queries 2022-03-22 00:00:00 2.718
101 Hello, ClickHouse! 2022-03-22 14:04:09 -1
101 Granules are the smallest chunks of data read 2022-03-22 14:04:14 3.14159
4 rows in set. Elapsed: 0.005 sec.