Creation and modification time

Coming from more traditional database, I have the doubt if it still has sense in XTDB to save creation time and modification time in my records. I should be able to have these informations from history, or is it anyway easier to have them stored in entities?

Hey @Francesco_Lunelli the creation and modification times are implicitly stored, so you generally shouldn’t need to store them explicitly again unless you also need to be able to query and compare those times in a complex way via Datalog (e.g. “find all times modified between $DATE1 and $DATE2”). In 1.23.2 you can use get-start-valid-time / get-end-valid-time predicates, but they are not indexed in a way that makes querying ‘across’ time possible (since a db always needs to be at a fixed point in time). In XTDB 2.x we will make this a lot easier though.

What kind of queries are you hoping to express?

Thanks for you answer. I don’t need complex queries, only to be able to check when an entity has been created or modified, and in case to be able to get the value before the last change.
Thanks again

Cool, good to know!

For this you can use entity-history - and see the example of embedding open-entity-history within a query: