0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Range tombstones

Posted at

CassandraのRange tombstonesについて

Range tombstoneは、範囲検索で複数の行が明示的に削除されると生成するtombstone

before

cqlsh:sitest01> select * from test_tomb where pkey1 = 'shiro' and pkey2 = 1;

 pkey1 | pkey2 | skey1 | v1
-------+-------+-------+-------------------
 shiro |     1 |     1 | American Wirehair
 shiro |     1 |     2 |   Aphrodite Giant
 shiro |     1 |     3 |       Arabian Mau
 shiro |     1 |     4 |   Australian Mist
 shiro |     1 |     5 |             Asian

(5 rows)

  {
    "partition" : {
      "key" : [ "shiro", "1" ],
      "position" : 427
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 486,
        "clustering" : [ 1 ],
        "liveness_info" : { "tstamp" : "2019-12-15T09:42:42.153272Z" },
        "cells" : [
          { "name" : "v1", "value" : "American Wirehair" }
        ]
      },
      {
        "type" : "row",
        "position" : 486,
        "clustering" : [ 2 ],
        "liveness_info" : { "tstamp" : "2019-12-15T09:42:42.157185Z" },
        "cells" : [
          { "name" : "v1", "value" : "Aphrodite Giant" }
        ]
      },
      {
        "type" : "row",
        "position" : 514,
        "clustering" : [ 3 ],
        "liveness_info" : { "tstamp" : "2019-12-15T09:42:42.161256Z" },
        "cells" : [
          { "name" : "v1", "value" : "Arabian Mau" }
        ]
      },
      {
        "type" : "row",
        "position" : 538,
        "clustering" : [ 4 ],
        "liveness_info" : { "tstamp" : "2019-12-15T09:42:42.165179Z" },
        "cells" : [
          { "name" : "v1", "value" : "Australian Mist" }
        ]
      },
      {
        "type" : "row",
        "position" : 566,
        "clustering" : [ 5 ],
        "liveness_info" : { "tstamp" : "2019-12-15T09:42:42.168827Z" },
        "cells" : [
          { "name" : "v1", "value" : "Asian" }
        ]
      }
    ]
  },

delete

cqlsh:sitest01> delete from test_tomb where pkey1 = 'shiro' and pkey2 = 1 and skey1 > 2;

after

cqlsh:sitest01> select * from test_tomb where pkey1 = 'shiro' and pkey2 = 1;

 pkey1 | pkey2 | skey1 | v1
-------+-------+-------+-------------------
 shiro |     1 |     1 | American Wirehair
 shiro |     1 |     2 |   Aphrodite Giant

(2 rows)

  {
    "partition" : {
      "key" : [ "shiro", "1" ],
      "position" : 427
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 486,
        "clustering" : [ 1 ],
        "liveness_info" : { "tstamp" : "2019-12-15T09:42:42.153272Z" },
        "cells" : [
          { "name" : "v1", "value" : "American Wirehair" }
        ]
      },
      {
        "type" : "row",
        "position" : 486,
        "clustering" : [ 2 ],
        "liveness_info" : { "tstamp" : "2019-12-15T09:42:42.157185Z" },
        "cells" : [
          { "name" : "v1", "value" : "Aphrodite Giant" }
        ]
      },
      {
        "type" : "range_tombstone_bound",
        "start" : {
          "type" : "exclusive",
          "clustering" : [ 2 ],
          "deletion_info" : { "marked_deleted" : "2019-12-15T09:49:02.558939Z", "local_delete_time" : "2019-12-15T09:49:02Z" }
        }
      },
      {
        "type" : "range_tombstone_bound",
        "end" : {
          "type" : "inclusive",
          "deletion_info" : { "marked_deleted" : "2019-12-15T09:49:02.558939Z", "local_delete_time" : "2019-12-15T09:49:02Z" }
        }
      }
    ]
  }

Estimated tombstone drop times:
1576403400:         2

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?