Sample Header Ad - 728x90

How to debug this tuple await events in RDS PostgreSQL

0 votes
0 answers
535 views
I have been noticing that sometimes we get a lot of open connections for a long time. Enabling enhanced metrics in RDS PostgreSQL I saw the following: enter image description here It seems this tuple wait event is making a lot of queries wait. I have taken a look and it seems it is from locks. I have run the query they suggest in the [docs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/wait-event.locktuple.html) but it does not return anything, so not sure what is happening. In the Top sql queries you can see the following: enter image description here The queries are something like this (sorry for it being incomplete, RDS does not give me the full query): ~~~sql UPDATE "customers_customer" SET "follow_up_date" = (CASE WHEN ("customers_customer"."id" = 140005033) THEN NULL WHEN ("customers_customer"."id" = 138501530) THEN NULL WHEN ("customers_customer"."id" = 140000447) THEN NULL WHEN ("customers_customer"."id" = 139999963) THEN NULL WHEN ("customers_customer"."id" = 140016560) THEN NULL WHEN ("customers_customer"."id" = 139998510) THEN NULL WHEN ("customers_customer"."id" = 138485030) THEN NULL WHEN ("customers_customer"."id" = 138507549) THEN NULL WHE ~~~ I'm not sure but I think this query comes from a mass update call on the Django ORM to a the customer model on the follow up date field. So how can I debug this problem? Or mitigate it in the future? For now is not killing the database, but queries were starting to pile up and we have had problems with that in the past. If you need more information, please drop a comment below!
Asked by Antonio Gamiz Delgado (111 rep)
May 17, 2023, 03:29 PM
Last activity: May 17, 2023, 04:16 PM