# Peer Query Performance

**URL:** <https://forum.datomic.com/t/peer-query-performance/1022>\
**Category:** Peer API\
**Created:** [June 18, 2019, 1:25pm UTC](https://forum.datomic.com/t/peer-query-performance/1022 "2019-06-18T13:25:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saurabh.mittal](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@saurabh.mittal](https://forum.datomic.com/u/saurabh.mittal)\
**Post date:** [June 18, 2019, 1:25pm UTC](https://forum.datomic.com/t/peer-query-performance/1022/1 "2019-06-18T13:25:16Z")

</div>

We are using Datomic to store Time series data. We get the data hourly.  
We have around ~40 billion datoms  
When we query ,we try to load the data for last ~5 days.We have defined indexes for data and we use date range based queries.  
At times , some query take up to ~1 min.Problem is its very inconsistent  
Sadly, We realized Datomic is not optimized for such huge amount of data.

I read this article that give some information about how the data that is stored in Peer cache  
[http://www.dustingetz.com/:datomic-performance-gaare/](http://www.dustingetz.com/:datomic-performance-gaare/)

I had couple of Queries:

1. Is there any way we can identify the levels we need to go to query data.Subsequently , number of trips to storage?
2. Is there any direction where we can work on to optimize it?
3. why there is inconsistency in time?Sometimes it s fine sometime just take too much time?

Any help will be appreciated.  
Thanks

---

<div class="post-metadata">

**Author:** ![eoliphant](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@eoliphant](https://forum.datomic.com/u/eoliphant)\
**Post date:** [June 19, 2019, 12:43am UTC](https://forum.datomic.com/t/peer-query-performance/1022/2 "2019-06-19T00:43:08Z")

</div>

> [@saurabh.mittal](#):
>
> Time series data

“Time series data”, this is called out in various places as one of the things that Datomic is _not_ well suited for. You might want to consider a store that’s more geared to that use case, and potentially say use Datomic for ‘projections’ of that data, etc. depending on your needs

---

<div class="post-metadata">

**Author:** ![dustingetz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/dustingetz/32/56_2.png) [@dustingetz](https://forum.datomic.com/u/dustingetz)\
**Post date:** [June 19, 2019, 1:52am UTC](https://forum.datomic.com/t/peer-query-performance/1022/3 "2019-06-19T01:52:15Z")

</div>

40B datoms doesn’t sound that bad, I believe Nubank and HCA both rollover to a new database every quarter or so when they reach the limit and there is a crossover technique, see this talk for the details: [http://2018.clojure-conj.org/igor-ges/](http://2018.clojure-conj.org/igor-ges/)

---

<div class="post-metadata">

**Author:** ![saurabh.mittal](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@saurabh.mittal](https://forum.datomic.com/u/saurabh.mittal)\
**Post date:** [June 19, 2019, 9:01am UTC](https://forum.datomic.com/t/peer-query-performance/1022/4 "2019-06-19T09:01:56Z")

</div>

Thanks Dustin. The video was helpful.It mentions about sharding and roll over.I had watched Nubank presentation on Infoq , they also mention Sharding.  
Is there any way we can identify how many trips are made to storage to complete a query?  
Thanks

---

<div class="post-metadata">

**Author:** ![aanacarolina](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/aanacarolina/32/632_2.png) [@aanacarolina](https://forum.datomic.com/u/aanacarolina)\
**Post date:** [March 13, 2025, 4:17am UTC](https://forum.datomic.com/t/peer-query-performance/1022/5 "2025-03-13T04:17:56Z")

</div>

Maybe it is not relevant anymore , but for the records now Datomic pro has query stats, that might be helpful in such cases:

> **[Query Stats | Datomic](https://docs.datomic.com/reference/query-stats.html)**
>
> Learn how to analyze Datomic query performance using query stats.
