I'm running queries on a Redshift cluster using DataGrip that take upwards of 10 hours to run and unfortunately these often fail. Alas, DataGrip doesn't maintain a connection to the database long enough for me to get to see the error message with which the queries fail.
Is there a way of retrieving these error messages later, e.g. using internal Redshift tables? Alternatively, is there are a way to make DataGrip maintain the connection for long enough?
Yes, you Can!
Query stl_connection_log
table to find out pid
by looking at the recordtime
column when your connection was initiated and also dbname
, username
and duration
column helps to narrow down.
select * from stl_connection_log order by recordtime desc limit 100
If you can find the pid
, you can query stl_query
table to find out if are looking at right query.
select * from stl_query where pid='XXXX' limit 100
Then, check the stl_error
table for your pid
. This will tell you the error you are looking for.
select * from stl_error where pid='XXXX' limit 100
If I’ve made a bad assumption please comment and I’ll refocus my answer.