# DAML on DB Performance

**URL:** <https://forum.canton.network/t/daml-on-db-performance/596>\
**Category:** App Development\
**Tags:** daml-sdk\
**Created:** [June 4, 2020, 9:18am UTC](https://forum.canton.network/t/daml-on-db-performance/596 "2020-06-04T09:18:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jean\_Safar](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/jean_safar/32/186_2.png) [@Jean\_Safar](https://forum.canton.network/u/Jean_Safar)\
**Post date:** [June 4, 2020, 9:18am UTC](https://forum.canton.network/t/daml-on-db-performance/596/1 "2020-06-04T09:18:35Z")

</div>

Hi,

Are there any performance tests that can be published for DAML on DBs such as Postgres and what is the part of daml itself vs that of Postgres? Is the integration code for postgres available? I can’t locate it.

best regards

---

<div class="post-metadata">

**Author:** ![Gary\_Verhaegen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/gary_verhaegen/32/81_2.png) [@Gary\_Verhaegen](https://forum.canton.network/u/Gary_Verhaegen)\
**Post date:** [June 4, 2020, 9:55am UTC](https://forum.canton.network/t/daml-on-db-performance/596/2 "2020-06-04T09:55:11Z")

</div>

I’m not on that team and not familiar with the code, so take this with a grain of salt, but it seems like [this folder](https://github.com/digital-asset/daml/tree/master/ledger/ledger-on-sql) might be a good starting point.

---

<div class="post-metadata">

**Author:** ![stefanobaghino-da](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/stefanobaghino-da/32/7057_2.png) [@stefanobaghino-da](https://forum.canton.network/u/stefanobaghino-da)\
**Post date:** [June 4, 2020, 9:58am UTC](https://forum.canton.network/t/daml-on-db-performance/596/3 "2020-06-04T09:58:50Z")

</div>

We are currently heavily testing the performance for `sandbox-classic` (which uses a single schema), `sandbox` (which uses the same architecture as other DAML integrations, with a schema acting as the ledger and the other indexing information so that the Ledger API can access it quickly) and other integrations (where we only use PostgreSQL for indexing). Unfortunately these tests mostly rely on proprietary workflows for customers and I don’t think they can be made public as they are.

The code you want to have a look at to understand how our integration with PostgreSQL works lives mainly in two locations:

- for `sandbox` you can refer to [`//ledger/ledger-on-sql`](https://github.com/digital-asset/daml/tree/master/ledger/ledger-on-sql) (which in turn is built on [`//ledger/participant-state/kvutils`](https://github.com/digital-asset/daml/tree/master/ledger/participant-state/kvutils), a library to build DAML integrations on top of simple key-value stores)
- for `sandbox-classic` and the indexing part, the code lives under [`//ledger/sandbox/`](https://github.com/digital-asset/daml/tree/master/ledger/sandbox), with the data access layer living mostly in the `com.daml.platform.store` package

---

<div class="post-metadata">

**Author:** ![SamirTalwar](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/samirtalwar/32/374_2.png) [@SamirTalwar](https://forum.canton.network/u/SamirTalwar)\
**Post date:** [June 4, 2020, 10:01am UTC](https://forum.canton.network/t/daml-on-db-performance/596/4 "2020-06-04T10:01:27Z")

</div>

@Gary_Verhaegen is right; that’s the implementation of the _ledger_ side of things when using PostgreSQL as a ledger backend.

We also store an _index_, typically also in PostgreSQL. When running Sandbox with a PostgreSQL backend, we use the same database for both the ledger and the index. However, even with more sophisticated ledgers such as Fabric, the index will be stored in PostgreSQL.

As for your question about performance tests, the short answer is that we only have barebones performance testing capability available right now. We do hammer these components internally, but as @stefanobaghino-da said, the code is proprietary. We hope to be able to open-source more considerable performance tests at some point as a result of working with these real-world workflows.
