Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2010
    Posts
    19

    Unanswered: Regarding Query execution

    Hi,
    I have a doubt regarding how the following dynamic queries will be executed from a preparedstatement in Java.

    1) Select name, age,salary from employee where id in (?)

    2) Select name, age,salary from employee where id in (?,?)

    3) Select name, age,salary from employee where id in (?,?,?)

    Will the query optimization happen only once or will DB2 treat each of the above queries as a different query and do optimization, do hard parsing and softparsing or it will only do soft parsing for 2 and 3.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    These will be treated as three different queries.

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    The simple reason is that all 3 queries can lead to different access paths, i.e. because of the selectivity values.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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