# Query the state of the database at any time in the past

**URL:** <https://discuss.dgraph.io/t/query-the-state-of-the-database-at-any-time-in-the-past/3757>\
**Category:** Users\
**Created:** [December 13, 2018, 3:49am UTC](https://discuss.dgraph.io/t/query-the-state-of-the-database-at-any-time-in-the-past/3757 "2018-12-13T03:49:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![qiuwei](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/qiuwei/32/1390_2.png) [@qiuwei](https://discuss.dgraph.io/u/qiuwei)\
**Post date:** [December 13, 2018, 3:49am UTC](https://discuss.dgraph.io/t/query-the-state-of-the-database-at-any-time-in-the-past/3757/1 "2018-12-13T03:49:30Z")

</div>

Is it possible for an end user to query the state of the database at any time in the past using the GraphQL±?

---

<div class="post-metadata">

**Author:** ![dmai](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/dmai/32/1254_2.png) [@dmai](https://discuss.dgraph.io/u/dmai)\
**Post date:** [December 13, 2018, 7:42pm UTC](https://discuss.dgraph.io/t/query-the-state-of-the-database-at-any-time-in-the-past/3757/2 "2018-12-13T19:42:07Z")

</div>

A normal query would fetch the latest values from Dgraph. A client could also specify a startTs to fetch the values from an earlier timestamp. Access to earlier timestamps disappears over time to make space for newer values.

---

<div class="post-metadata">

**Author:** ![u007](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/u007/32/1220_2.png) [@u007](https://discuss.dgraph.io/u/u007)\
**Post date:** [December 14, 2018, 1:09am UTC](https://discuss.dgraph.io/t/query-the-state-of-the-database-at-any-time-in-the-past/3757/3 "2018-12-14T01:09:10Z")

</div>

i dont understand, can you define past?  
i thought all records stored are considerred permanent especially datetime field?

---

<div class="post-metadata">

**Author:** ![dmai](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/dmai/32/1254_2.png) [@dmai](https://discuss.dgraph.io/u/dmai)\
**Post date:** [December 14, 2018, 1:24am UTC](https://discuss.dgraph.io/t/query-the-state-of-the-database-at-any-time-in-the-past/3757/4 "2018-12-14T01:24:45Z")

</div>

@qiuwei is querying the previous versions of the database a feature you’d like? This is currently not possible, but we could add a flag that would make it possible to query across all the different versions. Currently Dgraph cleans up stale versions to make space for new ones.

@u007 I’m my previous post I was referring to the MVCC model used in Dgraph. Every transaction creates a new version of the database that can be referred to by its timestamp. I was not referring to how data is stored or any particular predicate types.

---

<div class="post-metadata">

**Author:** ![u007](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/u007/32/1220_2.png) [@u007](https://discuss.dgraph.io/u/u007)\
**Post date:** [December 14, 2018, 7:26am UTC](https://discuss.dgraph.io/t/query-the-state-of-the-database-at-any-time-in-the-past/3757/5 "2018-12-14T07:26:28Z")

</div>

i see :). so its about the old data / some kind of versions of the data

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [January 13, 2019, 7:26am UTC](https://discuss.dgraph.io/t/query-the-state-of-the-database-at-any-time-in-the-past/3757/6 "2019-01-13T07:26:32Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
