An epoch is associated with each COMMIT - the current_epoch at the time of the COMMIT is the epoch for that load. Vertica supports historical queries, though it's not a common use case for most customers. You can only query epochs that are after the current AHM, which is kept aggressively current by default. Deleted data prior to the AHM (Ancient History Mark) is eligible for being purged when a mergeout or explicit purge happens. After it's purged, delete vectors no longer need to be maintained. The Last Good Epoch is the epoch at which all data has been written from WOS to ROS. Any data after the LGE will be lost if the cluster shuts down abnormally from something like a power loss or a set of exceptions across multiple nodes. Refresh Epoch - don't worry about it, it doesn't get referenced in practice.
dbadmin=> select current_epoch from system;
current_epoch
---------------
44
(1 row)
dbadmin=> insert into epochs values(1); commit;
OUTPUT
--------
1
(1 row)
COMMIT
dbadmin=> select current_epoch from system;
current_epoch
---------------
45
(1 row)
dbadmin=> insert into epochs values(2); commit;
OUTPUT
--------
1
(1 row)
COMMIT
dbadmin=> select current_epoch from system;
current_epoch
---------------
46
(1 row)
dbadmin=> select * from epochs;
i
---
1
2
(2 rows)
dbadmin=> at epoch 45 select * from epochs;
i
---
1
2
(2 rows)
dbadmin=> at epoch 44 select * from epochs;
i
---
1
(1 row)
dbadmin=> select make_ahm_now();
make_ahm_now
-----------------------------
AHM set (New AHM Epoch: 46)
(1 row)
dbadmin=> at epoch 45 select * from epochs;
ERROR 2318: Can't run historical queries at epochs prior to the Ancient History Mark
dbadmin=> select current_epoch from system;
current_epoch
---------------
44
(1 row)
dbadmin=> insert into epochs values(1); commit;
OUTPUT
--------
1
(1 row)
COMMIT
dbadmin=> select current_epoch from system;
current_epoch
---------------
45
(1 row)
dbadmin=> insert into epochs values(2); commit;
OUTPUT
--------
1
(1 row)
COMMIT
dbadmin=> select current_epoch from system;
current_epoch
---------------
46
(1 row)
dbadmin=> select * from epochs;
i
---
1
2
(2 rows)
dbadmin=> at epoch 45 select * from epochs;
i
---
1
2
(2 rows)
dbadmin=> at epoch 44 select * from epochs;
i
---
1
(1 row)
dbadmin=> select make_ahm_now();
make_ahm_now
-----------------------------
AHM set (New AHM Epoch: 46)
(1 row)
dbadmin=> at epoch 45 select * from epochs;
ERROR 2318: Can't run historical queries at epochs prior to the Ancient History Mark
Sharon Cutter
Independent Consultant for Vertica
Independent Consultant for Vertica
No comments:
Post a Comment