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: performance metrics queries #625

Merged
merged 2 commits into from
Nov 15, 2021
Merged

Conversation

vasco-santos
Copy link
Contributor

@vasco-santos vasco-santos commented Nov 15, 2021

Improves metrics related queries to get the API endpoint working:

  • supabase count was not properly doing the count, but getting all the rows instead, which was too slow.
  • added an unique index to cid including dag_size to speed up pin_dag_size_total rpc function.

All thanks to @ribasushi

New function already created into production DB

Copy link

@ribasushi ribasushi left a comment

Choose a reason for hiding this comment

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

@vasco-santos perhaps the problem was that the '*' was supposed to be 'count(*)' who knows...

@vasco-santos
Copy link
Contributor Author

@ribasushi per the docs no https://supabase.io/docs/reference/javascript/select#querying-with-count-option , but yeah, let's just use the SQL function

@vasco-santos vasco-santos merged commit 85efba5 into main Nov 15, 2021
@vasco-santos vasco-santos deleted the fix/performance-metrics-queries branch November 15, 2021 17:27
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.

2 participants