-
Notifications
You must be signed in to change notification settings - Fork 115
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 Performance of Contracts REST API Endpoints with High Entity Counts #10069
base: main
Are you sure you want to change the base?
Conversation
…rewritten getContract Sql query to leverage it. Signed-off-by: Harsh Sawarkar <[email protected]>
@@ -0,0 +1,3 @@ | |||
DROP INDEX IF EXISTS entity__id_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the version should be V1.103.0
and for v2 schema, need to add the same migration with version V2.8.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
...-mirror-importer/src/main/resources/db/migration/v1/V1.101.0__drop_entity__id_type_index.sql
Outdated
Show resolved
Hide resolved
@@ -234,13 +234,21 @@ const getContractByIdOrAddressContractEntityQuery = ({timestampConditions, times | |||
*/ | |||
const getContractsQuery = (whereQuery, limitQuery, order) => { | |||
return [ | |||
`select ${contractSelectFields}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this changed to a more complicated, two CTEs + one main query SQL query? If it's not driven by perf analysis, please revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the CTE to first fetch the relevant contract IDs, which reduces the number of data rows the left join needs to process. However, since I haven't conducted a performance analysis to validate the change, I will revert it for now.
The changes need to be vetted by running perf tests with large amount of data from production environment, we'll try to run such perf tests as early as we can. |
…01.0__drop_entity__id_type_index.sql Co-authored-by: Xin Li <[email protected]> Signed-off-by: Harsh Vinod Sawarkar <[email protected]>
Sure, let me know if there's anything I can do to help. |
…into chore-Some-contracts-REST-API-endpoints-show-large-slowdown-with-high-number-of-entities
…_id and rewritten getContract Sql query to leverage it." This reverts commit 6c4e34b.
…rewritten getContract Sql query to leverage it.
…oof (hashgraph#10105) Bumps [glob](https://github.com/isaacs/node-glob) from 11.0.0 to 11.0.1. - [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md) - [Commits](isaacs/node-glob@v11.0.0...v11.0.1) --- updated-dependencies: - dependency-name: glob dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Harsh Sawarkar <[email protected]>
Signed-off-by: Harsh Sawarkar <[email protected]>
Description:
The entity__id_type index is replaced with entity_type_id, and the getContract SQL query is rewritten to utilize the new index structure.
Related issue(s):
Fixes #9967
Notes for reviewer:
Check for the SQL query updated at contractController.js leveraging common table expression.
Checklist