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

fix: Remove proposal check in votes query #950

Merged
merged 2 commits into from
Oct 29, 2024
Merged

Conversation

ChaituVR
Copy link
Member

@ChaituVR ChaituVR commented Oct 24, 2024

Fixes #760

  • We don't have votes with null proposal
  • Removes check for proposal in votes query

How to test

  • Use this query
query ($spaceId: String!, $where: VoteWhere!, $orderDirection: OrderDirection!) {
  votes(where: $where, orderDirection: $orderDirection) {
    created
    voter
  }
  space(id: $spaceId) {
    admins
    members
    moderators
  }
}

Variables

{
  "spaceId": "arbitrumfoundation.eth",
  "where": {
    "space": "arbitrumfoundation.eth",
    "created_gt": 0
  },
  "orderDirection": "DE"
}
  • It should be super slow before fix and relatively fast after fix

@bonustrack
Copy link
Member

The id sorting is here because we've noticed that it can create duplicates and remove votes in pagination is there are multiple votes with the same timestamp

@wa0x6e
Copy link
Contributor

wa0x6e commented Oct 28, 2024

removing the JOIN... is not enough to make the query fast ?

@ChaituVR
Copy link
Member Author

removing the JOIN... is not enough to make the query fast ?

Yep, for example try running

SELECT v.* FROM votes v
    WHERE 1 = 1 AND v.space = 'arbitrumfoundation.eth'
    ORDER BY v.created DESC, v.id ASC LIMIT 0, 1

vs

SELECT v.* FROM votes v
    WHERE 1 = 1 AND v.space = 'arbitrumfoundation.eth'
    ORDER BY v.created DESC LIMIT 0, 1

@ChaituVR
Copy link
Member Author

ChaituVR commented Oct 29, 2024

But anyway i will do seperate PR for v.id, lets merge this first.

@ChaituVR ChaituVR changed the title fix: Remove proposal check in votes query and remove v.id order fix: Remove proposal check in votes query Oct 29, 2024
Copy link
Contributor

@wa0x6e wa0x6e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utAck

@ChaituVR ChaituVR merged commit e2878fd into master Oct 29, 2024
2 checks passed
@ChaituVR ChaituVR deleted the fix-remove-proposal-check branch October 29, 2024 10:38
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 this pull request may close these issues.

bug: votes query return null value
3 participants