Why does SQL bring back all values in a single condition quicker?

Hi All,
I've stumbled across an interesting yet frustrating problem with one of our Discoverer Reports. The problem unfortunately is related to performance, which can be a never-ending struggle, as we all know.
Scenario:
We have a report that contains multiple outer joins that retrieves information from other sub ledgers. The type of report is tabular and it has a single page item called period name. A parameter has been setup on the period name column, which allows users to specify which period they want to report on. This is a real time report transaction report.
Problem:
The report takes various times to run depending on the amount of periods selected via the parameters. Timings are shown below –
All Periods                         –  2 min 22 sec     (36 Periods selected – 7 have data)
Apr                              -  0 min 43 sec           (01 Periods)
Apr + May                         -  1 min 06 sec      (02 Periods)
Apr + May + Jun                         -  1 min 36 sec      (03 Periods)
Apr + May + Jun + Jul                     -  2 min 29 sec      (04 Periods)
Apr + May + Jun + Jul + Aug               -  3 min 15 sec      (05 Periods)
Question:
I’m finding it very hard to understand why the time taken to run the report for 5 periods IS NOT quicker than running the report for all periods because the condition/where clause would have been refined?
I can confirm that the Period column is indexed. I’m not going to post the execution plans, as each are 117 rows long. I’m rather hoping some of you might have experienced something similar, and therefore able to point me in the right direction.
Thanks,
Lance

Hi Rod,
Looking at the SQL generated in Discoverer this is what I get for All Periods:
Where ‘…….’
AND (o227124.i227127 IN ('MAR-07','FEB-07','JAN-07','DEC-06','NOV-06','OCT-06','SEP-06','AUG-06','JUL-06','JUN-06','MAY-06','APR-06','MAR-06','FEB-06','JAN-06','DEC-05','NOV-05','OCT-05','SEP-05','AUG-05','JUL-05','JUN-05','MAY-05','APR-05','MAR-05','FEB-05','JAN-05','DEC-04','NOV-04','OCT-04','SEP-04','AUG-04','JUL-04','JUN-04','MAY-04','APR-04','MAR-04','FEB-04','JAN-04','DEC-03','NOV-03','OCT-03','SEP-03','AUG-03','JUL-03','JUN-03','MAY-03','APR-03','MAR-03','FEB-03','JAN-03','DEC-02','NOV-02','OCT-02','SEP-02','AUG-02','JUL-02','JUN-02','MAY-02','APR-02','MAR-02'))
Statistics For All Periods
351 recursive calls
0 db block gets
     32301 consistent gets
61 physical reads
0 redo size
500 bytes sent via SQL*Net to client
13147 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
6 sorts (memory)
0 sorts (disk)
0 rows processed
And this is what I get for 6 Periods
AND (o227124.i227127 IN ('AUG-06','SEP-06','JUL-06','JUN-06','MAY-06','APR-06'))
Statistics For 6 Periods
351 recursive calls
0 db block gets
32301 consistent gets
7 physical reads
0 redo size
509 bytes sent via SQL*Net to client
11736 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
6 sorts (memory)
0 sorts (disk)
0 rows processed
Looking at the statistics the ‘All Periods’ query should take longer than the 6 periods, however this is not the case.
Thanks,
Lance
Message was edited by:
Lance Botha

