-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add all_ecocredit_txes function #34
Conversation
While I was testing locally, it seemed like no matter how I wrote a test query, the index was not being used. So after writing the query properly and disabling seqscan (using select data -> 'tx_response' -> 'txhash' as txhash, data -> 'tx_response' -> 'code' as code, data -> 'tx_response' -> 'tx' -> '@type' as type from tx where data ->'tx_response'->'code' @> '0' And here's a screenshot showing the explain/analyze results for the query (which shows the index being used): |
TL;DR due to a limitation in the connection filter plugin, i think we need to write a custom function to expose as a graphql query. While setting this up and testing the integration with regen-server, I think I've found that using the connection filter plugin will not work for us in this case.
{
allTxes(filter: {data: {contains: {tx_response: {code: 0}}}}) {
nodes {
hash
}
totalCount
}
}
This can be reproduced with this minimal:
select data -> 'tx_response' -> 'txhash' as txhash, data -> 'tx_response' -> 'code' as code, data -> 'tx_response' -> 'tx' -> '@type' as type from tx where data @> '{"tx_response": {"code": 0}}';
select data -> 'tx_response' -> 'txhash' as txhash, data -> 'tx_response' -> 'code' as code, data -> 'tx_response' -> 'tx' -> '@type' as type from tx where data ->'tx_response'->'code' @> '0' I think the best path forward is to just a custom query, and since there's probably enough details here, open an issue in the connection filter plugin and see if it's a problem they would like to solve. |
e782de2
to
fee80d2
Compare
fee80d2
to
1567827
Compare
With the latest code and new Next step will be to deploy these changes to the staging indexer, and test it as a graphql query on the regen-server staging environment. If there are performance issues with this approach, we might be able to get better performance by switching the newly added |
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.
utACK. This looks good to me. As discussed, we may need to account for different chains if and when we move forward with #33. I made a note in the issue. And thanks for the walkthrough on the architecture call today!
Just noting that I successfully tested this in the regen-server staging environment. |
Closes: #32