Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009
    Posts
    1

    Unanswered: 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.

  2. #2
    Join Date
    May 2009
    Posts
    508
    Provided Answers: 1
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •