473,320 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Fetch rows faster with JDBC v2.

System scenario: Linux DB2 Workgroup Server V7 FixPack 13.

I have a java application (JDBC v2 driver) that reads into memory a
considerable amount of data (100k-300k rows), summarizes
the results and then deletes data from the DB. This is done hourly.

According to my developer, the application opens a cursor and (fetch
next) until the end. I have created an event monitor and the
SQL sent to the DB is not poorly written (it uses the table PK).

The time required to read data from the DB is considerably higher than
deleting it. I was wondering if there is any configuration
within JDBC and/or db2 parameters to better handle prefetching, and
decrease my DB read time ?

Thanks in advance,

Michel

Nov 12 '05 #1
2 2006
Have you looked at an EXPLAIN PLAN of the statement?

Personally, i usually keep away from CURSORs (unless i am passing
information to a program), with the assumption that CURSORs are much
slower.

B.

Nov 12 '05 #2
It's not surprising that the retrievals take longer than the delete.
Retrieval requires formatting data for presentation to the application
and handling all of the "service me" calls (fetch) that the application
issues.

Try writing a complex SQL statement that performs the "summarization" in
the database manager. Retrieving only the summary results should be much
faster than fetching the source data and summarizing it in your program.

Phil Sherman

Michel Esber wrote:
System scenario: Linux DB2 Workgroup Server V7 FixPack 13.

I have a java application (JDBC v2 driver) that reads into memory a
considerable amount of data (100k-300k rows), summarizes
the results and then deletes data from the DB. This is done hourly.

According to my developer, the application opens a cursor and (fetch
next) until the end. I have created an event monitor and the
SQL sent to the DB is not poorly written (it uses the table PK).

The time required to read data from the DB is considerably higher than
deleting it. I was wondering if there is any configuration
within JDBC and/or db2 parameters to better handle prefetching, and
decrease my DB read time ?

Thanks in advance,

Michel

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Evan Smith | last post by:
During a routine performance check using an event monitor, I discovered a class of query whose performance has me baffled. The monitor captured: SELECT * FROM EWM_CASE fetch first 1 rows only...
13
by: RR | last post by:
Hi, It appears that DB2 has an arbitrary restriction on the use of "fetch first N rows". I want to insert into a table from a large table query, but only insert the first N rows: insert...
3
by: becoolmun | last post by:
It seems with V7 of DB2 I can now use Fetch First 1 Rows Only in a Select stmt, whic is great, because I don't have to use a cursor. Unfortunately, it doesn't allow ORDER BY in the same Select and...
1
by: alan_sec | last post by:
I' m sending query to DB2 7.2 (installed on Win 2000) using JDBC driver COM.ibm.db2.jdbc.net.DB2Driver like this: String query = "SELECT dercert from vacert " + "WHERE vrijediod=(select...
5
by: Bernd Hohmann | last post by:
Is there any way to create a dynamic row limit like "fetch first ? rows only" using the JDBC driver and a PreparedStatement? Bernd -- "Ja, alles meine Herren" sprach Fürst Lichnowsky. "Ooch...
9
by: Acupuncture | last post by:
Hi, I am developing a JDBC application and I encountered this problem (DB2 for ISeries). I want to do a select for update and also use the fetch first rows clause. This is my sql statement: ...
4
by: db2admin | last post by:
hi, For the following SQL and plan ============================================================== SELECT Q1.PLCY_KY, Q1.PLCY_TRM_EFCTV_DT, Q1.ACNTG_BGN_DT, CASE WHEN ((Q1.PLCY_SRC_CD = '02')...
10
by: scoonie999 | last post by:
I'm having a problem that I can't seem to find any solution for online. I'm using a cursor in a cobol program to fetch some data. I know for a fact that the select should return 2 rows. The...
7
by: Frank Swarbrick | last post by:
Is there a way to do a multi-row fetch in to a COBOL table with DB2/LUW? Apparently the following is supported in z/OS, but not LUW (or at least I couldn't get it to work): WORKING-STORAGE...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.