Similar Messages

  • When I push play, why does it play back all tracks instead of whats in the arrangement view?

    Why does it play the track even when there aren't any files in the arrangement view?

    It sounds as though "something" has become corrupted. This can be the result of an add-on, or it might be that reinstalling Firefox will help. Here are some diagnostic suggestions:
    First, make a backup of your computer for safekeeping. To back up Firefox, see [https://support.mozilla.com/en-US/kb/Backing+up+your+information Backing up your information].
    Next, try starting Firefox in Firefox
    [http://support.mozilla.com/kb/Safe+Mode Safe Mode]. Be careful not to "reset" anything permanently if you didn't back up.
    Does that fix it? If not, try creating a new (blank) profile: [http://support.mozilla.com/kb/Managing+profiles Managing profiles].
    If the new profile works, then you either can work to track down the problem with your old profile, or move key settings like bookmarks from your damaged profile to the new profile, see: [https://support.mozilla.com/en-US/kb/Recovering+important+data+from+an+old+profile Recovering important data from an old profile].
    Hope this helps.

  • Cfprocparam type="OUT" brings back empty value

    ISSUE OBJECTIVE:
    After conversion from CF 5 to CFMX 7, <cfprocparam
    type="OUT" brings back empty value
    OUR STORED PROC:
    <cfstoredproc procedure="sp_rass_user_guidance"
    datasource="#rass_data_source#" returncode="YES">
    <cfprocparam type="IN" dbvarname="@status" value="2"
    cfsqltype="CF_SQL_INTEGER">
    <cfprocparam type="IN" dbvarname="@addname"
    value="#form.newVersionName#" cfsqltype="CF_SQL_CHAR">
    <cfprocparam type="IN" dbvarname="@userid"
    value="#client.userid#" cfsqltype="CF_SQL_CHAR">
    <cfprocparam type="OUT" dbvarname="@rc" variable="rc"
    cfsqltype="CF_SQL_SMALLINT">
    <cfprocparam type="OUT" dbvarname="@reason"
    variable="reason" cfsqltype="CF_SQL_VARCHAR">
    <cfprocresult name="retrieveVersions">
    </cfstoredproc>
    In SQL query anylizer this stored proc brings back some
    values for variables rc and reason, but empty values on CF pages.
    Cf gurus please help

    Something sounds fishy. I'm not sure what more you could do
    at the database, since PL/SQL VARCHAR2 variables have a max length
    of 32,767 (as opposed to the VARCHAR2 data type limit of 4000
    bytes). Should let you return more than 900 bytes! Perhaps you may
    need to look into your kernal parameters, or Oracle parameters like
    sga_max_size, etc.
    You say that "Long Buffer Varchar is checked and set to
    max"... what value? Also, what version of ColdFusion are you using,
    as I can not "check" Long Text Buffer (chr) but only supply a
    value, or I can check CLOB (or BLOB), where checking CLOB will
    override the Long Text Buffer (chr) value.
    Phil

  • Why does the view window all of a sudden expand the content of the page I am viewing so that I have to go to "view" and click actual size??

    Why does the view window all of a sudden expand the content of the page I am viewing so that I have to go to "view" and click actual size??
    Then a few minutes later, it goes back to expanded again, it is driving me crazy.  how can I stop this????
    Thanks for any help.

    There could be a number of reasons, first thing to check is if you are clicking Command + or Command -. The Command 0 keystrokes restore Safari to the actual size. You can also reset Safari by Safari - Reset.

  • Google search does not work. It does not bring back any results and disables my internet connection until I close the brower, wait, and then open it again.

    Google search does not work. It does not bring back any results and disables my internet connection. I have to close the browser, wait, and then open it again. It only seems to happen when I am signed into my Google account. If I am signed out the search functions properly.

    Do a malware check with some malware scanning programs on the Windows computer.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of their databases before doing a scan.<br /><br />
    *http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    *http://www.superantispyware.com/ - SuperAntispyware
    *http://www.microsoft.com/security/scanner/en-us/default.aspx - Microsoft Safety Scanner
    *http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    *http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    *http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • Syncing a moved folder is not bringing back all the photos to Lightroom

    I have moved and renamed a folder in the external harddrive. Syncing that moved folder in lightroom is not working in bringing back all the photos to Lightroom - Although all the photos exist in that folder as I have confirmed through windows explorer.
    Another Option: If I choose "import photos to this folder option" in LR and browse to the source to that folder - the missing photos are shown as shaded back and the import button (bottom right corner) is not highlighted. Therefore I cannot select these missing photos and hence cannot import them to the folder.
    PLEASE ADVISE!

    In the Folders Panel, the original folder should be listed with a "?" mark, because Lightroom can no longer find it. Right-click on it, select "Find Missing Folder", then browse to and select the renamed folder in its new location.
    Note....these type of problems will continue to happen if you continue to rename and/or move folders or files outside of Lightroom. Do it using Lightroom and no such problems will arise.

  • Why does my iphone send all text from only one of my contacts to my email?

    Why does my iphone send all text from only one of my contacts to my email? I'm curious to know if anyone else has had this issue with the Iphone 5s...

    imessage has a new setting that shows all emails associated with your apple id.  There are two sections, send and receive.  Since you are using the same apple id, Im sure if you adjust one of those settings to your mobile number instead of your appleid, it wont send double.
    You might also have to adjust your wifes settings too, so those emails dont overlap

  • Why does iphoto not copy all photos when transfering

    Hi peeps.
    why does iPhoto not copy all photos from an event when im copy/pasting to an external folder on my mac(for later transfer). All softwares are up to date and ive only just realised it happens, but when i copy all pics in an event then paste in a folder, the pic count is substantially different. for example i select all pictures in an event called 'new1', the count of files is 188. i then copy/ paste to a folder,  select all files and check 'info' and it says 141 files??? 
    all i can see painstakingly going through to compare which images are in each place is that the ones that arent in my new folder , seem to be the ones ive edited in iPhoto??  conincidence? or am I missing something fundamental here?  Ive only just realised this is occuring. The trouble is, after moving images to folders/hard drives I  subsequently delete them from iphoto to keep my macbook airs HDD with some space.  So basically all of the versions of pictures I want, i.e, the new edited and adjusted versions are no longer! NOT HANDY!
      help please.

    We've seen a few reports of this in the past while and no one is sure of the cause.
    Use the File -> Export command. See this User Tip
    https://discussions.apple.com/docs/DOC-4921
    for details of the options the Export Dialogue offers.
    If you're interested in your Photos then this workflow
    The trouble is, after moving images to folders/hard drives I  subsequently delete them from iphoto to keep my macbook airs HDD with some space.
    means you are losing quality, metadata and the version of control. If you don't want these why use iPhoto at all?
    You could just move the whole Library to an external:
    Make sure the drive is formatted Mac OS Extended (Journaled)
    1. Quit iPhoto
    2. Copy the iPhoto Library from your Pictures Folder to the External Disk.
    3. Hold down the option (or alt) key while launching iPhoto. From the resulting menu select 'Choose Library' and navigate to the new location. From that point on this will be the default location of your library.
    4. Test the library and when you're sure all is well, trash the one on your internal HD to free up space.
    Regards
    TD

  • Why does Adobe Flash crash all the time? It is reallyt annoying and I'm considering using another browser. Please tell me how to fix this.

    Why does Adobe Flash crash all the time? It is really annoying and I'm considering using another browser.
    Please tell me how to fix this.

    Try to uninstall your current Flash version and update Flash to the latest version.
    Troubleshoot Flash Player installation for Windows:
    * http://kb2.adobe.com/cps/191/tn_19166.html#main_Uninstall_the_older_Flash_Player_version
    *http://www.adobe.com/software/flash/about/
    *https://support.mozilla.com/kb/Managing+the+Flash+plugin
    *http://kb.mozillazine.org/Flash

  • Why does SQL execute inner selected functions again in the outer select?

    Hi,
    Why does SQL execute inner selected functions again in the outer select?
    Given:
    CREATE OR REPLACE FUNCTION K_TEST
    RETURN NUMBER IS
    BEGIN
    RETURN 1;
    END;
    SELECT K_TEST, K_TEST FROM DUAL;Will (logically) execute the function twice.
    SELECT intest, intest
    FROM (SELECT K_TEST intest FROM DUAL);Will execute the function twice too!
    Why can't SQL buffer the inner result?
    Does anyone have an idea on how to achieve executing the function only once? My original called function is quite heavy and returning a user defined type. Adding predicates, the function is executed 3 or 4 times!
    Thanks for any tips,
    K.

    Hello
    Depending on your version of Oracle, Sub query caching could help....
    XXXX> create sequence seq_1
      2  /
    Sequence created.
    Elapsed: 00:00:00.07
    XXXX> CREATE OR REPLACE FUNCTION K_TEST
      2  RETURN NUMBER IS
      3
      4      ln_Ret  NUMBER;
      5
      6  BEGIN
      7      SELECT
      8          seq_1.NEXTVAL
      9      INTO
    10          ln_Ret
    11      FROM
    12          dual;
    13
    14      RETURN ln_Ret;
    15  END;
    16  /
    Function created.
    Elapsed: 00:00:00.60
    XXXX>
    XXXX> SELECT K_TEST, K_TEST FROM DUAL;
        K_TEST     K_TEST
             1          2
    1 row selected.
    Elapsed: 00:00:00.06
    XXXX> SELECT K_TEST, K_TEST FROM DUAL;
        K_TEST     K_TEST
             3          4
    1 row selected.
    Elapsed: 00:00:00.01
    XXXX> SELECT intest, intest
      2  FROM (SELECT K_TEST intest FROM DUAL);
        INTEST     INTEST
             5          6
    1 row selected.
    Elapsed: 00:00:00.10
    XXXX> SELECT
      2      intest,intest
      3  FROM
      4      (
      5          SELECT (SELECT K_TEST FROM dual) intest
      6          FROM
      7          dual
      8
      9      )
    10  /
        INTEST     INTEST
             7          7
    1 row selected.
    Elapsed: 00:00:00.03
    XXXX> /
        INTEST     INTEST
             8          8
    1 row selected.
    Elapsed: 00:00:00.01THis last example takes advantage of a specific optimisation for calling functions in a subquery. Not sure if it would suit your circumstance though...
    Alternatively - again depending on your version - you might be able to look at function result caching...
    HTH
    David
    Edited by: Bravid on Feb 1, 2012 12:32 PM

  • Why does my iCal delete all events older than a year? Is this a synch issue? I'm running Snow Leopard.

    Why does my iCal delete all events older than a year? Is this a syn issue? I'm running Snow Leopard.

    this has already been answered.
    please ignore my question.

  • HT5262 why does my icloud back up take several hours

    why does my icloud back up take several hours>

    you could always try turning the phone off and starting the backup over again. If it's still happening, it's possible that it's related to the network you're in

  • Why does Mail go back online when I've set it to offline and put computer to sleep (Power Nap NOT enabled)

    Why does Mail go back online when I've set it to offline and put computer to sleep (Power Nap NOT enabled)

    for me this issue is only new powerbook w retina display on 10.8. do not have issue on Lion, imac, ibook or old powerbook 17.

  • Retrieving ALL values from a single restricted user property

    How can I retrieve ALL values of a single restricted user property from within
    a .jpf file?
    I want to display a dropdown list within a form in a JSP which should contain
    all the locations listed in the property 'locations'. I ever get just the default
    value when I access the property via
    ProfileWrapper pw = userprofile.getProfileForUser(user);
    Object prop = pw.getProperty("ClockSetup", "Locations");

    Well, the code you've got will retrieve the single value of the property
    for the current user. You're getting the default value because the
    current user doesn't have Locations property set, so the ProfileWrapper
    returns the default value from the property set.
    I assume you want to get the list of available values that you entered
    into the .usr file in Workshop. If so, I've attached a
    SetColorController.jpf, index.jsp, and GeneralInfo.usr (put in
    META-INF/data/userprofiles) I wrote for an example that does just this.
    It uses the PropertySetManagerControl to retrieve the restricted values
    for a property, and the jsp uses data-binding to create a list from that
    pageflow method.
    For a just-jsps solution, you can also use the
    <ps:getRestrictedPropertyValues/> tag. I've attached a setcolor-tags.jsp
    that does the same thing.
    Greg
    Dirk wrote:
    How can I retrieve ALL values of a single restricted user property from within
    a .jpf file?
    I want to display a dropdown list within a form in a JSP which should contain
    all the locations listed in the property 'locations'. I ever get just the default
    value when I access the property via
    ProfileWrapper pw = userprofile.getProfileForUser(user);
    Object prop = pw.getProperty("ClockSetup", "Locations");
    [att1.html]
    package users.setcolor;
    import com.bea.p13n.controls.exceptions.P13nControlException;
    import com.bea.p13n.property.PropertyDefinition;
    import com.bea.p13n.property.PropertySet;
    import com.bea.p13n.usermgmt.profile.ProfileWrapper;
    import com.bea.wlw.netui.pageflow.FormData;
    import com.bea.wlw.netui.pageflow.Forward;
    import com.bea.wlw.netui.pageflow.PageFlowController;
    import java.util.Collection;
    import java.util.Iterator;
    * @jpf:controller
    * @jpf:view-properties view-properties::
    * <!-- This data is auto-generated. Hand-editing this section is not recommended. -->
    * <view-properties>
    * <pageflow-object id="pageflow:/users/setcolor/SetColorController.jpf"/>
    * <pageflow-object id="action:begin.do">
    * <property value="80" name="x"/>
    * <property value="100" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="action:setColor.do#users.setcolor.SetColorController.ColorFormBean">
    * <property value="240" name="x"/>
    * <property value="220" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="action-call:@page:index.jsp@#@action:setColor.do#users.setcolor.SetColorController.ColorFormBean@">
    * <property value="240,240,240,240" name="elbowsX"/>
    * <property value="144,160,160,176" name="elbowsY"/>
    * <property value="South_1" name="fromPort"/>
    * <property value="North_1" name="toPort"/>
    * </pageflow-object>
    * <pageflow-object id="page:index.jsp">
    * <property value="240" name="x"/>
    * <property value="100" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="forward:path#success#index.jsp#@action:begin.do@">
    * <property value="116,160,160,204" name="elbowsX"/>
    * <property value="92,92,92,92" name="elbowsY"/>
    * <property value="East_1" name="fromPort"/>
    * <property value="West_1" name="toPort"/>
    * <property value="success" name="label"/>
    * </pageflow-object>
    * <pageflow-object id="forward:path#success#begin.do#@action:setColor.do#users.setcolor.SetColorController.ColorFormBean@">
    * <property value="204,160,160,116" name="elbowsX"/>
    * <property value="201,201,103,103" name="elbowsY"/>
    * <property value="West_0" name="fromPort"/>
    * <property value="East_2" name="toPort"/>
    * <property value="success" name="label"/>
    * </pageflow-object>
    * <pageflow-object id="control:com.bea.p13n.controls.ejb.property.PropertySetManager#propSetMgr">
    * <property value="31" name="x"/>
    * <property value="34" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="control:com.bea.p13n.controls.profile.UserProfileControl#profileControl">
    * <property value="37" name="x"/>
    * <property value="34" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="formbeanprop:users.setcolor.SetColorController.ColorFormBean#color#java.lang.String"/>
    * <pageflow-object id="formbean:users.setcolor.SetColorController.ColorFormBean"/>
    * </view-properties>
    public class SetColorController extends PageFlowController
    * @common:control
    private com.bea.p13n.controls.ejb.property.PropertySetManager propSetMgr;
    * @common:control
    private com.bea.p13n.controls.profile.UserProfileControl profileControl;
    /** Cached possible colors from the User Profile Property Set definition.
    private String[] possibleColors = null;
    /** Get the possible colors, based upon the User Profile Property Set.
    public String[] getPossibleColors()
    if (possibleColors != null)
    return possibleColors;
    try
    PropertySet ps = propSetMgr.getPropertySet("USER", "GeneralInfo");
    PropertyDefinition pd = ps.getPropertyDefinition("FavoriteColor");
    Collection l = pd.getRestrictedValues();
    String[] s = new String[l.size()];
    Iterator it = l.iterator();
    for (int i = 0; it.hasNext(); i++)
    s[i] = it.next().toString();
    possibleColors = s;
    catch (P13nControlException ex)
    ex.printStackTrace();
    possibleColors = new String[0];
    return possibleColors;
    /** Get the user's favorite color from their profile.
    public String getUsersColor()
    try
    ProfileWrapper profile = profileControl.getProfileFromRequest(getRequest());
    return profileControl.getProperty(profile, "GeneralInfo", "FavoriteColor").toString();
    catch (P13nControlException ex)
    ex.printStackTrace();
    return null;
    // Uncomment this declaration to access Global.app.
    // protected global.Global globalApp;
    // For an example of page flow exception handling see the example "catch" and "exception-handler"
    // annotations in {project}/WEB-INF/src/global/Global.app
    * This method represents the point of entry into the pageflow
    * @jpf:action
    * @jpf:forward name="success" path="index.jsp"
    protected Forward begin()
    return new Forward("success");
    * @jpf:action
    * @jpf:forward name="success" path="begin.do"
    protected Forward setColor(ColorFormBean form)
    // set the color in the user's profile
    try
    ProfileWrapper profile = profileControl.getProfileFromRequest(getRequest());
    profileControl.setProperty(profile, "GeneralInfo", "FavoriteColor", form.getColor());
    catch (P13nControlException ex)
    ex.printStackTrace();
    return new Forward("success");
    * FormData get and set methods may be overwritten by the Form Bean editor.
    public static class ColorFormBean extends FormData
    private String color;
    public void setColor(String color)
    this.color = color;
    public String getColor()
    return this.color;
    [GeneralInfo.usr]
    [att1.html]

  • Why does my macbook pro, snow leopard get so hot so quickly?

    why does my macbook pro, snow leopard get so hot so quickly?
    Can someone give helpful suggestions on solving this problem?
    Thanks!
    NELLY

    Open Activity Monitor in the Utilities folder.  Select All Processes from the Processes dropdown menu.  Click twice on the CPU% column header to display in descending order.  If you find a process using a large amount of CPU time (>=70,) then select the process and click on the Quit icon in the toolbar.  Click on the Force Quit button to kill the process.  See if that helps.  Be sure to note the name of the runaway process so you can track down the cause of the problem.

Maybe you are looking for

  • Technical Help on creation of an Object in SAP SRM 4.0

    Being on SAP SRM 4.0, we currently have a requirement for creation of Need Definition( Basically a build up for the contract ). Need being collected from the Backend systems need to be validated and approved by Buyers & Lead Buyers in the SRM system.

  • Sun Ray server software and Sun DSEE

    I want to have a centralized user administration in the latest sun java 7 directory server. i want to set up the system in that the users of the sun ray thin clients will be authenticated from the DSEE. Please assist me in how to make this work.

  • Cannot include a staic file in a JSP

    hi everybody, i have a requeirement as follows. i need to include a static html file in a JSP which IS NOT IN application server's jsp folder. i tried specifying actual file path and server's absolute path. not n use. can some body help me. applicati

  • How to disable AES CBC encryption on ASA 5545

    Hi , In our environment  having ASA 5545 ( IOS Ver 9.1) Firewall and In there AES 256 CBC cipher encryption is enabled for SSH user access. we need to disable CBC cipher encryption and enable the CTR Cipher encryption for SSH users. Kindly help me fo

  • Dynamic field population

    Hi, How to populate one field from other field in module pool table control................ i have 3 fields....in table control..when I enter value in 3rd field manually ...2nd field value should get populated automatically....this is my requirement.