Redshift VACUUM cannot run inside a transaction block on SQLWorkbenchJ

Ting Jia picture Ting Jia · Nov 30, 2015 · Viewed 14.2k times · Source

I have got a:

VACUUM cannot run inside a transaction block

error on SQLWorkbenchJ in Redshift, but I already commit all transactions before this.

Answer

a_horse_with_no_name picture a_horse_with_no_name · Nov 30, 2015

You don't need to change the connection profile, you can change the autocommit property inside your SQL script "on-the-fly" with set autocommit

set autocommit on;
vacuum;
set autocommit off;

You can also toggle the current autocommit state through the menu "SQL -> Autocommit"