Does the entire query always have to execute?

We have a large (100 line) query that is used for detecting bad data. The query looks like
select * from table where
clause1 is true -- for example, start_date is null
OR clause2 is true -- end_date is null
OR clause3 is true -- start_year < 1970
. 100 more clauses
It looks to me like every clause is being evaluated for every row even though the first clause that evaluates to true is enough to select the row. I believe every clause is being evaluated because we often get failures from the toDate() function for columns that are null and there are null checks before the toDate() call.
Is it possible to make the query evaluation end "early"?
Thanks for any help or advice,
-=beeky

Hi,
As Justin said, Oracle will quit evaluating your WHERE clause as soon as it finds a condition that is TRUE. If you have evidence that it is evaluating some condition even though an earlier condition is TRUE, then it must be evaluating the conditions in a different order. Make sure you have up-to-date statistics and appropriate indexes, so the optimizer can make an intelligent choice about which conditions to evaluate first.
You can force the order by putting the conditions in a CASE statement.
For example, say you're now doing this:
select  *
from    table_x
where   start_date is null
   OR   end_date is null
   OR   start_year < 1970
;If you know that the third condition (start_year < 1970) is the most restrictive, and therefore you want to make sure it is done first, then you can re-write the query like this:
select  *
from    table_x
where   CASE
            WHEN  start_year < 1970   THEN 1
            WHEN  start_date is null  THEN 1
            WHEN  end_date is null    THEN 1
                                      ELSE 0
        END = 1
;

