0

I'm trying to execute vacuumdb command from Java runtime and it is stuck forever(without throwing any error). The same when executed directly in the terminal is working properly. Command I used:

<path>/vacuumdb <dbname> --verbose --analyze 

I have tried this for an empty database as well(size is not the issue), but the result is the same. Anyone faced this before either in Greenplum or Postgres? Any thoughts on the issue will be really helpful.

Thanks!

Jon Roberts
  • 2,068
  • 1
  • 9
  • 11
Aditya
  • 1
  • I suspect this comes down to a Java question, not a database question. – jjanes Jan 30 '20 at 20:00
  • Did you check pg_locks and pg_stat_activity for possible locks? Also, while running vacum, can you see if there is any I/O activity in the system? – Filipe Jan 30 '20 at 20:01
  • What is stuck? Your java process? Or the vacuum? Where is the java process running? On the master host? Or remote? If you kick off the command, and you check the state on the server, what is happening? `ps -ef | grep -i vacuum` vacuumdb is a python utility which runs vacuum -- You should see the corresponding VACUUM command running as well -- and this should be visible in the logging on the master. – Brendan Stephens Jan 30 '20 at 20:46
  • Why are you using the "vacuumdb" command, instead of sending this as a SQL command to the database? – A. Scherbaum Jan 31 '20 at 14:35
  • By stuck, I meant that the vacuumdb command(running on master) was not proceeding further after vacuuming few tables. When I do a grep for vacuum, I can see the vacuum process running but it doesn't finish. When I try to run the command from java runtime, the SharedUpdateExclusive lock is being created(there are no additional connections). At this point, if I run pg_terminate_backend(pid) on this database, then the lock was removed and vacuumdb executes. I don't know how the locks are being created from java as I was only running this bash cmd and not performing any other operations. – Aditya Feb 01 '20 at 16:45

0 Answers0