Inspecting the data of the JSON API Query Store

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

In my daml.yaml I have:

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):

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.

2 Likes

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.

2 Likes

We have Github issues for Postgres caching for (2) fetch et al and (1) streaming endpoints, if you would like to subscribe to them.

1 Like

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

1 Like