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

ActiveStake Pool Hash Improvement #399

Closed
CyberCyclone opened this issue Jan 12, 2021 · 1 comment · Fixed by #409
Closed

ActiveStake Pool Hash Improvement #399

CyberCyclone opened this issue Jan 12, 2021 · 1 comment · Fixed by #409

Comments

@CyberCyclone
Copy link

CyberCyclone commented Jan 12, 2021

Based on the example here (which I've been using regularly): https://github.com/input-output-hk/cardano-graphql/blob/f180c9a5ea785856d85ef00d40b9d199ac0f256a/packages/api-cardano-db-hasura/src/example_queries/active_stake/activeStakeForAddress.graphql

Based on this query:

{
    delegators: activeStake(
        where: {
            _and: [
                {epochNo: {_eq: 241}}, 
                {registeredWith: {hash: {_eq: "9417e18efcc4c258df21c89942009a498a751a0a63f8d72714cf75b2"}}}
            ]
        }
        limit:100
        offset:100 
    ) {
        amount
        address
        epochNo
    }
}

I've noticed that on pools that have a large amount of delegators (over 5000 for this pool 9417e18efcc4c258df21c89942009a498a751a0a63f8d72714cf75b2), it will most likely timeout. Even using a limit of 10 can take a few seconds to return.

From what I can tell in Hasura, am I correct in that pool_hash is part of the root row and therefore doesn't have to do a further table lookup, while using the query above has to query the Stake Pool table to do the match?

If pool_hash is in fact part of the top level, can we please have that exposed in GraphQL? Based on my tests querying on pool_hash returns almost instantly, so this should be a major improvement.

@rhyslbw
Copy link
Contributor

rhyslbw commented Jan 13, 2021

Thanks for raising this @CyberCyclone . From memory that was a recent change upstream I've not taken advantage of, but can do so to address the performance issue. I can get it done for the 3.2.0 release

rhyslbw added a commit that referenced this issue Jan 27, 2021
- StakePool.activeStake, StakePool.delegators
- adds pool hash and pool ID to for increased search performance

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

Successfully merging a pull request may close this issue.

2 participants