Run Vacuum Through JDBC

Started by Yan Cheng Cheokalmost 16 years ago4 messagesgeneral
Jump to latest
#1Yan Cheng Cheok
yccheok@yahoo.com

I was wondering, how can I check whether Vacuum operation had been executed without problem?

I use the following Java code to execute Vacuum operation

final Statement st2 = connection.createStatement();
st2.executeUpdate("VACUUM FULL ANALYZE VERBOSE");
st2.close();

Nothing print out at console.

I check at server status through pgadmin, also get no hint whether Vacuum operation had been executed.

Thanks and Regards
Yan Cheng CHEOK

#2Craig Ringer
craig@2ndquadrant.com
In reply to: Yan Cheng Cheok (#1)
Re: Run Vacuum Through JDBC

On 11/05/10 13:38, Yan Cheng CHEOK wrote:

I was wondering, how can I check whether Vacuum operation had been executed without problem?

I use the following Java code to execute Vacuum operation

final Statement st2 = connection.createStatement();
st2.executeUpdate("VACUUM FULL ANALYZE VERBOSE");
st2.close();

Nothing print out at console.

I check at server status through pgadmin, also get no hint whether Vacuum operation had been executed.

That looks like Java / JDBC code.

If so - if executing the statement doesn't throw SQLException, then it
worked. Same as all other SQL.

--
Craig Ringer

Tech-related writing: http://soapyfrogs.blogspot.com/

#3Kris Jurka
books@ejurka.com
In reply to: Yan Cheng Cheok (#1)
Re: Run Vacuum Through JDBC

On Mon, 10 May 2010, Yan Cheng CHEOK wrote:

I was wondering, how can I check whether Vacuum operation had been
executed without problem?

final Statement st2 = connection.createStatement();
st2.executeUpdate("VACUUM FULL ANALYZE VERBOSE");
st2.close();

Nothing print out at console.

The results of the vacuum are available in Statement.getWarnings().

Kris Jurka

#4Scott Marlowe
scott.marlowe@gmail.com
In reply to: Yan Cheng Cheok (#1)
Re: Run Vacuum Through JDBC

On Mon, May 10, 2010 at 11:38 PM, Yan Cheng CHEOK <yccheok@yahoo.com> wrote:

I was wondering, how can I check whether Vacuum operation had been executed without problem?

I use the following Java code to execute Vacuum operation

final Statement st2 = connection.createStatement();
st2.executeUpdate("VACUUM FULL ANALYZE VERBOSE");
st2.close();

On a side note, unless you have extenuating circumstances, vacuum is
preferred over vacuum full. If you must run vacuum full, pay
attention to possible index bloating.