【问题标题】:How to delete data from Tarantool?如何从 Tarantool 删除数据?
【发布时间】:2020-02-05 21:26:43
【问题描述】:

我想按条件从 Tarantool 空间中删除数据。 我想实现结果等于 SQL 查询:

DELETE from 'books' where 'timestamp'< 123456789

当我使用这个查询时,它以 error 结尾:Failed to allocate 16384 bytes in mempool for new slab

我有空间books。我做:

books:delete(1)

它删除行但我的空间 len 增加:

books:len()

那么我该如何在 Tarantool 中做到这一点?

【问题讨论】:

    标签: lua tuples tarantool


    【解决方案1】:

    box.cfg{} 中增加memtx_memory 参数以克服memtx 空间的“分配失败”错误(乙烯基空间和vinyl_memory 相同):

    box.cfg{
        <...>,
        memtx_memory = <...>,
        vinyl_memory = <...>,
        <...>,
    }
    

    我猜你使用的是黑胶引擎。 &lt;space object&gt;:len()&lt;index object&gt;:len() 估计为 LSM 树中的语句数,可能大于空间中的实际元组数。删除操作会在 LSM 树中创建一条语句,因此它会增加 :len() 的值。

    如果您需要乙烯基空间中的确切数量的元组,请使用:count(),但最好避免这种情况,因为它的复杂性是线性的(对整个空间进行全扫描,对于大型空格)。请参阅documetation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多