PG Bug reporting form <noreply@postgresql.org> writes:
> we are using PostgreSQL version 9.6.8 on our production environment which we
> operate ourselves.
You realize, I hope, that you are running a very old minor release
of a branch that's been out of support entirely for more than a year.
You might consider consulting our release note archives
https://www.postgresql.org/docs/release/
to see if your problem matches up with any of the large number of
post-9.6.8 fixes.
> We noticed that the insert/select queries which get stuck and run infinitely
> have specific request_id - starting with 'a6bda' for example
> 'a6bda748-0e31-4da6-8fed-331c6c4a7cdb'.
Smells a little bit like index corruption, perhaps. I'd try reindexing
whatever index(es) exist on that column. But if that doesn't fix it ...
> Do you know what could be the cause for our problems and possibly suggest
> any solution?
Running ancient minor releases is fundamentally unsound database
administration practice. At minimum you should be running the last
9.6.x minor release (9.6.24); but really now would be a good time
to be thinking about upgrading to some still-in-support branch.
If there is an actual Postgres problem here, and it wasn't fixed
by 9.6.24, we aren't ever going to fix it in that branch.
regards, tom lane