debugging `canceling statement due to statement timeout` error

I have an RPC that has started returning canceling statement due to statement timeout errors. when I run the exact same function in the SQL editor using EXPLAIN ANALYZE it executes in ~4s. it is a slow query, but I'm curious if there are other suggestions to figure out why it would be timing out? I have not modified statement_timeout (and when I run select setting from pg_settings where name = 'statement_timeout' it appears to be 120s, though I'm not sure if client queries have a different setting).

[editing this because I was mis-reading the memory usage, though initial question remains]
Was this page helpful?