# Inspecting the data of the JSON API Query Store

**URL:** <https://forum.canton.network/t/inspecting-the-data-of-the-json-api-query-store/1473>\
**Category:** App Development\
**Tags:** json-api\
**Created:** [October 16, 2020, 2:59am UTC](https://forum.canton.network/t/inspecting-the-data-of-the-json-api-query-store/1473 "2020-10-16T02:59:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leonid\_Rozenberg](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/leonid_rozenberg/32/48_2.png) [@Leonid\_Rozenberg](https://forum.canton.network/u/Leonid_Rozenberg)\
**Post date:** [October 16, 2020, 2:59am UTC](https://forum.canton.network/t/inspecting-the-data-of-the-json-api-query-store/1473/1 "2020-10-16T02:59:28Z")

</div>

Should one be able to see the contract data stored in Postgresql after we setup a query store?

In my `daml.yaml` I have:

```haskell
json-api-options:
  - --query-store-jdbc-config=driver=org.postgresql.Driver,url=jdbc:postgresql://localhost:5432/daml_ui_template,user=daml_json_client,password=notaproductionpassword,createSchema=false

```

Ran it with `true` the first time. I can see the data served to me like normal via the React app. But then in psql (as `daml_json_client`):

```haskell
daml_ui_template-> \dt
                 List of relations
 Schema | Name | Type | Owner
--------+---------------+-------+------------------
 public | contract | table | daml_json_client
 public | ledger_offset | table | daml_json_client
 public | template_id | table | daml_json_client
(3 rows)

daml_ui_template-> SELECT * from contract
daml_ui_template-> SELECT * from ledger_offset
daml_ui_template-> SELECT * from template_id
daml_ui_template->

```

My interest was in measuring the impact of creating an index as @Stephen discussed [here](https://discuss.daml.com/t/database-roles-in-the-json-api-sandbox/539/2).

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [October 16, 2020, 5:21am UTC](https://forum.canton.network/t/inspecting-the-data-of-the-json-api-query-store/1473/2 "2020-10-16T05:21:59Z")

</div>

At the moment, only the synchronous POST query endpoint ends up hitting the database. In particular, the following do not go via the database _yet_:

1. Streaming endpoints.
2. `fetch` and friends.
3. The GET query endpoint that returns contracts for all templates.

With the exception of 3, there is no fundamental reason for this and we have plans to change this. For 3, I’m a bit hesitant to change it since I don’t think you should use this in a production setup and if you do use it, you could end up throwing a lot of data in your database a lot of which you might not care about.

---

<div class="post-metadata">

**Author:** ![Stephen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/stephen/32/102_2.png) [@Stephen](https://forum.canton.network/u/Stephen)\
**Post date:** [October 16, 2020, 4:17pm UTC](https://forum.canton.network/t/inspecting-the-data-of-the-json-api-query-store/1473/3 "2020-10-16T16:17:25Z")

</div>

We have Github issues for Postgres caching for [(2) fetch et al](https://github.com/digital-asset/daml/issues/7711) and [(1) streaming endpoints](https://github.com/digital-asset/daml/issues/6312), if you would like to subscribe to them.

---

<div class="post-metadata">

**Author:** ![Leonid\_Rozenberg](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/leonid_rozenberg/32/48_2.png) [@Leonid\_Rozenberg](https://forum.canton.network/u/Leonid_Rozenberg)\
**Post date:** [October 16, 2020, 4:26pm UTC](https://forum.canton.network/t/inspecting-the-data-of-the-json-api-query-store/1473/4 "2020-10-16T16:26:48Z")

</div>

Thank you guys this is great. I used `useQuery` in the UI (which does `POST`) and the DB was populated.
