daml/ledger-service/db-backend
Stephen Compall 8ec103ea0b
speed up sync fetch by contract ID/key with postgres and faster in-memory filtering (#7993)
* mark some of dbbackend private

* fetchBy* functions for Queries

* shift in-memory filtering into the transaction stream

- removes irrelevant contracts from memory as soon as possible for fetch by
  contract ID and key in-memory

* push the three synchronous search varieties into new signatures

* replace the core findByContract* functions with DB-delegating versions

* remove the GADT equality and most of the explicit traversals

- compiles again, finally

* factoring

* ContractDao wrappers for fetchById and fetchByKey

* DB version of findByContractId

* DB version of findByContractKey

* Search is the split of ContractsService

* fix SQL for keys

* trade the typeclass for a sum type

- sealed instead of final because of the path dependency on ContractsService
  instance

* number conversion is done already in ContractDao

* make fetch-by-key tests depend on proper number conversion for SQL

* add changelog

CHANGELOG_BEGIN
- [JSON API] ``/v1/fetch`` now uses the Postgres database, if configured, to
  look up contracts by ID or key, except when querying a contract by ID without
  its corresponding template ID.  The fallback in-memory version of
  ``/v1/fetch`` is also now significantly more efficient for large datasets,
  though still linear.

  You may optionally re-create JSON API's database to take full advantage.
  See `issue #7993 <https://github.com/digital-asset/daml/pull/7993>`__.
CHANGELOG_END

* use search.search for search

- suggested by @cocreature; thanks

* add an index for contract key lookups

- suggested by @cocreature; thanks
2020-11-30 13:51:29 -05:00
..
src/main/scala/com/digitalasset/http/dbbackend speed up sync fetch by contract ID/key with postgres and faster in-memory filtering (#7993) 2020-11-30 13:51:29 -05:00
BUILD.bazel add silent_annotations option to da_scala bazel functions (#7668) 2020-10-13 15:44:16 +00:00