Is it possible to estimate growth of the query store as the ledger itself grows?
The query store of the JSON API only stores active contracts and it only stores contracts for templates and parties that have been used in queries. So the size of the query store is roughly the size of the ACS for the templates and parties that have been used in queries.
Thanks for that! Given that, when/how is data in the query store expired/removed?
Data is only updated as a result of a query. So when you make the next query involving the same template and parties, contracts that have been archived in the meantime will get removed.
So, would this be an accurate description of how the query store works:
- The json-api sends the query to the ledger
- The ledger responds with absolute contract Ids that match the query params
- The query store provides data for Ids it contains, removes any not listed
- The json-api requests the contract data for the Ids the query store does not contain
- The query store is updated with new contracts, full list of contract data sent back to user as query response
Close, there are two cases to consider:
The first query where nothing is in the database. In this case, we fetch the ACS from the ledger, we store it in the database and we record the offset of that ACS.
On following queries, we then fetch the offset from the database, query the transaction stream between this offset and current ledger end and use that to add or remove contracts based on