private boolean execUpdateProfile(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) {
        try {
            boolean success = true;
            int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt");
            String clientName = (String) queryParam.getVal(clntIdx);

            int t0, t;
            int t0Idx = queryParam.qpIndexOfKeyNoCase("t0");
            if (t0Idx == -1) {
                t0 = 0;
            } else {
                t0 = Integer.parseInt((String) queryParam.getVal(t0Idx));
            }

            if (t0 == 0) {
                PServerResultSet prs = dbAccess.executeQuery("SELECT MIN(" + DBAccess.NUM_DATA_TABLE_FIELD_TIMESTAMP + ") FROM " + DBAccess.NUM_DATA_TABLE + " WHERE " + DBAccess.FIELD_PSCLIENT + "='" + clientName + "'");
                if (prs.getRs().next()) {
                    t0 = prs.getRs().getInt(1);
                }
                prs.close();
            }
            //WebServer.win.log.echo( "t0 = " + t0 );

            int tIdx = queryParam.qpIndexOfKeyNoCase("t");
            if (tIdx == -1) {
                t = Integer.MAX_VALUE;
            } else {
                t = Integer.parseInt((String) queryParam.getVal(tIdx));
            }
            //WebServer.win.log.echo( "t = " + t );

            Statement stmt = dbAccess.getConnection().createStatement();
            String sql = "DELETE FROM " + DBAccess.UPROFILE_TABLE + " WHERE " + DBAccess.FIELD_PSCLIENT + "='" + clientName + "'";
            stmt.execute(sql);

            String subSql = "SELECT " + DBAccess.NUM_DATA_TABLE_FIELD_USER + "," + DBAccess.NUM_DATA_TABLE_FIELD_FEATURE + "," + DBAccess.NUM_DATA_TABLE_FIELD_VALUE + "," + DBAccess.NUM_DATA_TABLE_FIELD_VALUE + ",'" + clientName + "' " + " FROM " + DBAccess.NUM_DATA_TABLE
                    + " WHERE " + DBAccess.NUM_DATA_TABLE_FIELD_TIMESTAMP + ">=" + t0 + " AND " + DBAccess.NUM_DATA_TABLE_FIELD_TIMESTAMP + "<=" + t + " AND " + DBAccess.FIELD_PSCLIENT + "='" + clientName + "'";

            sql = "INSERT INTO " + DBAccess.UPROFILE_TABLE + "(" + DBAccess.UPROFILE_TABLE_FIELD_USER + "," + DBAccess.UPROFILE_TABLE_FIELD_FEATURE + "," + DBAccess.UPROFILE_TABLE_FIELD_VALUE + "," + DBAccess.UPROFILE_TABLE_FIELD_NUMVALUE + "," + DBAccess.FIELD_PSCLIENT + ")"
                    + subSql;
            stmt.execute(sql);

            final int userSize = 100;
            int offset = 0;
            int i = 0;
            Barrier barrier = new Barrier(Integer.parseInt(PersServer.pref.getPref("thread_num")));
            do {
                i = 0;
                sql = "SELECT " + DBAccess.USER_TABLE_FIELD_USER + " FROM " + DBAccess.USER_TABLE + " WHERE " + DBAccess.FIELD_PSCLIENT + "='" + clientName + "' LIMIT " + userSize + " OFFSET " + offset;
                ResultSet rs = stmt.executeQuery(sql);
                while (rs.next()) {
                    String user = rs.getString(1);
                    WebServer.win.log.echo("Building profile for user " + user);
                    //NootropiaThread uThread = new NootropiaThread(dbAccess, barrier, user, clientName, t0, t);
                    //uThread.start();
                    barrier.down();
                    i++;
                    //System.out.println( "" + i );
                }
                offset += userSize;
                //System.out.println( "i is " + i + " offset " );
            } while (i == userSize);

            while (barrier.getCount() != 0) {
                try {
                    Thread.sleep(5000);
                } catch (InterruptedException ex) {
                }
            }

            stmt.close();
            return success;
        } catch (SQLException ex) {
            WebServer.win.log.error(ex.toString());
            ex.printStackTrace();
            return false;
        }
    }