vacuumsql-workbench-j

Redshift VACUUM cannot run inside a transaction block on SQLWorkbenchJ


I have got a:

VACUUM cannot run inside a transaction block

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


Solution

  • 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"