在Cassandra中删除表或截断表,这是更好的 [英] Drop table or truncate table in Cassandra, which is better

查看:802
本文介绍了在Cassandra中删除表或截断表,这是更好的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个用例,我们需要使用Cassandra中的当前数据每天重新创建一个表。对于这应该我们使用drop table或truncate table,这将是有效的?我们不希望备份数据等?

We have a use case where we need to re-create a table every day with current data in Cassandra. For this should we use drop table or truncate table, which would be efficient? We do not want the data to be backed up etc?

感谢
Ankur

Thanks Ankur

推荐答案

删除表删除表和所有数据。 Truncate清除表中的所有数据,默认情况下会创建数据的快照(而不是模式)。效率明智,他们接近 - 虽然truncate将创建快照。您可以通过在cassandra yaml config中将auto_snapshot设置为false来禁用它,但它是服务器范围的。如果没有太多麻烦,我会丢弃并重新创建表格 - 但是如果你不等一段时间后再重新创建表格,我会看到一些问题。

Drop table drops the table and all data. Truncate clears all data in the table, and by default creates a snapshot of the data (but not the schema). Efficiency wise, they're close - though truncate will create the snapshot. You can disable this by setting auto_snapshot to false in cassandra yaml config, but it is server wide. If it's not too much trouble, I'd drop and recreate table - but I've seen issues if you don't wait a while after drop before recreating.

这篇关于在Cassandra中删除表或截断表,这是更好的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