如何更新Clickhouse表以从中进行采样?
我正在尝试从Clickhouse表中采样行。 下面您可以找到表定义
CREATE TABLE trades
(
`id` UInt32,
`ticker_id` UUID,
`epoch` DateTime,
`nanoseconds` UInt32,
`amount` Float64,
`cost` Float64,
`price` Float64,
`side` UInt8
)
ENGINE = MergeTree
PARTITION BY (ticker_id, toStartOfInterval(epoch, toIntervalHour(1)))
ORDER BY (ticker_id, epoch)
SETTINGS index_granularity = 8192
我想从表中采样10000行,
SELECT * FROM trades SAMPLE 10000 ;
但是当我尝试运行上面的查询时,我会收到以下错误:
db ::异常:非法示例:表不支持采样
我想alter
为了能够从中取样,但与此同时,我想确保在更改该数据时不会损坏数据桌子。 桌子有大约10亿行。
在确保数据不会损坏的同时更改桌子的好方法是什么?
I'm trying to sample rows from a clickhouse table.
Below you can find the table definition
CREATE TABLE trades
(
`id` UInt32,
`ticker_id` UUID,
`epoch` DateTime,
`nanoseconds` UInt32,
`amount` Float64,
`cost` Float64,
`price` Float64,
`side` UInt8
)
ENGINE = MergeTree
PARTITION BY (ticker_id, toStartOfInterval(epoch, toIntervalHour(1)))
ORDER BY (ticker_id, epoch)
SETTINGS index_granularity = 8192
I want to sample 10000 rows from the table
SELECT * FROM trades SAMPLE 10000 ;
But when I'm trying to run the query above I'm getting the following error:
DB::Exception: Illegal SAMPLE: table doesn't support sampling
I want to ALTER
the table in order to be able to sample from it, but at the same time I want to make sure that I won't corrupt the data while altering the table.
The table has about 1 billion rows.
What would be a good way to ALTER the table while making sure the data won't get corrupted?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试:
you can try: