Response time performance for the NOT EXISTS condition

Hi all,
In the query below, there is the WHERE NOT EXISTS condition based on a view. And I want to know what is the better choice to take whether to include the DISTINCT keyword in the select script of the view or not , because the view contains duplicated rows :
select * from table_name table_alias where not exists( select 1 from the_view_name where join_condition);
Thank you very much indeed

Sometimes it is, sometimes it isn't, usually it's the same. The optimizer will tend to rewrite the query as a join anyway if it can.
For some notes on the options available to the optimizer for an EXISTS subquery:
http://jonathanlewis.wordpress.com/join-ordering-pt2
Most if not all of those are also possible for an IN subquery (couldn't find a link just now but I have to go to work).

Similar Messages

  • How to speed a select statement with the NOT EXISTS where condition ?

    Hi all,
    I created a view : create or replace view view_name as select * from table_1,table_2 where join_condition and some conditions.
    Now I have added in the view "where" clause two NOT EXISTS conditions based on one another different table respectively.
    Before I added these two conditions the response time was fast ; but after I added these two conditions then the response time deteriorated.
    So how to optimize the select statement ? Hints and so on ...
    Thank you very much indeed
    Message was edited by:
    andrianiaina

    Just run the script :
    SQL> explain plan for select * from dual;
    Explained.
    SQL> @$ORACLE_HOME/rdbms/admin/utlxpls.sql
    PLAN_TABLE_OUTPUT
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |       |       |       |
    |   1 |  TABLE ACCESS FULL   | DUAL        |       |       |       |
    Note: rule based optimization
    9 rows selected.
    SQL>Nicolas.

  • RDS Gateway 2012, RemoteApp Displays "A Revocation check could not be performed for the Certificate" via RDWEB

    I have searched through the forums and there are a number of posts that are similar but all the checks they list seem to not apply to this one.
    My current setup is as follows
    All Servers are 2012 R2
    1 x DC server
    1 x RDS Gateway server with RDS Web installed
    1 x Session Host Server
    Certificate supplied by godaddy with 5 names. (included is the name of the RDS Gateway/Web server in the certificate, the internal name of the session host server is not included as the internal names are differnet to the external)
    My tests are as follows
    Navigating to the RDSWEB page from a machine inside the same network (windows 7 sp1) but not on the same domain is fine no errors and logging in and launching any published application is fine with no errors.
    However logging in on another machine that is external from the network (windows 7 sp1) is ok up to the point of launching any of the published apps I get the error about ""A Revocation check could not be performed for the Certificate". this
    prompts twice but does allow you to continue and login and use the app till the next time. If I view the certificate from the warning message all appears to be ok with all certs in the chain.
    I have imported the root and intermediate certs to each of the gateway/rdsweb server and session host server into the computer cert store just to be on the safe side. This has not helped, I have also run the following command from both windows 7 machines
    with no errors on either
    certutil -f –urlfetch -verify c:\export.cer
    I cant seem to see where this is failing and I am beginning to think there is something wrong with godaddy cert itself somehow.
    If I skip rdsweb and just use MSTSC with the gateway server settings then I can login to any machine on the network with no errors so this is only related to launching published apps on the 2012 R2 RDWEB or session host servers.
    Any help appreciated

    Hi,
    1. Please make sure the client PCs have mstsc.exe (6.3.9600) installed.
    2. If you are seeing a name mismatch error, you can set the published name via this cmdlet:
    Change published FQDN for Server 2012 or 2012 R2 RDS Deployment
    http://gallery.technet.microsoft.com/Change-published-FQDN-for-2a029b80
    To be clear, the above cmdlet changes the name that shows up next to Remote computer on the prompt you see when launching a RemoteApp.  You should have a DNS A record on your internal network pointing to the private ip address of your RDCB server. 
    Additionally, in RD Gateway Manager, Properties of your RD RAP, Network Resource tab, you should select Allow users to connect to any network resource or if you choose to use RD Gateway Managed group you will need to add all of the appropriate names to the
    group.
    For example, when launching a RemoteApp you would see something like Remote computer: rdcb.domain.com and Gateway server: gateway.domain.com .  Both of these names need to be on your GoDaddy certificate.
    Please verify the above and reply back so that we may assist you further if needed.  It is possible you have an issue with the revocation check but I would like you to make sure that the above is in place first.
    Thanks.
    -TP
    Thanks for the response.
    To be clear I am only seeing a name mismatch and revocation error if I assign a self signed cert to the session host as advised earlier in the thread by "Dharmesh Solanki", if I remove this and assign the 3rd party certificate I then
    just get the revocation error , I have already ran the powershell to change the FQDN's but this has not resolved the issue although the RDP connection details now match the external url for RDWEB when looking at one of the remoteapp files. The workspace
    ID still shows an internal name though inside this same file. 
    RD Gateway is already set to connect any resource, when connecting using remote app both names (RDCB/RDGateway) show as being correct and are contained within the same UCC certificate. I also already have a DNS entry for the Connection broker pointing to
    the internal ip.
    Do you know if the I need the internal name of the session host servers contained within the same UCC certificate seeing as they are different fqdn's than what I am using for external access ? I resigned the UCC certificate and included the internal name
    of the session host server to see if this would help but for some reason I am still seeing the revocation error. I will check on a windows 8 client pc this evening to see if this gets any further as the majority of the testing has been done on windows 7 sp1
    client pc's
    Thanks

  • I am backing up to my time capsule for the first time. It has been stuck on 348mb of 20.1 gb for days. Is this normal or is the machine not functioning correctly?

    I am backing up to my time capsule for the first time. It has been stuck on 348mb of 20.1 gb for days. Is this normal or is the machine not functioning correctly?

    That seems to be OK via WLAN!
    It ist better to do the first backup via LAN-cable.

  • HT1145 I am setting up my Time Capsule for the first time, all of my connections are right but, AirPort is not recognizing the Time Capsule or my network!

    I am setting up my Time Capsule for the first time, all of my connectiions are correct but, AirPort Utility is not recognizing my Time Capsule or my network?

    Try connecting your iMac to the Time Capsule with an Ethernet cable to see if that allows AirPort Utility to "see" it.

  • Running Time Machine for the first time, how that I make sure that some information I have in the external drive does not get erase in the prosess

    Running Time Machine for the first time, how that I make sure that some information I have in the external drive does not get erase in the prosess

    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.
    Note: This is now your Library. It's not a Back Up, and you need another disk for backing up.
    Regards
    TD

  • 'Order By' in Exists / Not Exists condition causing ORA-00907 in Apex4.1.1

    Hi Guys,
    We have just upgraded from apex 3.2.1 to 4.1.1. on Oracle DB V11.2.0.1, while testing the apps in apex, I come across this problem.
    When I have a page process that has a condition defined.
    When Condition Type is Exists (SQL query returns at least one row) or Not Exists (SQL query returns no rows) and the Expression 1 is a query with an 'Order By' clause, e.g.
    SELECT 123 FROM DUAL
    ORDER BY 1
    When the process is triggered, Apex 3.2.1 would evaluate the condition and run the process just fine, however Apex 4.1.1 would throw an error : ORA-00907: missing right parenthesis
    I totally understand that an Order by clause in an Exists or Not Exists condition is unnecessary and agree that they shouldn't be there in the first place.
    But unfortunately I am dealing with other developers codes and these conditions have been coded like these, probably from copy & paste codes.
    Saying that, I also believe that an Apex upgrade should not stop anything that is working in previous releases without warning or provide a workaround, right?
    I don't know if this affects other types of artifacts that can have a condition in apex when upgrading from 3.2.1, e.g Regions/Items/Computations/Validations etc.
    Does anyone else get this behaviour? and is there an easy solution to fix these?
    Ideally I don't want to go through all processes (and whatever other artifacts might be affected too) in all apps in all workspaces to check the condition type and remove the 'Order By' clause manually.
    Thanks for any advises
    Just did some more testing
    'Computation' , 'Validations', 'Processes' and 'Branches' have the same problem, 3.2.1 takes 'Order By' fine in Exists/Not Exists condition, but 4.1.1 throws error.
    'Regions', 'Buttons', 'Items' have consistent behaviour - both 3.2.1 and 4.1.1 throw error ORA-00907: missing right parenthesis, when page is rendered.
    Edited by: Danny on 25/04/2012 20:07

    Hi Danny,
    that's interesting. I just had a look what happens when you use an EXISTS or NOT EXISTS condition type. The following final SQL statement will be generated with your above example. You can also see that if you run your application in debug mode.
    select count(*) from sys.dual where exists (select 123 from dual order by 1)Executing that statement in SQL*Plus will also show the ORA-00907 error. It appears that the SQL parser doesn't allow an order by clause in an EXIST clause.
    I wonder why this should have worked in previous versions, but I can only suspect that in the past we may just have executed
    select 123 from dual order by 1which can be slightly slower because with the new EXISTS statement the SQL engine can stop processing earlier if it finds a record.
    We try to be backward compatible as much as possible, but I doubt that we will change that back to the way it was before because of the performance penalty 99.9% of our customers would face.
    Possible Workaround: You might be able to use the new "Application Search" to scan your application for "order by" and fix it for all hits where the attribute name is "Expression 1".
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Performance for the below code

    Can any one help me in improving the performance for the below code.
    FORM RETRIEVE_DATA .
    CLEAR WA_TERRINFO.
    CLEAR WA_KNA1.
    CLEAR WA_ADRC.
    CLEAR SORT2.
    *To retrieve the territory information from ZPSDSALREP
    SELECT ZZTERRMG
           ZZSALESREP
           NAME1
           ZREP_PROFILE
           ZTEAM
         INTO TABLE GT_TERRINFO
         FROM ZPSDSALREP.
    *Preparing Corporate ID from KNA1 & ADRC and storing it in SORT2 field
    LOOP AT GT_TERRINFO INTO WA_TERRINFO.
      SELECT SINGLE * FROM KNA1 INTO WA_KNA1
                      WHERE KUNNR = WA_TERRINFO-SALESREP.
      SELECT SINGLE * FROM ADRC INTO WA_ADRC
                      WHERE ADDRNUMBER = WA_KNA1-ADRNR.
      IF NOT WA_ADRC-SORT2 IS INITIAL.
      CONCATENATE 'U' WA_ADRC-SORT2 INTO SORT2.
      MOVE SORT2 TO WA_TERRINFO-SORT2.
    MODIFY GT_TERRINFO1 FROM WA_TERRINFO.
      APPEND WA_TERRINFO TO GT_TERRINFO1.
      CLEAR WA_TERRINFO.
      ENDIF.
      CLEAR WA_KNA1.
      CLEAR WA_ADRC.
    ENDLOOP.
    ENDFORM.                    " RETRIEVE_DATA

    Hi
    The code is easy so I don't think you can do nothing, only u can try to limit the reading of KNA1:
    FORM RETRIEVE_DATA .
      CLEAR WA_TERRINFO.
      CLEAR WA_KNA1.
      CLEAR WA_ADRC.
      CLEAR SORT2.
    *To retrieve the territory information from ZPSDSALREP
      SELECT ZZTERRMG
      ZZSALESREP
      NAME1
      ZREP_PROFILE
      ZTEAM
      INTO TABLE GT_TERRINFO
      FROM ZPSDSALREP.
      SORT GT_TERRINFO BY SALESREP.
    *Preparing Corporate ID from KNA1 & ADRC and storing it in SORT2 field
      LOOP AT GT_TERRINFO INTO WA_TERRINFO.
        IF KNA1-KUNNR <> WA_KNA1-KUNNR.
          SELECT SINGLE * FROM KNA1 INTO WA_KNA1
               WHERE KUNNR = WA_TERRINFO-SALESREP.
          IF SY-SUBRC <> 0.
            CLEAR: WA_KNA1, WA_ADRC.
          ELSE.
            SELECT SINGLE * FROM ADRC INTO WA_ADRC
                                     WHERE ADDRNUMBER = WA_KNA1-ADRNR.
            IF SY-SUBRC <> 0. WA_ADRC. ENDIF.
          ENDIF.
        ENDIF.
        IF NOT WA_ADRC-SORT2 IS INITIAL.
          CONCATENATE 'U' WA_ADRC-SORT2 INTO SORT2.
          MOVE SORT2 TO WA_TERRINFO-SORT2.
    * MODIFY GT_TERRINFO1 FROM WA_TERRINFO.
          APPEND WA_TERRINFO TO GT_TERRINFO1.
          CLEAR WA_TERRINFO.
        ENDIF.
      ENDLOOP.
    ENDFORM. " RETRIEVE_DATA
    If program takes many times to upload the data from ZPSDSALREP, you can try to split in sevaral packages:
    SELECT ZZTERRMG ZZSALESREP NAME1 ZREP_PROFILE ZTEAM
      INTO TABLE GT_TERRINFO PACKAGE SIZE <...>
      FROM ZPSDSALREP.
      SORT GT_TERRINFO BY SALESREP.
    *Preparing Corporate ID from KNA1 & ADRC and storing it in SORT2 field
      LOOP AT GT_TERRINFO INTO WA_TERRINFO.
        IF KNA1-KUNNR <> WA_KNA1-KUNNR.
          SELECT SINGLE * FROM KNA1 INTO WA_KNA1
               WHERE KUNNR = WA_TERRINFO-SALESREP.
          IF SY-SUBRC <> 0.
            CLEAR: WA_KNA1, WA_ADRC.
          ELSE.
            SELECT SINGLE * FROM ADRC INTO WA_ADRC
                                     WHERE ADDRNUMBER = WA_KNA1-ADRNR.
            IF SY-SUBRC <> 0. WA_ADRC. ENDIF.
          ENDIF.
        ENDIF.
        IF NOT WA_ADRC-SORT2 IS INITIAL.
          CONCATENATE 'U' WA_ADRC-SORT2 INTO SORT2.
          MOVE SORT2 TO WA_TERRINFO-SORT2.
    * MODIFY GT_TERRINFO1 FROM WA_TERRINFO.
          APPEND WA_TERRINFO TO GT_TERRINFO1.
          CLEAR WA_TERRINFO.
        ENDIF.
      ENDLOOP.
    ENDSELECT.
    Max

  • When setting the split-days to "every 15 minutes," the week and comparison views show incorrect time ranges for the day

    When I change the "split-days" interval time, under Options > Settings, to
    15, or every 15 minutes, the week and comparison views don't show the correct
    time range for the day.
    <P>
    For example, if I click View to display the calendar and then click Week to get
    a weekly view, the time range displayed is from 6:00 a.m.
    to 4:00 p.m. If I click Comparison to get a
    comparison view, the time range displayed is from 12 p.m.
    to 6:45 p.m.
    <P>
    In this example, should both of these views show the same time range, from
    9:00 a.m. to 4:00 p.m.?
    No, the two views will not necessarily show the same time range. The time
    range for the comparison view will start at the beginning prefs time only
    if you have something scheduled (on any day of the week) starting at that
    time. For example, on one of the days during your week of comparison, if you
    create an event that starts at 9:00 a.m. and then open the comparison view, the
    time range displayed will start with 9:00 a.m.
    <P>
    Additionally, view times will expand past the configured settings if events
    span past the time range. That is, if you have an event that spans from
    5:00 p.m. to 8:00 p.m., the event will be reflected in the view, even though
    your time range may be set to go only to 6:00 p.m.

    Umm yes.
    The settings are stored in ''prefs.js'', so you could swap various copies of this file in and out.
    However, the system will load ''prefs.js'', then, if present, ''user.js'' , so you can set up just your changes in ''user.js'' .
    The sort of line you need to look for is like this:
    <code>user_pref("mail.server.server14.check_time", 10);</code>
    You'll need to do some research to identify which of your accounts is which.
    Search for the account's email address:
    <code>user_pref("mail.identity.id10.useremail", "xenos&#64;example.com");</code>
    Use the id number to locate the account number:
    <code>user_pref("mail.account.account29.identities", "id10");</code>
    Use the account number to find the server number:
    <code>user_pref("mail.account.account29.server", "server14");</code>
    Finally, you can then use the server number find the account's time setting:
    <code>user_pref("mail.server.server14.check_time", 10);</code>
    This last entry may not exist, if you have never changed the setting from the default 10 minutes.
    Do be careful with your typing and copy/pasting; if the file fails the syntax parser it will silently fail.
    And make sure Thunderbird is shut down when you do the swap. If it's open, it may overwrite changes, and in any case, it only reads the settings file when it starts up.

  • I recently moved my Aperture Library file to an external hard drive.  Can I now create a vault to be saved on my Time Capsule for the Aperture library on this external hard drive?

    I recently moved my Aperture Library file to an external hard drive.  Can I now create a vault to be saved on my Time Capsule for the Aperture library on this external hard drive?

    One thing to bear in mind, if you are using Time Machine on your Time Capsule and have it set so the TM backup includes your external drive, you will effectively be backing up your Aperture library twice on the same drive, once with Time Machine and once with the vault. This isn't a problem unless you start to run out of space.
    Another thing to note, vaults on network drives used to be flaky (i.e. not really supported) and required workarounds to be able to use them. I'm not sure if this has changed, but I just managed to create a vault on my TC ok.

  • I'm setting up my Time Capsule for the first time and cannot get an internet connection throughWAN connection

    I'm setting up my Time Capsule for the first time and can't get an internet connection via ethernet cord

    So new AC model TC??
    What modem is it? Pure cable modem .. did you power cycle the modem ( OFF for at least 30min..)??
    This is essential to lose the old setup and start afresh. 
    How have you setup the TC?
    Did you try just bridge to existing router? If it doesn't get an IP and you just bought it, possible it is faulty.
    Lots more details.. really important things like did the ethernet connectivity leds go on.. both the TC port and the modem port - front ethernet indicator should light up..

  • How to check the usage of ram and cpu Performance for the particular application like sqlserver ,ms word

    how to check the usage of ram and cpu  Performance for the particular application like sqlserver ,ms word
    ranki

    Hi,
    You can use Performance Monitor and add the required counters.
    Check the below Technet article on Performance Monitor.
    http://technet.microsoft.com/en-us/library/cc749249.aspx
    Below are the steps to monitor the process in Performance Monitor.
    - Go to the Performance Monitor. 
    - Right-click on the graph and select "Add Counters".
    - In the "Available counters" list, open the "Process" section by clicking on the down arrow next to it. Select "% Processor Time" (and any other counter you want).
    - In the "Instances of selected object" list, select the process you want to track. Then click on "Add >>" button. Click on OK.
    Regards,
    Jack
    www.jijitechnologies.com

  • Actual Time bar for the activity duration in Gantt Chart

    Hi all,
    The Actual time bar for the elapsed activity duration in Gantt chart is not appearing. The same is true for all the activities i.e. activities which are not yet confirmed and activities which are partially confirmed.
    Is there any customizing for the same? ( I am getting the bar in IDES, but not in DEV/QAS/PRD )
    Any Help in this regards will be highly appreciated
    Warm regards,
    Srinivas Potluri

    Hai Srinivas
    Got the solution.
    1)For this first check in the project profile of the Hierarchry graphic -
    Time scheduling profile - check the colour patterns which been assigned.
    2)open the project - Cj20N - go to planning board - bar chart - under settings - Planning board assistant - Gantt chart - check the dates display for Project definition , WBS , Acitivity - try to change the colour and check.
    while changing can see - basic date of the acitivity. based on the confirmation can see the bar confirmed activity with respect to basic date. the bar confirmation will show withrespect to duration.
    3) If the bar chart need in daily /hourly - can check in CNE5 . click on the graphics -bar chart - which u will get the bar chart - in this choose the Time Axis - where can select the monthly /weekly/daily /hourly format .
    Award points if clear and got the solution.
    Regards
    PP

  • To have time stamps on the notes captured on serviceticket transaction

    Hi,
    Is there any option to have time stamps on the notes captured on an Opportunity / Quote / Order ..
    especially in serviceticket.
    the requirement is  to tag the notes entered in ST with TIMESTAMP.
    Hope u guys understnd my question .....
    sree

    Hi Sree,
    try the following comands you can use for the convertion of dates to timestamps and viceversa:
    CONVERT DATE dat [TIME tim [DAYLIGHT SAVING TIME dst]]
            INTO TIME STAMP time_stamp TIME ZONE tz.
    CONVERT TIME STAMP time_stamp TIME ZONE tz
            INTO [DATE dat] [TIME tim]
            [DAYLIGHT SAVING TIME dst].
    Best regards,
    Erika

  • I used an ethernet cable between my iMac and Time Capsule for the initial backup.  Now that initial backup is concluded, can I simply unplug the Time Capsule from my computer?

    I used an ethernet cable between my iMac and Time Capsule for the initial backup.  Now that initial backup is concluded, can I assume I can simply unplug the Time Capsule from my computer without any glitches and Time Capsule will then run wirelessly.  Is this assumption correct? 

    can I assume I can simply unplug the Time Capsule from my computer without any glitches and Time Capsule will then run wirelessly.  Is this assumption correct?
    Yes, if the computer will be able to receive a strong wireless signal from the Time Capsule.
    I did not disable wireless.  So I assume the backups are occurring both with the ethernet and wirelessly.
    It is inot possible to have both an "active" Ethernet and "active" wireless signal simultaneously. If an Ethernet connection is established, your computer will default to the Ethernet connection. If the Ethernet cable is unplugged, the computer will revert to the wireless connection.
    I also show 2 wireless networks available through Airport.  Shouldn't there only be one now?
    You have a simultaneous dual band Time Capsule. That means that it will always be providing both a 2.4 GHz and a 5 GHz network.
    I named my new network the same name as the old network.  This enabled all of our devices to continue with their connection without entering the new network and/or passwords; however, I am afraid this may pose problems in the future somehow.  Any input on this issue as well?
    Things should be fine. Devices will connect to the best signal.....either 2.4 GHz or 5 GHz....based on their capabilties and location in relation to the Time Capsule.

Maybe you are looking for

  • Posting Invoice and Payment

    Good day all, Please i would appreciate your ideas regarding this problem:- We have set a Business Partner to "Cash Basic" terms in SAP and set up this Payment Terms in SAP to open Incoming payment when the invoice is created(there is a drop down men

  • HT201240 how do I know if my computer has an optical drive?

    how do I know if my computer has an optical drive?

  • Hide and Seek Partition

    Since installing BootCamp, Windows XP, and Norton Anti-virus on my Mac Pro, one of my disc partitions will not show up on the Mac desktop. It's a Mac partition, on a second internal HD, the HD without Windows. It's one of 4 Mac partitions on that dri

  • Third party integration with Oracle Apps

    Hi friends, I have a dot net application and I would like to integrate that with oracle applications(specifically HR module). Can I do that? Does oracle apps provide any APIs to provide this third party integration with 3rd party software we have? ca

  • I'm a newer in using Datasocket,now I want to send data from DAQ(6052E) to another computer B,

    I have two types data,so Datasocket write string vector.vi and Datasocket write double vector.vi are used in my application,but in computer B my programm always reports "Not permitted to creat new item (0*80004005) ",Datasocket read double vector can