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 outpid
by looking at therecordtime
column when your connection was initiated and alsodbname
,username
andduration
column helps to narrow down.If you can find the
pid
, you can querystl_query
table to find out if are looking at right query.Then, check the
stl_error
table for yourpid
. This will tell you the error you are looking for.If I’ve made a bad assumption please comment and I’ll refocus my answer.