0

I am searching a DB and setting what is found in a resultset variable and I saw it took awhile to run my function and i narrowed it down to the resultset.getstring. I say this because all I did was set it to a variable and it took an average of 24 milliseconds per row to do that. I did do some checking and the string i was getting was about 9000 characters long making it about 70kb if I counted it up right. I put part of the relevant code below.

Is that call typically slow? If so is there something else that can be used that would be faster? Or could it be the size of the string causing the slowness? Sorry if this was answered before but I could not find it.

int itcount = 0;
st = DB_Conn.createStatement();
st.setFetchSize(1500);
st.setQueryTimeout(17);

ResultSet rs = st.executeQuery(query);

StringSearch ss = new StringSearch(look);
String test;

while(rs.next()){
    if((itcount % 1000) == 0){
        System.out.println(itcount);
    }
    test = rs.getString(1);
    itcount++;
}
jfen
  • 13
  • 1
  • 4
  • something i have looked at now is that i am getting a Clob from the resultset and from what i can tell is that the conversion from Clob to String is where i am losing my time. or the value in the result set is a pointer to the database and when it is called it has to pull the String i need from the database at that time. – jfen Feb 08 '18 at 20:09
  • not related but I was wondering: you increase msgcount but check itcount value do you initialize somewhere those primitives? – HRgiger Feb 09 '18 at 14:52
  • yeah i have those set somewhere else. ill edit the code didnt relize i had those missing – jfen Feb 09 '18 at 17:53
  • Bump, if someone could get me some insight on it that would be great. even if it is to tell me i am doing it the quickest way. I was able to check and the info i am getting is stored as a CLOB in the database – jfen Feb 13 '18 at 15:25
  • Which version of the Database and driver are you using? – Jean de Lavarene Feb 15 '18 at 18:18
  • Jean i believe the database version is 11 and the driver i am using should be the most current one ojdbc7 – jfen Feb 19 '18 at 17:38
  • Probably my last bump, is there anyone that can help with this or that can shed some light on it? – jfen Feb 28 '18 at 18:13

0 Answers0