Report this

What is the reason for this report?

Postgres query stop after 10 minutes

Posted on January 21, 2021

I have Managed Postgres instance, and a query that stops after 10 minutes.

The query is REFRESH MATERIALIZED VIEW xyz.

I kind looks like there is a limit for a query to run for 10 minutes. Can anyone tell what particular limit might come into play here?

The instance is 1 GB RAM / 1vCPU / 10 GB Disk / Primary only / FRA1.

The application is running spring boot and the Hikari connection pool.

First error message is 'SQLSTATE(57P01), ErrorCode(0)'
Second: FATAL: terminating connection due to administrator command; nested exception is org.postgresql.util.PSQLException: FATAL: terminating connection due to administrator command


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.

Queries in Managed Databases are allowed to run indefinitely as long as they’re not consuming resources to the point where it harms the server or other databases.

SQLSTATE(57P01) usually means that an administrator (or automatic system) had to kill your query, either because it was taking too long or using too many resources. In your case with a 1GB RAM / 1vCPU Postgres instance, running a resource-intensive query like REFRESH MATERIALIZED VIEW might be too taxing on your server, especially if there are other operations happening concurrently.

You could consider upgrading your server, optimizing your query, or performing the operation in chunks if it’s feasible to do so. For more insights, you may refer to # How to Monitor PostgreSQL Database Performance.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.