Participant Query Store (PQS)

PQS is a component that ingests ledger data into a PostgreSQL to make it available for querying using SQL.

Note

Throughout this document you may see references to PQS and scribe. The distinction between them is:

  • PQS is the name of the component that provides the capability to query a Daml ledger using SQL

  • scribe is the technical name of the executable that implements this capability

Overview

PQS provides scalable read access for a participant by exposing its data via SQL leveraging existing tools and knowledge.

The participant’s primary role is to submit and propagate transactions in the network, which requires interaction to submit commands. PQS works in this domain to monitor transactions on a streaming basis, maintain history and state based on these events, and makes the resultant data available for users to query. It allows independent scaling of the read loads, depending on the capacity required.

PQS enables the following key capabilities:

  • To make the Daml ledger queryable via SQL

  • Allow querying on a point-in-time or latest-available basis

  • Filter the scope by Daml party and contract template

  • Embed an API within the database to allow consumers to easily access the ledger data by:

    • Using familiar Daml identifiers (eg. mypackage:My.Module:MyTemplate) instead of PostgreSQL approximations

    • Using SQL to perform familiar aggregations, transformations and joins

    • Creating custom indexes to optimize queries

    • Facilitating access to both state (contracts) and audit trail (events) perspectives

  • Crash-tolerance so it can be restarted safely

Contribute

Please, visit https://discuss.daml.com/tag/pqs to ask questions and raise attention to use-cases motivating feature requests.

Contents