Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve contract-versions queries #1607

Open
migmartri opened this issue Nov 29, 2024 · 0 comments
Open

improve contract-versions queries #1607

migmartri opened this issue Nov 29, 2024 · 0 comments

Comments

@migmartri
Copy link
Member

query 1

The following query is called quite often during the attestation process or even more taking into account the numbers shown by performance insights.

SELECT DISTINCT "workflow_contract_versions"."id", "workflow_contract_versions"."body", "workflow_contract_versions"."raw_body", "workflow_contract_versions"."raw_body_format", "workflow_contract_versions"."revision", "workflow_contract_versions"."created_at" FROM "workflow_contract_versions" WHERE "workflow_contract_versions" = $1 ORDER BY "workflow_contract_versions"."revision" DESC LIMIT 1

image

This query could be removed if we denormalize the latest-contract-version and add it to the workflow.

Query 2

A related query is

SELECT "workflow_contract_versions"."id", "workflow_contract_versions"."body", "workflow_contract_versions"."raw_body", "workflow_contract_versions"."raw_body_format", "workflow_contract_versions"."revision", "workflow_contract_versions"."created_at" FROM "workflow_contract_versions" WHERE "workflow_contract_versions"."id" IN ($1)

Executed less times, and that potentially could use some performance improvements.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant