跳至主要内容

如何测量查询处理时间而不返回行

了解如何在 ClickHouse 中使用 `FORMAT Null` 选项来测量查询处理时间,而无需向客户端返回任何行。

问题

我的查询返回很多行,但我只对查询处理时间感兴趣。如何省略查询输出并检查查询处理时间?

答案

在你的查询末尾添加 FORMAT Null,以将输出格式配置为 Null。这将阻止数据传输到客户端。

例如

SELECT
    customer_id,
    count() AS total,
    any(review_headline)
FROM amazon_reviews
GROUP BY customer_id
ORDER BY total DESC
FORMAT Null

响应将返回处理的行数和经过的时间,但将返回 0 行

0 rows in set. Elapsed: 25.288 sec. Processed 222.04 million rows, 13.50 GB (8.78 million rows/s., 533.77 MB/s.)
·1 分钟阅读
    © . This site is unofficial and not affiliated with ClickHouse, Inc.