class DBQueries {

    public static void createIndexOnTable(final String tableName, final Connection connection){
        final String sqlCreateIndex = String.format(
                "CREATE INDEX IF NOT EXISTS cqidx_%s_value ON cqtbl_%s (value);",
                tableName,
                tableName);
        Statement statement = null;

        try {
            statement = connection.createStatement();
            statement.executeUpdate(sqlCreateIndex);
        }catch (SQLException e){
            throw new IllegalStateException("Unable to add index on table: " + tableName, e);
        }finally {
            DBUtils.closeQuietly(statement);
        }
    }

}