DB2 read-only clause and performance

14 February,2014 by Tom Collins

Question: Why do some sql queries use a read-only clause? Is there any performance gain by using the read only clause?

 Answer:Sometimes you will see a sql statement such as :

 

Select name from mytable for read only

 

The purpose of using the read only clause is to make the cursor unambiguous. When the read only clause is used , positional updates cannot occur

By unambiguous I mean : Normally the SELECT is turned into a cursor. If the cursor is explicitly defined as a READ ONLY – “blocking” is used. “Blocking” means the DB2 server sends groups of rows across to the client.  Normally DB2 only shows this behaviour on non updatabable cursors e.g joins

The potential result in a multi user environment is to decrease throughput –  as more users are allowed to take shared locks

 Read More

Performance Tuning series – Performance Stack

Database Tuning  overview – Hardware Tuning

OLTP checklist for DB2 configurations.

Database tuning and Operating System Tuning  

Database Tuning overview – Buffer Tuning

Author: Rambler(http://www.dba-db2.com)

Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on DB2 read-only clause and performance

Comments are moderated, and will not appear until the author has approved them.


dba-db2.com | DB2 Performance Tuning | DBA DB2:Everything | FAQ | Contact | Copyright