BookmarkSubscribeRSS Feed
Minghe
Calcite | Level 5

As title. Especially the insert performance of SAS JDBC is terrible when I'm writing a JDBC application by Java.

What I did was prepare an insert statement, then pass to the JDBC connection (SAS 9.4 IOM driver, driver class com.sas.rio.MVADriver).

I observed that SAS treated statement.executeBatch() / statement.execute() the same. Seems batch execution won't have performance gains. Tried to change the fetch size which almost the same. Suspended SAS log helped a little. But it's still very slow.

Deeply appreciated if somebody can share the tips for optimizing the SAS JDBC insert.

Attached the extraction of java code for discussion.

prepare and execute insert statements with SAS JDBC
while (rs.next()) {

rows++;

for (int i = 1; i <= columns.size(); i++) {
converter.prepareInsertSql(rs, statement, i);
}
statement.addBatch();

if ((rows % fetchSize) == 0) {
statement.executeBatch();
statement.clearWarnings();
target.commit();
}
}
statement.executeBatch();
target.commit();
1 REPLY 1
PaulHomes
Rhodochrosite | Level 12

Whilst this question is several years old now, I stumbled on it while investigating slow performance when using the SAS JDBC driver for lots of updates. For the benefit of others who may find this thread in future, I'll add my own findings too. Like the original poster I found that using JDBC batch didn't help much. In my case I found it was significantly faster to handle my own batching and spawn a workspace server session to submit proc sql code to do a batch of inserts/updates instead.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1346 views
  • 3 likes
  • 2 in conversation