Replies: 1 comment
-
|
You should take a look at the performance improvement tips in this guide https://supabase.com/docs/guides/database/postgres/row-level-security#call-functions-with-select |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following set of views defined on top of the Stripe wrapper:
I have defined a function to query it for the current authenticated user like so:
But it was EXTREMELY slow. When I went into the Stripe logs, I noticed it loads ALL the subscription (which required a lot of API calls due to pagination) rather than look up the subscription by the customer id. But if I hard coded a user id instead of using
auth.uid()::text, it properly looked it up by the ID.I then rewrote it to the following, which worked much faster by performing a Stripe lookup by the ID rather than loading all subscriptions:
Is this expected behavior / side effect of using
auth.uid(), or a bug? This seems similar (but not exactly the same) as this issue: https://github.com/orgs/supabase/discussions/8733Beta Was this translation helpful? Give feedback.
All reactions