I am using psql CLI command line to make a query to Redshift. (question applies to mysql also). The query may take a long time to execute. After sending the command, is it possible to get the Query ID of that query while it is running without waiting until it is finished. Is this possible?
For example, if I need to abort that query hours/days later, I'd like to send a CANCEL/ABORT command to the Redshift backend for that specific query. Note: the same database will be used by others, so I'd like to know the ID of the specific query I executed.
Also, let's say the psql command is running in a shell. Is it possible to programmatically (python) in an app to get the Query ID from that psql CLI process?
psql
is used with PostGreSQL, not MySQL. – Barmar