22

PostgreSQL Version: 9.3

We have online system which gets transnational data (approximately 15000 records per day).

We have table partitioning on date & time and have a PostgreSQL function to load the incoming request into the table.

Sometimes we see the error message

ERROR: 57014: canceling statement due to statement timeout

The client sends the request again after some time if not successful and on second try it gets recorded successfully. It seems this has to be something with table locks but I am not sure.

11
  • 2
    ALTER USER your_user SET statement_timeout=0 and add VACUUM ANALYZE VERBOSE;? Commented Nov 14, 2018 at 7:54
  • Thanks @dwir182. statement_timeout we can change but client expects real-time response within 5-10 seconds which always works but only in few cases it times out. But will try VACUUM ANALYZE Commented Nov 14, 2018 at 8:05
  • 1
    you will need to show us the slow queries if you want to improve them. There is no magic knob that makes everything go faster. Commented Nov 14, 2018 at 8:30
  • 2
    Postgres 9.3 is no longer supported you should plan your upgrade to a supported version as soon as possible. Given the substantial performance improvements that were made in the last 5 years since 9.3 was released that might even solve (some of) your performance problems. Commented Nov 14, 2018 at 8:32
  • @a_horse_with_no_name, Thanks for the comments. Its not slow query. Same query on 2nd retry works faster as expected and completes execution within 2-3 seconds. Only sometimes it is slow which still cant understand why. And yes, we must plan the upgrade very soon Commented Nov 14, 2018 at 8:44

1 Answer 1

7

Set log_lock_waits = on in postgresql.conf and see if you get log entries. That would tell you that a query is hanging for more than one second.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.