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 > Query taking long time

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-16-09, 20:32
sugeets sugeets is offline
Registered User
 
Join Date: Jul 2009
Posts: 1
Query taking long time

Hi there is a query which takes normally 4 secs to compute.

But if we add another restriction as where [tablename].[columnname] = '2009-2010' then it doenot give result in 4 minutes also.

in my point of view as it is restricting more number of rows, therefore it should have taken less time but it is other way round.

column name is a varchar field.

I have tested there are rows with '2009-2010' values also.

One more strange finding :- When I use [tablename].[columnname] like '2009%' it gives me the result in approx. 24 secs.

Any help will be of great help.
Thanks.
Reply With Quote
  #2 (permalink)  
Old 07-16-09, 22:27
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
sugeets, anytime you modify the SQL, DB2 will re-evaluate the access path. In your case, it appears that the new access path is less than optimal.

I would suggest running each of the queries through Explain and see what about the access path is being changed.
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