用INSERT覆盖cassandra中的行,会导致墓碑吗? [英] Overwrite row in cassandra with INSERT, will it cause tombstone?

查看:898
本文介绍了用INSERT覆盖cassandra中的行,会导致墓碑吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于数据量和速度,在我们的案例中,将数据写入Cassandra而不导致其创建墓碑是至关重要的。目前我们只写了一行,然后再也不需要更新行了,只是再次获取数据。



现在有一个例子,我们实际上需要写入数据,然后用更多的数据完成它,这是一段时间后完成的。
可以通过


  1. 使用INSERT重写所有数据



  2. $ b

    什么是最好的方法,记住速度和不创建墓碑是非常重要的?

    解决方案

    只有在删除数据或使用TTL值时才会创建Tombstones。



    Cassandra与您所描述的用例非常吻合。增量式添加数据将适用于INSERT和UPDATE语句。 Cassandra将在不同位置存储数据,以便在为同一分区键随时间添加数据的情况下。定期运行压缩将再次合并单个键的数据,以优化访问和可用磁盘空间。这将基于写入值的时间戳发生,但不创建任何新的墓碑。
    您可以详细了解Cassandra如何存储数据。 此处


    Writing data to Cassandra without causing it to create tombstones are vital in our case, due to the amount of data and speed. Currently we have only written a row once, and then never had the need to update the row again, only fetch the data again.

    Now there has been a case, where we actually need to write data, and then complete it with more data, that is finished after awhile. It can be made by either;

    1. overwrite all of the data in a row again using INSERT (all data is available), or

    2. performing an Update only on the new data.

    What is the best way to do it, bear in mind of the speed and not creating a tombstone is of importance ?

    解决方案

    Tombstones will only created when deleting data or using TTL values.

    Cassandra does align very well to your described use case. Incrementally adding data will work for both INSERT and UPDATE statements. Cassandra will store data in different locations in case of adding data over time for the same partition key. Periodically running compactions will merge data again for a single key to optimize access and free disk space. This will happend based on the timestamp of written values but does not create any new tombstones. You can learn more about how Cassandra stores data e.g. here.

    这篇关于用INSERT覆盖cassandra中的行,会导致墓碑吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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