PearlJamFanatic
asked on
Time delay on dumping oracle resultset in csv using open csv
private Connection con;
private Statement stmt;
con = riverManager.getConnection(dbUrl, user, password);
stmt = con.createStatement();
ResultSet table = stmt.executeQuery("select * from tableA order by column1, column2,
column3");
StringWriter sw = new StringWriter();
CSVWriter csvw = new CSVWriter(sw);
csvw.writeAll(table, true);
Running this code on a oracle takes 10 times more time at the following line
csvw.writeAll(table, true);
than running it on sybase . The tables are identical in oracle and sybase. CSVWriter is class
used from the opencsv library. Please help.
Identical tables doesn't mean much. Tuning is a career and people make careers out of doing it.
Compare hardware, network speed, memory, disk speeds, caching, etc...
Check with the dba's for help figuring out if performance can be gained from normal tuning.
I assume opencsv creates a csv? There might be better ways with Oracle.
Compare hardware, network speed, memory, disk speeds, caching, etc...
Check with the dba's for help figuring out if performance can be gained from normal tuning.
I assume opencsv creates a csv? There might be better ways with Oracle.
I'd look at the "order by" clause or remove the ordering clause completely to see if it affects performance. It is likely that the tables are ordered differently. On Oracle they are typically a heap table, with secondary indexes, unless you create an IOT with "organization index" which will more closely mimic a clustered index table on MS SQL or Sybase.
At least remove the ordering temporarily to determine if it is relevant.
At least remove the ordering temporarily to determine if it is relevant.
ASKER
How do i increase fetch size. Code in JAVA please.
ASKER
I am using jconn2.jar
ASKER
and ojdbc6.jar. One is for sybase and other for oracle. I don't remeber which one is for which
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
stmt.setFetchSize(10000); did the trick.
Now dmping activity takes the same time as sybase. Thanks
Now dmping activity takes the same time as sybase. Thanks
try tweaking the fetch size for the result set