bhagatali
asked on
How can a ROLLBACK occur on SELECT
Hi,
We had an instance in one of our test regions where a user ran a very badly written SELECT query on 3 very large tables. The query was run from IBM DB2 connect. At some point when the query was chewing up all resources on the AS400 server we decided to do a end the job that was running the DB2 connect. The job has been showing us a ROLLBACK since then. Why would there be any ROLLBACK when the query that the user was running was a SELECT query?
Any pointers?
Regards
Ali.
We had an instance in one of our test regions where a user ran a very badly written SELECT query on 3 very large tables. The query was run from IBM DB2 connect. At some point when the query was chewing up all resources on the AS400 server we decided to do a end the job that was running the DB2 connect. The job has been showing us a ROLLBACK since then. Why would there be any ROLLBACK when the query that the user was running was a SELECT query?
Any pointers?
Regards
Ali.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
With badly written queries over large tables, the optimizer sometimes creates "temporary" tables and indexes that it uses to execute the query.
If you kill the query, it has to rollback those obects, too.
HTH,
DaveSlash
"Rollback" is the name of the state a db job goes into when an SQL step running under commitment control ends in error. Depending on how you terminated the db2 connect job, it is possible that the server is hung in a state where it is waitng for a response from the client.
Jobs running under commitment control go through a more complex recovery process, and it is possible that there can be more than one SQL statement within a transaction that s being rolled back.
Eventually it will probably time out. Sometimes the job log of the hung job will provide clues.
If the rollback job is not consuming resources, then it may just be hung. If so, you can also try to force the job to shutdown by ending it directly using wrkactjob option 4 or endjob. Assuming this is a qzdasoinit/qzdassinit job?
If this happens frequently, you need to make sure you are current on database ptfs.
Jobs running under commitment control go through a more complex recovery process, and it is possible that there can be more than one SQL statement within a transaction that s being rolled back.
Eventually it will probably time out. Sometimes the job log of the hung job will provide clues.
If the rollback job is not consuming resources, then it may just be hung. If so, you can also try to force the job to shutdown by ending it directly using wrkactjob option 4 or endjob. Assuming this is a qzdasoinit/qzdassinit job?
If this happens frequently, you need to make sure you are current on database ptfs.
Hi
you may need to include the
FOR READY ONLY
the the sql select statement otherwise dependant on the environment it may try to obtain some locks.
ie
select * from my file FOR READY ONLY
Dave
you may need to include the
FOR READY ONLY
the the sql select statement otherwise dependant on the environment it may try to obtain some locks.
ie
select * from my file FOR READY ONLY
Dave
ASKER