(This blog first appeared on SCN website http://scn.sap.com/community/developer-center/hana/blog/2013/02/12/when-i-travelled-through-time-using-sap-hana)
When I traveled through time using SAP HANA!!
Yes! SAP HANA can make time travel happen. Literally!!
During our exploration of SAP HANA, we found that SAP has made time travel possible via SAP HANA. This is because SAP HANA runs on SAP In-Memory Computing Engine, which provides support for History Tables. These tables, known as 'HISTORY COLUMN' tables, have session type as ‘HISTORY’ and they support time travel queries.
‘Time travel’ queries are the queries against historical states of the database. In a way, it allows to fetch the historical values (say, some inventory statistics for date 1 Jan 2011 in the table CURRENT_INVENTORY), without actually having to load the data from backups taken on 1 Jan 2011.
This concept (and specially this emotional touch of TRAVELLING through time) caught us, and we ended up exploring this concept in the following manner. All the steps and information sources were duly documented, so that other interested enthusiasts can also enjoy this experience in their own labs.
Following is the basic procedure for using Time Travel Queries in SAP HANA:
- Create History Tables
- Turn Auto Commit Off
- Keep track of commit IDs (or connection IDs) dealing with the History tables
- Execute Time Travel Queries on the History Tables
For more details about these steps, see the blog http://scn.sap.com/community/developer-center/hana/blog/2013/02/12/when-i-travelled-through-time-using-sap-hana
For demonstration purposes, implementing time travel seems to be bit easy task. But in real life scenarios, implementation would be much more complex, and would demand entire new set of plans and designs for fully utilizing this new concept.
We would love to hear more about real life scenarios where this concept could make a real difference. So do provide your feedback and suggestions about this topic.
· 0204 - Modeling - Time Travel Example.pdf, available as a zipped content at http://www.experiencesaphana.com/servlet/JiveServlet/downloadBody/2171-102-4-4396/SAPHANA_TechnicalDocumentsV2.zip