This request throw a statement timeout with postgresql.
DELETE FROM my_table where my_table.id IN (
SELECT DISTINCT b.id
FROM my_table a
LEFT JOIN my_table b
on b.rowA = a.rowA and b.rowB = true
WHERE a.rowB = false
)
For some reasons, I can't augment my timeout on postgresql. So, I need to improve my request. How to improve it ? Maybe by not using IN? How to do that?
Thanks per advance for your help.
EDIT with more informations :
I'm in a JAVA batch and the error message I have is the following :
Caused by: org.postgresql.util.PSQLException: ERROR: canceling statement due to statement timeout at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:308) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)