ERROR: canceling statement due to statement timeout
statement_timeout is 0 in both servers.
However, on server1 I am able to run the query. Only on server2 that I get that error.
Why? If it is same DB???
It is not the same DB if it is on two different servers not connected by replication. More to the point statement_timeout is a client connection setting, so is the client you use to connect to server2 the same as the one you use for server1?
Is AWS being 'helpful' and setting a timeout?
Is there anything in the log before the ERROR shown above that indicates something is setting statement_timeout?
the statement_timeout was settled to user level. The user I was using to run the query had 10s statement_timeout. I changed it to 0 and the query worked.
The query is taking 20s to run. I know it need to be improved and I will do it.
I think it was working on server1 but not on server2, because as we are using AWS there is the EBS latency that we didn't have before on slave1.