In the below queries which gives better performance

Hi All,
In the below two queries which gives better performance.
Requirement is I need to find if all the 3 score columns are null then I need to assign -ve value -9999 else some +ve value 2
1)
select case when count(CUST_score1)+count(CUST_score2)+count(CUST_score3)=0 then -111111'
else 11 end
from
customer
where subscriber_id=1050
and cust_system_code='1882484'
2)
select case whenCUST_score1 is null and CUST_score2 is null and CUST_score3 is null then '-9999'
else '11' end
from
customer
where subscriber_id=1050
and cust_system_code='1882484'
Please help, because we have more data in table customer so I need to confirm which is better.
Regards,
Chanda

user546757 wrote:
Hi All,
In the below two queries which gives better performance.
Requirement is I need to find if all the 3 score columns are null then I need to assign -ve value -9999 else some +ve value 2
1)
select case when count(CUST_score1)+count(CUST_score2)+count(CUST_score3)=0 then -111111'
else 11 end
from
customer
where subscriber_id=1050
and cust_system_code='1882484'
2)
select case whenCUST_score1 is null and CUST_score2 is null and CUST_score3 is null then '-9999'
else '11' end
from
customer
where subscriber_id=1050
and cust_system_code='1882484'
Please help, because we have more data in table customer so I need to confirm which is better.
Regards,
ChandaThe two statements aren't equivalent. If you know that your where condition is restricting to a single row then there is no point in doing a count as that will introduce an additional aggregate function that isn't required for a single row. If you are dealing with multiple rows from the where condition then the second query will return multiple rows whereas the first query returns 1 row, so they don't do the same thing anyway.