Similar Messages

  • Does the Livecache SID always have to be LCA ?

    We have installed APO Livecache with SID other than LCA and I'm being told that it has to be LCA always ?
    Is this true ?
    If it is, why is the install tool gives the option to pick a SID ?
    Or is there a config setting in SAP to change this default setting ?
    Thank you

    Hello Ravi,
    Please check the SAP Note No. 829963.
    Please review the documents at service.sap.com/scm ->mySAP SCM Technology:
    "mySAP SCM Technology" & "liveCache overview " .
    In case of a new installation of the liveCache/LCA, you have to create the connections LCA/LDA/LEA 
    as described in the  installation documentation for the SAP liveCache technology - using    
    Transaction LC10. For example, review the document at                                                    
    service.sap.com/instguides -> mySAP Business Suite Applications->
    mySAP SCM -> Using SAP SCM 5.0 Server->
    "Installation - SAP liveCache Technology …" in the section
    "Common Post-Installation Activities" - "Setting Up the Connection to the liveCache Instance".
    Please review the information at service.sap.com/liveCache ->Release Information ->
       SAP LC/LCAPPS 5.0
    You could  run /n/sapapo/om13 -> checks & see the status for LCA & LDA  & LEA 
    connections. If the connection is marked by the red  semaphore => check errors in /nsm21.  
    You could run the test connection for LCA & LDA & LEA in db59 transaction and review the results.   
    Please open the OSS ticket to the component 'BC-DB-LVC' or 'BC-DB-LCA' if you have further
    questions on this issue.
    Thank you and best regards, Natalia Khlopina

  • Does the Class Word always have to be the last word in column name? What about Units?

    Sometimes we are required to store both a US and a metric column in the same table.  Is it ok to use the unit type as a suffix to the class word like AreaSqMi and AreaSqkm in the case of watersheds which cross both the US and Canadian borders?
    Before everyone jumps on me let me explain.  The software environment we are using is from ESRI's (Geographic Information System) for displaying maps.  The popups for displaying attribute data can only display existing columns so no derived columns.

    Use columns standarts
    http://www.codeproject.com/Articles/22947/A-Naming-Scheme-for-Database-Tables-and-Fields
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Why does the top button always brake why as my screen decided to pop off why is the back of my case bending when I have never dropped it why dose this shity phone keep sending text messages as picture messages this is the worst phone av ever had!!

    Why does the top button always brake why as my screen decided to pop off why is the back of my case bending when I have never dropped it why dose this shity phone keep sending text messages as picture messages this is the worst phone av ever had!!

    I know a lot of people with iphone 5 and have never heard them complain about top button always brake and screen that decides to pop off or the back of their case is bending.
    That sounds like a phone that has been dropped a numerous times.

  • Does the 2012 Mac Pro have 2 CPU socket always? If I buy one CPU setup, can I upgrade it later to 2 CPU?

    Does the 2012 Mac Pro have 2 CPU socket always? If I buy one CPU setup, can I upgrade it later to 2 CPU?

    If money is no object, OWC will swap 2010 or 2012 Processor shelves for whatever you want as long as you have a working Mac Pro 5,1 shelf to swap and a ton of money.
    http://eshop.macsales.com/shop/turnkey/MacPro/2010_Xeon_Processor
    The basic charge is US$949 starting from the 2.8 Quad.
    • to move up to the 3.33 hex add US$550 to the base price for a total of about US$1500.
    • to move to dual Quads or dual hex ADD $1470 to $4250 to the base price.

  • How does the follwoing query work?

    Want to know how does the follwoign query work??
    For every row in flsp
    the subquery is going to get executed or is it just one time execution of the subquery??
    UPDATE flsp
    SET (DURATION, sdr, inr) =
    (SELECT SUM (tot_charges), SUM (tot_charges_sdr),
    SUM (tot_duration)
    FROM t
    WHERE t.sender_pmn = flsp.sender_pmn
    AND t.recipient_pmn = flsp.recipient_pmn
    AND t.imsi_min = flsp.imsi
    AND TRUNC (t.call_date) = TRUNC (flsp.call_date)
    AND t.call_type = flsp.call_type
    AND t.service_code = flsp.service_code
    GROUP BY sender_pmn,
    recipient_pmn,
    imsi_min,
    TRUNC (t.call_date),
    call_type);
    Edited by: user8731258 on Sep 27, 2010 2:54 AM

    user8731258 wrote:
    the global session table is going to hold data for one sessions where as the table flsp is going to hold data for the entire day.During a session there could be say 10 thousand records.Sounds like a bad idea.
    user8731258 wrote:
    ANd there are goign to aroung 100 such sessions.Continues to sound bad.
    user8731258 wrote:
    I have to update the flsp continually.Just got worse.
    user8731258 wrote:
    How do i make this fetch fast??This still makes no sense to me.
    Why are you moving all this data around and utilizing temporary tables instead of directly querying the underlying data on an 'as needed' basis?
    I think you have undertaken entirely the wrong technical approach to whatever business problem you are attempting to solve (though it's hard to say for sure as we still know little of what you've got going on).
    So back to step number one like i asked before.
    Can you explain (from the very beginning) WHY you are attempting this type of set up?

  • HT2486 birthday are not saving in my contacts? What am I doing wrong.  I always have put in birthday before with no problems

    Birthday are not saving in some of my contacts? What am I doing wrong.  I always have put in birthday before with no problems.  Some contacts it works and others do not?  help me.

    Arnis and Jeff,
    Thank you both very much for your assistance.  I was able to figure out why the Adobe Application Manager kept failing on installing the patches.  Idiot me didn't unzip them first.  Once I unzipped the patch files, the installer worked fine.  Both patches are now successfully installed; my FM version is now 12.0.2..
    To answer some of your questions:
    Yes, I have administrator privileges on my PC.
    Yes, I had all of the files in the book opened when I generated and/or updated the LOR file.  So that was not the issue.
    With the patches installed, I opened a book and all of its files.  I updated the LOR and all works fine – it gives me all of the Imported Graphic references. So there must have been an issue with that release of FM12 (12.0.0.329), which was fixed with the patches.
    Again, thank you both for your help!
    Best regards,
    Beverly

  • How much ram does the iPhone 6 Plus have?

    How much ram does the iPhone 6 Plus have?

    This is what I got on the info....
    IPhone’s RAM has been very little, even pitiful compared to other flagships. Now 1GB RAM is still the standard configuration for the current iPhone 5 / 5s and iPhone 6.
    Is Apple’s system optimization can really never need to increase the memory capacity? Obviously the answer is no. Recently, GSMArena published a sheet of iPhone 6 Plus detailed specifications, we can clearly see the “2GB RAM” in the memory list.
    GSMArena also posted the benchmark score for iPhone 6 yesterday, but we seen that A8 GPU not seem to improve a lot in the processing capability compared to A7 – only increased 4.65%.
    Apple usually not declare the detailed hardware parameters of their products, because those indicators not have too many advantages compared to other similar products, and even looks a bit shabby. But for Apple, these are not the most important, the company always focusing on the overall performance and user experience of the product. iPhone 6 Plus is the largest ever. Apple has said the iPhone 6 Plus screen reached 1080P in the event, as a larger screen means more resource consumption, and the processor needs to handle higher pixel image, so increasing RAM is the best choice to enhance stability and performance.
    So based on the above evidence and our speculate, iPhone 6 is indeed possible with 2GB RAM. If in doubt, all we could wait is finding out the truth after dismantling the device. Course this just may be a beginning, we also expect Apple can give more memory for the upcoming next-generation iPad and iPad Mini.

  • Why does the snmpcoll process always start up even if SNMP Statistics Collection is turned off?

    Why does the snmpcoll process always start up even if SNMP
    Statistics Collection is turned off?
    <P>
    The SNMP Statistics Collection field on the Server Status|SNMP
    Subagent Configuration form affects only the SNMP subagent, which is a separate entity from
    the collector process (snmpcoll). Currently, snmpcoll does not look
    at the SNMP configuration data when it starts up. It is started by
    the dispatcher and terminates when the dispatcher terminates. Many
    of the statistics are supposed to reflect cumulative values recorded since MTA
    initialization, such as the total number of messages sent and received.
    As a convenience, the collector process collects information in the
    background even while the SNMP subagent is turned off; this way,
    the values are available when the SNMP subagent is configured and
    turned on.

    Collections fall off on the Date of First Deliquency 7-7.5 years later; that is supposed to be reported as the first time you went late (1-30 days) on the OC (original creditor) in the chain of events leading up to it's being farmed out for collection as I underestand it. DOFD though sometimes doesn't get reported right, and by default it will be the date the collection is added to the bureaus. As an example I have an awkward collection (not sure how I got it looking at the payment history thought I'd cancelled that account but TWC billing apparently didn't think so) which I went late on in 2009, but didn't get farmed out till late 2010.  The DOFD is 6/09 looking at it, and it's expected to come off according to the bureaus 6/16 as a result. Different negatives have their own rules though.

  • Why does the iphone 5 always display the wrong time

    why does the iphone 5 always display the wrong time

    I had similar problem. My iPhone was always about 3 minutes faster than the correct time here in the UK which I found to be very irritating. It just came to a head because here in the UK we have just changed from British Summer Time back to standard GMT. This actually worked automatically except that the iPhone time still showed it to be about 3 minutes faster than GMT. However I have now cured the problem (almost) by going to
         Settings/General/ Date & Time/ and then selected the "Set Automatically" button.
    The clock then immediately jumped back 3 minutes and now the iPhone time is only about 10 seconds slow which is good enough for me.

  • Why does the App Store always crash

    Why does the app store always crash when I go to use the app genius on my ipod touch, it does it everytime. It even does it ocasionaly when I search for apps. Whats going on Apple. Please look into this or tell me how to turn genius off if thats what is causing the crashes, I can't find how to turn it off in the settings.

    The most usual explanation would be that you need to update or you have to many things taking up your memory

  • Does the iPad mini GSM have LTE

    does the iPad mini GSM have LTE, i have one, got 4G sim card, but, never worked, always shows 3G

    Yes. See:
    http://support.apple.com/kb/SP661
    Scroll down to "Wireless and Cellular"
    Are you in the US or another country? I believe LTE is not available outside of North America. See:
    http://appleinsider.com/articles/12/03/08/new_ipad_4g_lte_incompatible_with_netw orks_outside_north_america

  • Does The iPhone 4 Still Have The Reception Issue

    hey guys i wanna know does the iphone 4 still have the "Death Grip" which is the reception issue (antenna issue) with iphone 4 when u hold ur hand (or fingers) near the antennas and the reception goes down to like 1 bar (n sometimes makes it go to no service).
    i think someone said they have made newer models of the iphone 4 what have fixed it but i am not 100% sure
    have they fixed it if i buy an iphone 4 now or does it still have the reception issue
    here is what it is if u dont know what the reception issue is : http://www.youtube.com/watch?v=-ixIHyEPO5g

    My blackberry still has the reception / antenna issue. And always has. In fact, it is so bad that I can terminate the connection if I hold the phone with my head and shoulder.
    My iPhone 4 (not s) on the other hand has never been a problem for me.
    A lot of noise—not much benefit. However Apple did apply new engineering to the problem—which is great!
    -Alan

  • HT1365 Hi can anyone help with this issue regarding my wireless magic mouse? When im on google chrome and scrolling down the page i always have youtube running in the background but the audio cuts/spits/pops can anyone help me with this?

    Hi can anyone help with this issue regarding my wireless magic mouse? When im on google chrome and scrolling down the page i always have youtube running in the background but the audio cuts/spits/pops can anyone help me with this?

    The figures you mention only make sense on your intranet.  Are you still using the same wireless router.  The verizon one is somewhat limited as far as max wireless-n performace.  For one thing it only has a 2.4 radio.   I like many people who wanted wireless-n performance before they even added a wireless-n gigabit router, have my own handling my wireless-n network.

  • Why does the iPad Mini not have music play count?

    I bought an iPad Mini and also have a macbook. I had listened to various music on my iPad Mini the other day, however when I connected the iPad Mini to the Macbook and iTunes via the lightning connector to sync, it synced the ratings I gave the songs I listened to on the mini, but no play count, as if I had not listened to anything. I hope there is something I can do about this as I often look at my play count!!

    Katrina UK
    It should work work but these kind of bugs pop up between updates, both hardware and software. Try closing all apps in the recently used list on the iPad. Double tap the Home button, tap and hold one of the icons at the bottom till they wiggle then tap the to close them. Tap the Home button to get back to the Home screen then hold the sleep button till you see the slide to power off message. Once it has powered down completely hold the Sleep button till the Apple icon appears.
    tomyiiii
    Re: Why does the iPad Mini not have music play count? 
    Nov 18, 2012 11:34 AM (in response to Katrina UK)
    Does it even really matter...?
    Many people including myself rely on playcounts to control smart playlist to manage large libraries. Smart playlists can be created to show your most or least played tracks and used more or less as your favorites or other uses. Along with playcounts the date is transferred so to keep a fresh list of music on my smaller iPods a smart playlist set to songs not played in the last month keeps some fresh tunes on it.
    Playcounts are also used to manage Podcasts in iTunes to delete older episode. Bookmarks, which can also be effected by this, can mess up audiobooks, movies and podcast playback between different devices. So yes, it does matter.

Maybe you are looking for

  • Firefox always opens a new window with ad.yieldmanager

    As soon as i click on an image or other views on a website firefox opens a new tab with adyieldmanager and i cant get rid of it.

  • Simple stub not compiling?

    I can't see anything wrong with this but I am getting errors. import mpt.*; import java.io.IOException; public class Program2 extends Thread public Program2() public void run() public void test() throws IOException Navigator nav = new BlockNavigator(

  • "Remove Panel" in Application Builder?

    Hi, I don't really understand the purpose of the Remove Panel feature in the vi settings tab of app builder. It says if you are dynamically loading vi's, then you must set this to "no", which I have found out your app will not work if you don't do th

  • CIN G/L Account

    Experts, can anybody let me know how many G/L accounts are required to be created in CIN for excise. Many thanx

  • Service center not return my phone.

    Hi and Welcome to the Community! To set your expectation about participation in this forum, please see this "sticky" post, along with the threads to which it links, for helpful information to guide you as you proceed:http://supportforums.blackberry.c