If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Question about Performance in a Qry

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-10-11, 16:27
achiola achiola is offline
Registered User
 
Join Date: May 2002
Location: General Deheza, Cba, Arg.
Posts: 273
Question about Performance in a Qry

Hi... And thanks... I have a iSeries 570 with DB2 5.4... and this qry not work ok, indeed, i'm lost...

This query, run in 2 seconds... (running after o before not matter the order)

select *
from pd812dta.f4211

where sdIVD = 111161

and sdKCOO in ( '00001', '00003' )

and substr(sdVR02,1,2) in ( '01','02', '03', '06', '07', '08', '19', '20', '21' )

and sdDCT not
in ( 'VA', 'VC', 'VD', 'VF', 'VP', 'VK', 'TA', 'TF', 'TI', 'TN', 'TQ', 'TV', 'XA' )
with ur



but this.... taken one minute a 11 seconds!!!

select *
from pd812dta.f4211

where sdIVD =
( ((year( '2011-06-10' )-1900)*1000) + ( dayofyear( '2011-06-10')))

and sdKCOO in ( '00001', '00003' )

and substr(sdVR02,1,2) in ( '01','02', '03', '06', '07', '08', '19', '20', '21' )

and sdDCT not
in ( 'VA', 'VC', 'VD', 'VF', 'VP', 'VK', 'TA', 'TF', 'TI', 'TN', 'TQ', 'TV', 'XA' )
with ur




why ?
any idea?
TIA!!
Reply With Quote
  #2 (permalink)  
Old 06-10-11, 21:28
stiruvee stiruvee is offline
Registered User
 
Join Date: May 2010
Location: India
Posts: 34
Try matching data types in where clause using INTEGER function in second query. Older versions of DB2 optimizer have problems with data type mis-match in where clause

INTEGER(( ((year( '2011-06-10' )-1900)*1000) + ( dayofyear( '2011-06-10'))))

Satya...
Reply With Quote
  #3 (permalink)  
Old 06-25-11, 04:11
JackVamvas JackVamvas is offline
Registered User
 
Join Date: Aug 2008
Posts: 48
you could also try a JOIN
__________________
---------------------------------
www.sqlserver-dba.com
www.dba-db2.com
Reply With Quote
  #4 (permalink)  
Old 06-26-11, 06:28
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by JackVamvas View Post
you could also try a JOIN
That wouldn't help for the performance: also a JOIN condition must use matching data types!
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On