3
votes

When we create any HBase table, does timestamp appear in that table when we scan it?

For example:

create 'test', 'cf'

put 'test', 'row1', 'cf:a', 'value1'

put 'test', 'row2', 'cf:b', 'value2'

put 'test', 'row3', 'cf:c', 'value3'

scan 'test'

ROW COLUMN+CELL

row1 column=cf:a, timestamp=1288380727188, value=value1

row2 column=cf:b, timestamp=1288380738440, value=value2

row3 column=cf:c, timestamp=1288380747365, value=value3

3
You already have the answer :)...row1 column=cf:a, "timestamp=1288380727188", value=value1Tariq

3 Answers

3
votes

Timestamps are actually mandatory part of HBase columns and their main purpose is column versioning. Here is some more detailed explanation about versions and timestamps. Also "HBase definitive guide" book contains detailed PUT operation description which discovers almost everything you can do with timestamps (TS).

The hints here are:

  • If you don't specify TS in PUT, server adds it automatically.
  • You can specify any TS if you specify it manually so you are actually not limited with 'recommended' usage of this field and there is lot of alternatives.
  • Additional options for timestamps (TS) are discovered by 'keep deleted records' table options, minimum number of versions to keep and data 'time to live' (TTL) support.

So yes, you cannot get rid of these timestamps / versions but there is lot of options how to use them.

1
votes

Yes, everytime you make a PUT on a table you set the timestamp. By default this is the currentTimeInMillis but you can set your own timestamp as well.

The timestamp allows for versioning of the cells. A scan will return the latest version, but you can specify the maximum versioning using Scan.setMaxVersions() or if you want a specific timestamp you can use Scan.setTimeRange() or Scan.setTimeStamp()

0
votes

Yes it appear. You can see in your example

row1 column=cf:a, timestamp=1288380727188, value=value1