[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Strange view behavior in DB2 v9.1 z/OS - Queries hangs when executed

Posted on 2010-08-25
6
Medium Priority
?
620 Views
Last Modified: 2012-05-10
        Hi!

I reasently added a view that has a function in it that takes one column and decrypt it's data using the crypto facilty of our Mainframe and presents the decrypted data in the view.
I'm seeing some strange behavior how DB2 handles the view when selecting data from it.
We have tried severeal different sql statements that DB2 should use index-scan (as it does with the view we are trying to replace).
Instead the explain of the view shows tablescan and the queries hangs. The table behind the view has around 1.4 million rows with one encrypted column.
RMF data from the crypto facility shows that utilization (%) of 1 of 4 crypto coprocessors goes from 0.5 % up to 48.4 % on a 10 minute interval for just 4 sql queries that we executed.
Any ideas what could cause this ?
The only difference lies in the view where one column is decrypted in the view. Running the queries on the new view results in tablescan while the old view has index scan on all the same queries.

Regards,
    Tomas Helgi
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 37

Expert Comment

by:momi_sabag
ID: 33520376
hi tomas
is the column you are decrypting a part of the index?
if not, maybe the original view performs an index only scan, but the new view needs to also access the table, so db2 figures out it is better off with a full table scan
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 33520389
Hi Tomas,

It would appear that the optimizer is determining that a significant number of rows in the table will be required and therefore not using the index.  

If the number of rows is modest, try selecting the primary key of the target rows, forcing an index scan, and joining the table back to the selected keys.


Kent
0
 
LVL 25

Author Comment

by:Tomas Helgi Johannsson
ID: 33520872
      Hi!

We tried adding an index with the encrypted column without success. DB2 doesn't choose the index. :(
Also trying to select only the primary key columns with  those columns in where clause  then the explain shows that the
whole query has a combination (first queryblock) of tablescan (the view itself) as well as index-scan (second query block) and a cpu cost around 37 (CPU ms) and 682 (CPU su).
When both queryblocks shows tablescan then we get CPU Cost (ms) 5920 and CPU Cost (su)  109623.  :S

Regards,
    Tomas Helgi
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 33520914

Hi Tomas,

Can you post the query in the view and a perhaps the table/index definitions?


Kent
0
 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 0 total points
ID: 33521047
        Hi!

We found out what it was. The function was created with the keyword non deterministic instead of deterministic. :)
After dropping the view and function and recreating the function with appropriate keywords and view we get the same
result in both the orginal and the new view.

Regards,
   Tomas Helgi
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question