Mats Julian Olsen <mats(at)duneanalytics(dot)com> writes:
> On 25.11.2020 17:58, Tom Lane wrote:
>> ... Have you tried looking into pg_locks on the
>> remote server while this query is running?
> Thanks Tom, I'll try to spin up a regular Postgres instance on both rds
> and ec2 and see if that helps. As for the locks, I can not see any
> blocked activity on the remote server while the query runs.
Another place to check is pg_stat_activity, specifically wait_event_type
and wait_event.
regards, tom lane