nuts-foundation / nuts-foundation/nuts-node

SQL: Investigate number of queries being performed

Open
#3,790 3 comments 0 reactions 1 assignee View on GitHub

@reinkrul is already working on this.

Since May 6, 2025.

Dominant language
Go
Stars
28
Forks
23
Avg merge
1d 10h
Merged PRs (30d)
76

Description

While working on Prometheus metrics, I discovered that creating a subject (which creates 2 DIDs, did:web and did:nuts) caused 37 SQL queries to be executed. This sounds like too many for me.

Creating a subject

It seems that queries are retried multiple times, maybe due to the way we use GORM?

sql-query-log.txt

E.g.:

INSERT INTO `did_verification_method` (`id`,`key_types`,`weight`,`data`) VALUES ("did:web:localhost%3A8080:iam:45d8be72-0272-4120-83a8-bb097152d315#96ceae8f-074e-42a7-b834-3d7839b6fa74",15,0,"{""id"":""did:web:localhost%3A8080:iam:45d8be72-0272-4120-83a8-bb097152d315#96ceae8f-074e-42a7-b834-3d7839b6fa74"",""type"":""JsonWebKey2020"",""controller"":""did:web:localhost%3A8080:iam:45d8be72-0272-4120-83a8-bb097152d315"",""publicKeyJwk"":{""crv"":""P-256"",""kty"":""EC"",""x"":""e1dbsc52D0I8MXEfLXO-iqK8_g5poKOmcVH9qEOPA9U"",""y"":""TjQZaIPypyR43MDRDIY022oZRsQ6NAdmKyD9N_Q2GQ8""}}") ON CONFLICT DO NOTHING

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.