N
Neon5mo ago
sensitive-blue

Authenticated role taking way too long to query (20+ sec) compared to db owner (8.8ms)

I am running the same exact query in different roles, and I'm puzzled by mind boggling difference in response time. Am I missing something or is there any current issue affecting neon currently?
No description
9 Replies
sensitive-blue
sensitive-blueOP5mo ago
NeonDbError: Server error (HTTP status 500): {"message":"could not establish h2 connection","code":"","detail":null,"hint":null,"position":null,"internalPosition":null,"internalQuery":null,"severity":"","where":null,"table":null,"column":null,"schema":null,"dataType":null,"constraint":null,"file":null,"line":null,"routine":null}
NeonDbError: Server error (HTTP status 500): {"message":"could not establish h2 connection","code":"","detail":null,"hint":null,"position":null,"internalPosition":null,"internalQuery":null,"severity":"","where":null,"table":null,"column":null,"schema":null,"dataType":null,"constraint":null,"file":null,"line":null,"routine":null}
I also get this error at times only with the authenticated url. it is fine with the neondb owner.
dependent-tan
dependent-tan5mo ago
hey, regarding your first question related to difference in response times: 1. how big is your table? 2. what is your RLS policy? in general: RLS causing performance issues is a common thing you can search for performance optimisations (e.g. rls policy performance). usually it's lack of where statement or lack of index on the column that's used in RLS policy alternatively - for the sake of initial debugging - you could also try to disable the RLS policy and see if the performance improved (just to be sure if this is indeed caused by RLS) regarding h2 error - could you please provide us more details? for now -- what's your project_id? could you please send it as PM? also is this error persistent or rather random?
sensitive-blue
sensitive-blueOP5mo ago
it does happen randomly at some queries. sent
dependent-tan
dependent-tan5mo ago
thanks - I'll get back to you
dependent-tan
dependent-tan5mo ago
it seems that we have an open bug ticket for that https://github.com/neondatabase/neon/issues/11360
GitHub
[proxy] improve reliability of internal connection pool · Issue #1...
There's a rare race condition where the connection to postgres/local_proxy has closed, but our connection is_closed() check returns false. We don't handle that case gracefully and end up er...
dependent-tan
dependent-tan5mo ago
regarding your potential RLS perf issues - were you able to check if they are gone if you temporarily disable RLS?
sensitive-blue
sensitive-blueOP5mo ago
I will check it today and let you know. is there any work arounds for the moment to not have this issue?
dependent-tan
dependent-tan5mo ago
I'm checking with the respective team
sensitive-blue
sensitive-blueOP5mo ago
thanks!

Did you find this page helpful?