Similar Messages

  • Which gives better performance in webi using display attr or nav attr -

    Hello all,
    We are using the Bex query as the datasource for our universes and the end user is using the Web Intelligence as the reporting tool (rich client and infoview) we have employee as one of the infoobject in the cube.
    Now employee has a lot of attributes which the user wants to use for reporting (delivered employee infoobject has quite a few attr), we are making some of them as Nav attr like Org unit since they are time dependent and the end user will need to put in the key date to bring the employees from right org unit.
    We have enhanced the employee attr to have the all address information of the employee (Z fileds) and we have made those nav attr in RSd1.
    So my question is should we make the address Z fields as nav attr in cube as well and use those objects in webi or can we use the objects in webi which fall under employee like details (green icons) rather than separate object.
    Please let me know what will keep better performance and what is the best practice.
    Thanks you in advance and appreciate everyone's help
    Edited by: Cathy on Jun 16, 2011 7:35 AM

    Hi,
    BEx Query Design Recommendations:
    "Reduce Usage of Navigational Attributes as much as possible Also, if simply displaying a Characteristicu2019s Attribute, DO NOT use the Navigational Attribute u2013 rather utilize the Characteristic Attribute for display in the report  This avoids unneeded JOINS, and also reduces total number of rows transferred to WebI"
    Source : SAP Document
    Thanks,
    Amit

  • Which gives better performance

    I have to two arraylists. I have to sort one based on the other. The way i did was to iterate one over the other. Or may be I have to load one arrylist into a hashmap and then do hashmap.get to get to the individual items?
    MR

    I find this an interesting problem so I had a go at it just to understand what one has to do -
    import java.util.*;
    public class Fred
        public static void main(String[] args)
            // Create the reference
            final ArrayList<Integer> reference = new ArrayList<Integer>();
            for (int index = 0; index < 100; index++)
                reference.add(index);
            Collections.shuffle(reference);
            // Now some data to work with
            final Random random = new Random();
            final ArrayList<Integer> data = new ArrayList<Integer>();
            for (int index = 0; index < 1000; index++)
                data.add(random.nextInt(100));
            // Build the map needed in the sort comparator
            final HashMap<Integer,Integer> sortHelper = new HashMap<Integer,Integer>();
            for (int index = 0; index < reference.size(); index++)
                sortHelper.put(reference.get(index), index);
            // The 'indirect' comparator
            final Comparator<Integer> comparator = new Comparator<Integer>()
                public int compare(Integer left, Integer right)
                    Integer leftIndex = sortHelper.get(left);
                    Integer rightIndex = sortHelper.get(right);
                    if (leftIndex == null)
                        return 1;
                    else
                        return leftIndex.compareTo(rightIndex);
            // Now sort
            Collections.sort(data, comparator);
            // Test the result - how?
    }So how does one test the result?

  • HT201250 Is there a way to change the intervals at which Time Machine performs backups (e.g., weekly instead of hourly or daily) past 24 hours, daily for the past month, and weekly for everything older...

    Is there a way to change the intervals at which Time Machine performs backups (e.g., weekly instead of hourly or daily) past 24 hours, daily for the past month, and weekly for everything older...

    You can edit the interval in Console or install a Pref Pane
    called TimeMachineScheduler (Leopard or higher) free from:
    http://www.klieme.com/TimeMachineScheduler.html
    Good luck, Tom

  • Is it better for your battery if you let it run down all the way and then charge it? Or to charge it whenever you have the opportunity?  Which is better for the life of the battery?

    I was wondering it the life of the battery would last longer if you let the battery run down all the way and then charge it? Or to charge it whenever you have the opportunity even if it doesn't have a low battery?  Which is better for the life of the battery and prolong the life of the battery?

    I've had a iPhone 4s since March 2012, and it's battery is pretty useless now.  I was using the app Battery Doctor (Battery Saver, Battery Life) by Beijing Kingsoft Internet Security software, which encourages the user to charge more often, whenever battery life drops below 100% full and greater than 20% full, and gives ratings according to the number of full, partial &amp; overcharges done, but I'm concerned that charging like that actually results in worse battery life??
    I now have an new iPhone 5 and don't want the battery to only last as short as the last one did
    Any advice/comments please

  • Which provides better performance?

    I have a ATI HD3200 video built-in to my motherboard.  I also have an old Nvidia 6600 GT 128 MB videocard.  Which will give me better performance? 
    I have the desktop effects enabled in KDE 4.2 and I also like to play the occasional 3D game.

    For desktop use with compositing i'd agree with Draje.  For games, you can easily enough benchmark each card and see which is best.  If you go this route I strongly recommend using a lighter weight wm just when you play games.  I know my own comp went up 40fps or so when playing nexuiz under fluxbox as opposed to KDE 3.5.x.

  • Songs with the same title, which is better?

    Song titles aren't always unique to one song, there can be many different ones with the same title. This thread is for those kinds of songs. Post them and tell us which is better to you, and why do you think that is.
    For example, I think this song:
    Is better than this one:
    Because I'm a bit more partial to Pulp and Britpop. But I still think Tom Jones' song is great nonetheless.
    Go ahead and give us your opinion!

    For me, I chose two songs called "Living Well; one by American shoegazers Velocity Girl, the other by Texas slowcore group Bedhead. Although I like both, I prefer the Pavement-ish melancholy of the Bedhead song to the sugary rush of the Velocity Girl song. spotify:track:5BrtSevKCfYWuZ6WnBv9Vcspotify:track:1Fu9pnUNBbyTUOsA5ZwsMd

  • Find the Column Name which gives Invalid Number Error

    Hi,
    There are about 150 columns in a table and data to this table is from a external source like flat file. when these data are loaded to the table for a particular column it gives Invalid Number Error. So need to find for Which Numeric Column a String Value is about to be inserted.
    since we are sure not whether the proper Values are coming from Source in Front End we pass the Value within ' quotes.
    So how do we get the Column for which the error is raised :-)

    If you are using SQL*Loader, the log will tell you which row and column has the error.
    Otherwise you may need to code your own debugging statements.

  • Which give higher performance  TopLink with CMP or session facade

    In our project we plan to use TopLink which one give higher performance
    TopLink with CMP
    Or TopLink with session façade
    thanks in advance

    Which give higher performance TopLink with CMP or session Bean

  • My ITunes works perfectly except for the ITunes Store which gives me the following message "I Tunes could not connect to the I Tunes Store. An unknown error ocurred (-3221)

    Whenever I try to connect to the I Tunes Store, I get the following message " I Tunes could not connect to the I Tunes Store. An unknown error occcured (-3221).
    Make sure your network connection is active and try again.
    But my network connection is active.
    Help!

    Hi davwatto thanks for taking the time to reply.
    ok, so tried to open my safari which was version 5.1.7 and i received the error message:
    safari can't connect to the server
    safari can't open the page http://www.apple.com/startpage/ because safari can't connect to the server www.apple.com
    The same error occurred with whatever site I tried to access, so I uninstalled Safari, then reinstalled version 3.2.3 and this time I got the error message:
    The same error message occurred with any website I tried to access. I am able to access all websites including banking etc on IE and firefox.
    Safari can’t open the page.
    Safari can’t open the page “http://www.apple.com/startpage/”. The error was: “unknown error” (kCFErrorDomainWinSock:10013) Please choose Report Bugs to Apple from the Help menu, note the error number, and describe what you did before you saw this message.
    Not sure how to check the logs for itunes though
    If you have any idea how to fix this issue that would be great as im at a total loss.
    Thanks

  • Can any one validate the below queries related to temp tablespace

    For Temporary Tablespace Free and Used Space Information, I am using the following query
    SELECT fs.tablespace_name tspace,
    sum(fs.bytes)/(1024*1024) tot_ts_size_MB,
    sum(df.bytes_free)/(1024*1024) free_ts_size_MB,
    sum(df.bytes_used)/(1024*1024) used_ts_size_MB
    FROM dba_temp_files fs,
    (select tablespace_name, bytes_free, bytes_used from v$temp_space_header) df
    WHERE fs.tablespace_name(+) = df.tablespace_name
    GROUP BY fs.tablespace_name;
    For getting how much space is being used by current users, I am using the following query
    SELECT b.tablespace tablespace_name,
    a.sid sid,
    a.username username,
    (b.blocks * c.value)/(1024*1024) Current_Usage
    FROM v$session a, v$sort_usage b,
    (select value from v$parameter where name = 'db_block_size') c
    WHERE a.saddr = b.session_addr;
    Can any one validate, that above queries are right or not?

    Hi,
    1.for first query i think u can also use only v$temp_Space_header to find out
    the required details by
    SELECT tablespace_name, SUM(bytes_used)/1024/1024 "Tot Used Space in MB",
    SUM(bytes_free)/1024/1024 "Tot Free Space in MB"
    FROM V$temp_space_header
    GROUP BY tablespace_name;
    2.http://www.dbazine.com/oracle/or-articles/weeg3
    Thanks
    Kuljeet

  • Suddenly i cannot see the bar on the bottom of the email page which gives the options of deleting, replying, etc.

    Please help, its annoying

    Are you using any DPI related settings in Windows to increases the font size?
    * Control Panel > Personalization : Adjust font size (DPI) or in Window Color and Appearance
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Hi,i want to sign agreement about iTunes but i couldnt find agreement button at the below.Can you give info about the button that i have to sign in?

    Hello!

    Thanks for answering so quickly
    So then I have a choice to select categories:
    ct a support category:
    Account Management
    Connecting & Downloading
    Purchases, Billing & Redemption
    iTunes Cards and Codes
    Other iTunes Store Topics
    I tried account managemetn, but there still seemed to be no one to help me with my problem, it just gave me options for changing my account.  What do you think I should do next?

  • Which is better for performance Azure SQL Database or SQL Server in Azure VM?

    Hi,
    We are building an ASP.NET app that will be running on Microsoft Cloud which I think is the new name for Windows Azure. We're expecting this app to have many simultaneous users and want to make sure that we provide excellent performance to end users.
    Here are our main concerns/desires:
    Performance is paramount. Fast response times are very very important
    We want to have as little to do with platform maintenance as possible e.g. managing OS or SQL Server updates, etc.
    We are trying to use "out-of-the-box" standard features.
    With that said, which option would give us the best possible database performance: a SQL Server instance running in a VM on Azure or SQL Server Database as a fully managed service?
    Thanks, Sam

    hello,
    SQL Database using shared resources on the Microsft data centre. Microsoft balance the resource usage of SQL Database so that no one application continuously dominates any resource.You can try the 
    Premium Preview
    for Windows Azure SQL Database which offers better performance by guaranteeing a fixed amount of dedicated resources for a database.
    If you using SQL Server instance running in a VM, you control the operating system and database configuration. And the
    performance of the database depends on many factors such as the size of a virtual machine, and the configuration of the data disks.
    Reference:
    Choosing between SQL Server in Windows Azure VM & Windows Azure SQL Database
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here. 
    Fanny Liu
    TechNet Community Support

  • Advice Needed... which is better?

    Hello...  I am not a computer 'genius", but not a complete "computer idiot' either.  I have a question, and then I will give my reasoning, because maybe it matters in the decision.
    Which is better, a PC (Gateway) with 6GB Ram, i5 processor, 1.5TB HD  or an Imac 4GB Ram, i3 processor, 1TB HD??
    Basically, I have had a Dell 2GB Ram desktop for 7 years, which suited me fine. I ran CS3 on it with no problems.  I recently had a virus, and had to swipe my computer, and when I re-installed Adobe, my Premiere Pro will no longer allow me to edit properly (audio plays fine, while video lags and skips around during viewing).  I know it is time to get a new computer either way, and a few friends have told me that I really shouldnt be running Premiere Pro on 2GB of ram, and suggested at least 6GB.
    I found a Gateway for $650 on bestbuy site with the above specs... but then someone I know, told me I would be better with an Imac with the specs above.  Is that possible that a 4GB mac would run better than the 6GB PC?
    also..  will CS3 work on the Windows 7 PC, but if I get Mac system I will be using CS5.
    I use Photoshop, and Premier Pro for simple music video editing (5-6min videos).  I do not do anything major..but want to at least be able to view what I am doing.
    thanks

    While I don't agree that Macs are as inferior as some here claim, for your purposes an i5 iMac is certainly inadequate. The i7 quad core iMac is something else again; it can take up to 16GB of RAM, which is plenty for most applications. The particular i7 CPU in the iMac is also quite capable with a number of performance enhancing technologies on board. The big problem with the iMac, though, is that it comes with only one internal HDD; there is an added SSD option, but in my opinion it's still too expensive. For video you should have at least two internal drives and preferable three or four, as others here have said. External drives are generally slower, even if you use a FireWire 800 port. Sometime this year Apple may add a Thunderbolt port to the iMac, as they have to the MacBook Pro. This will be a game changer for external media, with unheard of flexibility in connectivity and the performance of Fiber Chanel at an affordable price. There are already external RAIDs coming to market with Thunderbolt connections. However, there is no date certain for such an iMac refresh.
    For even semi-serious video you need some heavy iron, whether Mac or PC. There are some great Mac Pros available now with up to 12 cores on two 6 core Intel Westmere processors; however, even though I am a Mac fan, I'm sure you can build or get a BTO Windows PC with comparable specs for less. I suggest a minimum of four modern CPU cores to handle multi-threading and multi-tasking chores. At least two fast internal hard drives, four is preferable. And, of course, the more RAM the better, though this too will raise the price. You may not get the maximum RAM right away; the important thing is that the motherboard be able to support substantial RAM upgrades so that you can grow into it.
    The challenge, even with PCs, is that a number of core technologies are changing right now. SixGb/s hard drives are becoming available but it would take a high-end and relatively new motherboard to support them properly. So, besides the question of which computer to get, you have to consider when to get it. If you need it right now, that narrows your choices somewhat because you cannot wait for these new technologies to come on line.
    The most important thing to consider, though, is not to cheap out. Presumably you will be doing some real work on it, so think of this computer as an investment in your own future. Buy the most computer you can afford and a little bit more. Oh, and there is a new Version of Final Cut Pro coming out soon that will be Intel only and 64 bit capable, so Apple is moving ahead on this front, too. Remember, not all of Adobe's CS apps are 64 bit yet either. It's just one more technology in transition.
    One point I will concede, however, is that Windows has better video drivers than OS X. Even on a Mac, running Windows in Boot Camp delivers better video frame rates than the Mac versions of the same apps running in OS X. So, for reasons of cost and better video support, a Windows PC is probably the way to go. PCs also have it over Macs in the number of options available. If you are not a techie yourself, I agree as well that it is probably a good idea to have someone who is built it custom for you. Of course, with a custom PC you won't get the kind of warrantee that comes from Dell or Apple, but the person who builds it for you will probably be able to service it as well.
    Ultimately, of course, your budget is likely to govern the kind of PC you get more than your preferred specs. But even with Windows PCs you get what you pay for. A cheap PC is just that, a cheap PC. Inexpensive PCs are affordable because they use inferior components. Keep that in mind.

Maybe you are looking for

  • HT204053 on my iphone 3gs, I tap settings, icloud and the account is incorrect.  Please help!

    On my iphone 3GS, I tap Settings, iCloud. The account is incorrect and light grey, which will not allow me to edit the account.  Other problems stemming from this have to do with storage and photo stream.

  • Invoice idoc Error

    Hi Guys We have recived Invoice Idoc from External system It is in 51 Status The errorhas Below message Document type 49 and VAT indicator don't fit!!! Can any body  help how to process this idoc Thanks in advance SAP MM

  • How well can you work on docs in word on iPad 2

    Thinking about buying an iPad 2, and wondering how it is for working on docs in Word (generated on my mac laptop) when away from the office?

  • Using gnu's gcc instead of solaris cc

    To Anyone I would like to use gnu's development tools to compile the oracle demos since oracle's cc isn't installed and won't be installed anytime soon. How do i modify to demo_rdbms.mk to use the gnu tools? Archaned null

  • Best book on Logic?

    Hi, all-- Just picked up Logic Studio and was wondering if anyone had any recommendations on some good manuals/books out there for learning the ropes. The videos are great, but they're so **** expensive - any tips?