Dúvidas ao fechar conexão

Boa tarde pessoal, se possível gostaria de uma grande ajuda de vocês.

Tenho o método abaixo que faz algumas consultas no banco de dados, porém está muito lento o processamento do mesmo.
O mesmo procedimento em php executa umas 10x mais rápido, creio que estou errando em alguma coisa…
se puderem me ajudar ficarei muito grato.

obs: a base de dados é grandinha, tem uns 800 mil registros.

public String removeRegistrosDuplicados() {
String dataInicial = ut.getStringParametro(“form:dataInicial”);
String dataFinal = ut.getStringParametro(“form:dataFinal”);
ResultSet rs = null;
ResultSet rr = null;
ResultSet rt = null;
RegNegocio rn = new RegNegocio();
int totalRemovidos = 0;
try {
// Seleciona todos os colaboradores
String queryColaboradores = “select codigoColaborador from pw_colaborador where dataDemissao is Null”;
rs = rn.getQuery(queryColaboradores);
// Loop dos colaboradores
while (rs.next()) {
String queryRegistros = “select dataRegistro from pw_registro where codigoColaboradorFK=” + rs.getInt(“codigoColaborador”) + " and dataRegistro between ‘" + dataInicial + "’ and ‘" + dataFinal + "’ group by dataRegistro";
// Loop das datas
try {
rr = rn.getQuery(queryRegistros);
while (rr.next()) {
try {
String selecionaRegistros = “SELECT count(hora) as total, hora FROM pw_registro WHERE dataRegistro=’” + rr.getString(“dataRegistro”) + “’ and codigoColaboradorFK=” + rs.getInt(“codigoColaborador”) + " GROUP BY hora HAVING COUNT(*) > 1";
rt = rn.getQuery(selecionaRegistros);
// Remove os registros duplicados.
try {
if (rt.next()) {
if (rt.getInt(“total”) > 1) {
totalRemovidos += rt.getInt(“total”);
rn.exeQuery(“delete FROM pw_registro WHERE dataRegistro=’” + rr.getString(“dataRegistro”) + “’ and codigoColaboradorFK=” + rs.getInt(“codigoColaborador”) + " and hora=’" + rt.getString(“hora”) + "’ limit " + (rt.getInt(“total”) - 1));
}
}
} catch (SQLException se) {
se.printStackTrace();
} finally {
rt.close();
rn.closeCon();
}
} catch (Exception emr) {
ut.logIntellig("Erro ao mover os registros do colaborador: " + rs.getString(“codigoColaborador”) + " - Erro: " + emr);
} finally {
rn.closeCon();
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
rr.close();
rn.closeCon();
}
}
rs.close();
} catch (Exception e) {
ut.logIntellig("Erro na query dos funcionários: " + e);
e.printStackTrace();
} finally {
rn.closeCon();
}
ut.logIntellig("Total removidos: " + totalRemovidos);
return null;
}