Which query will work fast

Hi,
Can anybody please suggest which query will work fast
distinct role_cd is 1,2,3,4 and null in product table
select * from product
where nvl(role_cd,'4') not in '4'
select * from product
where role_cd in('1','2','3')
I have 13 millions record in this table and there is no index on role_cd

I tried this (11gR2) and get below, but still not sure if it is safe to say that the second one is better:
create table product (role_cd char(2), id number);
begin
dbms_stats.set_table_stats( user, 'PRODUCT', numrows => 13000000 );
end;
explain plan for 
select * from product where nvl(role_cd,'4') not in '4';
Plan hash value: 427209646
| Id  | Operation         | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |         |   650K|    10M|   319  (91)| 00:00:04 |
|*  1 |  TABLE ACCESS FULL| PRODUCT |   650K|    10M|   319  (91)| 00:00:04 |
Predicate Information (identified by operation id):
   1 - filter(NVL("ROLE_CD",'4')<>'4')
explain plan for 
select * from product where role_cd in('1','2','3');
Plan hash value: 427209646
| Id  | Operation         | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |         |   130K|  2158K|   287  (90)| 00:00:04 |
|*  1 |  TABLE ACCESS FULL| PRODUCT |   130K|  2158K|   287  (90)| 00:00:04 |
Predicate Information (identified by operation id):
   1 - filter("ROLE_CD"='1' OR "ROLE_CD"='2' OR "ROLE_CD"='3')

Similar Messages

  • Which query will run faster

    Hi,
    I have following two tables:
    SQL> desc customers
    Name Null? Type
    ID NOT NULL NUMBER
    NAME VARCHAR2(20)
    SQL> desc orders
    Name Null? Type
    CUST_ID NUMBER
    ARTICLE_NR VARCHAR2(20)
    PRICE NUMBER(5,2)
    I want to find each customer's order with the highest price along with its respective article number and the customer's name.
    Please let me know, which of the following query will work fast and why:
    SELECT c.NAME, o.article_nr, o.price
    FROM customers c,
    (SELECT cust_id, article_nr, price,
    ROW_NUMBER () OVER (PARTITION BY cust_id ORDER BY price DESC)
    r
    FROM orders) o
    WHERE o.r = 1 AND c.ID = o.cust_id
    SELECT NAME, article_nr, price
    FROM orders o, customers c
    WHERE c.ID = o.cust_id
    AND (o.cust_id, price) IN (SELECT cust_id, MAX (price)
    FROM orders
    GROUP BY cust_id);
    Thanks.

    Your second version is selecting twice from the same table (orders). The first version needs only one read over this table. So there is a good chance that the first version is faster than the second.
    However there is always a possibility depending on indexes etc. that it is otherwise.

  • HT1665 I have the iPhone 4S and would like to purchase docking device6. I have the Otter Box Camo case and would like to know which dock will work with the case ON. Thank you.

    I have the iPhone 4S and would like to purchase a docking device.  I have the Otter Box Camo case and would like to know which dock will work with the
    case ON.   Thank you.

    it might be better to contact otterbox to find out from them what they made it compatible with. 

  • I have a macbook pro 13" early 2011 version and what to install windows 7 on it via bootcamp but not sure that whether to install x64 or x86 version? which one will work better

    i have a macbook pro 13" early 2011 version and what to install windows 7 on it via bootcamp but not sure that whether to install x64 or x86 version? which one will work better

    There is no need for anyone to use 32-bit version anymore.
    Retail comes with both. Or you can save on just buying 64-bit System Builder disc.
    Better support for today's hardware with larger video graphic memory and systems.
    Better memory management.

  • I am looking into Lightroom (Creative Cloud) to allow a Team Member access my Catalog to keyword search which images will work for our Social Media platforms.

    I am looking at LR Creative Cloud to allow a Team Member access my catalog so she can keyword search which images will work for our social media campaigns. My catalog has both personal and business images (which are in separate folders), however, I only want them to access the business images. What is the best way to do this?
    and a second question as I am new to the Cloud LR product. I am assuming that my images still stay on my external drive...how am I or her able to view these images if I am out of town on another computer?

    My catalog has both personal and business images (which are in separate folders), however, I only want them to access the business images. What is the best way to do this?
    I think the only way in Lightroom to make this happen is to use two catalogs, one for business and one for personal, and then prevent access to the personal catalog via putting it on a disk or location that your team member does not have access to.
    I am assuming that my images still stay on my external drive...how am I or her able to view these images if I am out of town on another computer?
    Situations like this require you to put the catalog file AND photos on the external HD and then move the external drive to whatever location and whatever computer is needed. An alternative is to put the photos on a network drive and the catalog file on a local disk and access the catalog locally and the photos via network, but that limits you to using a single computer.
    I am looking at LR Creative Cloud to allow a Team Member access my catalog so she can keyword search which images will work for our social media campaigns.
    As far as I know, this does not require Creative Cloud, nor does Creative Cloud help in this situation. Furthermore, if you are thinking about a situation where you and your team member have simultaneous access to the catalog(s) of interest, this is not possible in Lightroom. Lightroom is a single user application.
    If you are interested in a true multi-use application, where more than one individual can access a catalog at the same time, you might want to look at Daminion. Note: I am not endorsing or recommending Daminion, as I have never used it; I simply point out the that it has the feature being discussed.

  • Which camera will work best with the MAC? NIKON or Canon

    Contemplating on buy a camera and a MAC, but need to know which camera will work best with a MAC, Nikon or Canon? Any info is appreciated

    Both will work very well. You might not even need to install the software that comes with them because they'll probably work fine with iPhoto etc. Before you buy a camera, check this list of cameras supported by OS X:
    http://support.apple.com/kb/HT3825
    Just about all Nikon and Canon cameras are on that list. If a camera is so new it is not yet on that list, it will be in the next update, probably.
    That list is for raw format compatibility. If your camera also shoots JPEG, it will work with a Mac even if it's not on that list. If a camera doesn't work by plugging in a cable, take the card out and put it in an ordinary USB card reader and the Mac will read it.
    Nikon has a slight advantage in that it supports a mode that lets the Mac mount a camera like a disk on the desktop. Canons don't mount on the desktop, but it's not really a disadvantage, because Canons still work great with Apple iPhoto, Apple Aperture, Apple Image Capture, and Adobe apps, and all of those are more efficient ways of transferring photos than dragging them out manually.

  • Which dock will work best - attach to this bracket in my car?

    Which dock will work best - attach to this bracket in my car?
    Here is a pic of the bracket. I haven't figured out how to post pictures here yet.
    http://tinypic.com/r/9q8qw1/3

    Btw, it's an iPhone 3GS.

  • ?Best OS X version for Power Mac Cube G4-I want to reformat and start again in the hope it will work faster.

    Hi. I want to reformat and start again in the hope my G4 PowerMac Cube will work faster. So I'd like to know what the best version of Mac OS X is for the G4. Can anyone advise?  Many thanks.

    Hi, the best for speed is the lowest OSX it'll run & still do what you need.
    10.1.5 would run in 96MB of RAM, 10.2.x took twice as much, 10.3.x twice again, 10.4.x twice again, 10.5.x thrice again & better Video caards.
    And those are minimums, twice that being fairly useful, 4 times that being pretty good.
    I suspect 10.4.11 is going to be your "Sweet Spot", I wouldn't run 10.4 on PPC Macs with less than 1.5 GB of RAM, not on IntelMacs with less than 3-4GB of RAM.
    OSX is very dependent on it's spped & usability by the speed & amount of free space on the HD.
    So we know more about it...
    At the Apple Icon at top left>About this Mac, then click on More Info, then click on Hardware> and report this upto but not including the Serial#...
    Hardware Overview:
    Model Name: eMac
    Model Identifier: PowerMac6,4
    Processor Name: PowerPC G4 (1.2)
    Processor Speed: 1.42 GHz
    Number Of CPUs: 1
    L2 Cache (per CPU): 512 KB
    Memory: 2 GB
    Bus Speed: 167 MHz
    Boot ROM Version: 4.9.2f1

  • I have old mac software 10.3.9 and the only firefox that works with it is 2.0.0.20. i cannot afford a new laptop or software. which upgrade will work with my G4 powerbook built in 2004

    ''Duplicate post, continue here - [https://support.mozilla.com/en-US/questions/785589]''
    when i tried to upgrade in the past, i could access NOTHING. the only upgrade that would work with my mac osx 10.3.9 was the firefox 2.0.0.20.
    please let me know which of your upgrades will work with my operating system.
    i cannot lose contact with all my accounts. that is what happened the last time i tried to upgrade.

    Firefox 2.0.0.20 is the last version of Firefox that works on OS X 10.3.9
    There are some alternative browsers you can try:
    * iCab - http://www.icab.de/dl.php
    * Classilla - http://www.floodgap.com/software/classilla/
    * SeaMonkey 1.19 - http://www.seamonkey-project.org/releases/seamonkey1.1.19/

  • Which accessory will work best?

    I posted on here less than a month ago asking about the 30-pin to lightning adapter for the iPhone 5, seeing if it would work with my '08 Volkswagen Jettas iPod Adapter. Sadly to say, I should have listened to my gut feeling (but I appreciate the effort in trying to help) that it didn't work. I was looking around on the Google machine here, and found through a forum these things from CableJive. THey didn't say if they worked or not and I was wondering if anybody had any ideas if they do or not? Or if they think it would work?
    http://www.cablejive.com/products/dockBoss.html
    http://www.cablejive.com/products/dockBoss-air.html
    http://www.cablejive.com/products/dockBossplus-for-iPhone-5.html
    Anyone have any tries with these things at all? THink it would work (although it does say it)? Just want to be sure this time. If you do, which would be the best buy?
    Thanks Community!
    Kyle

    I hope this reaches you in time. Turns out none of Cablejive's solutions will work with VW's built in ipod adapter. Take a look at this link: http://www.cablejive.com/forum/viewtopic.php?f=38&t=7467

  • Help! Which Z30 will work in Peru?

    Hello! Please help me decide which model of Z30 will work with 4G LTE in Peru. Here we have the AWS (1700/2100) standard for the LTE service. I am not sure if STA 100-2 or STA 100-5 will be compatible with that band. Please help!
    Solved!
    Go to Solution.

    I believe you will want a STA-5
    Z30 Models and Supported Frequencies
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How MDX query will work while we run BOXIR3 query!

    Hi All,
    I am facing lots peformance issues in terms of reports while running.
    Can somebody can explain how the query runs at backend like when we hit Run query in Webi how it functioins.When the MDX Query will be generated and how the query hits the BI/Underlying database.
    I am basically looking out what happens behind the screen when we run a report in Back end etc.
    I am using BI7.0 and BOXIR3.. Thanks in advance for reply.

    ok Thanks for your reply.Here are the answers for your questions.
    I)how many items are in the BI query ?
    52 dimensions it has and 15 keyfigures(ckfs,Rkfs) and around 250 details objects
    but we are using only the dimension objects in reports,we are not using detail objects I mean to say hardly 3 detail objects we are using in each report.
    Since these objects are navigationla attributes they are automatically created in universe as detailed objecs.So if we remove the detail objects does the performance will increase considerably?
    CAN YOU PLEASE COMMENT ON THIS
    II)how many items are using in the Web Intelligence query panel for each report ?
    In webI Query Panel roughly for each report we are using 10 Dimensions and 5 Keyfigures(Including Ckf,Rkfs) with 6 Prompts
    III)Do the reports share characteristics ? If yes - how many ?
       Yes they share charactorstics .Maximum upto 7 Characterstics  which are shared among the reports like Country,Post code,Group,Tier

  • I will buy a new HP printer which one will work for me?

    Simple, I will buy a new HP printer. I want to print from my iPad and I want to print wireless from my PC. Which HP printer if any will work for me?

    Melbone,
    If you give me some more data about your needs, I can probably narrow down your choices to a model or two. But as I know nothing about how you are going to use the printer, I can't just recommend a specific model. Questions include the type of printing, how much paper you need the device to hold, whether or not two sided printing is important, and other feature of the device you are interested in such as scan and fax all help narrow the choices down.
    Just trying to help.
    Andrew

  • Which browsers will work with mac ver 10.4.11

    which version firefox works with mac ver 10.4.11

    Firefox 3.6.x is the last version of Firefox for PPC Mac's from Mozilla.
    For older Macs that aren't supported in Firefox 4+ versions, try TenFourFox for PowerPC's running Mac 10.4.11 & 10.5.8 . <br />
    http://www.floodgap.com/software/tenfourfox/
    http://tenfourfox.blogspot.com/

  • HT4972 2nd generation ipod touch is pretty much no good anymore?  It is not able to upgrade to iOS5.1 and so will not work with many of the Apps now available in the App store.  Is there any way to find out which apps will work with 2nd generat

    2nd generation ipod touch is pretty much no good anymore?  It is not able to upgrade to iOS5.1 and so will not work with many Apps in the iTunes store?  Is there a way to find out if the App will work before you download?

    Look to the app developer to provide that information when browsing the iTunes Store.
    The iPod Touch still works, so what's your problem with it? It still works with older apps, it still does what it's intended to do.
    If you aren't happy then sell it and buy a new one.

Maybe you are looking for

  • Breaks when clicking on names in a ListView

    So as the title suggests, I am having trouble when I select an item in a list view. If I click on the name of the item in the list, the program will break giving the following error/reason:  An unhandled exception of type 'System.InvalidCastException

  • Creating a dynamic lov based on a column

    Hi, I want to create a dynamic lov based on a column in a database-table. Eg. the query 'select code, description from code_table' is the contents of the column 'lov_query' in the table 'parameters'. For every parameter there can be a different lov-q

  • Photoshop CC 14.1 GPU not detected (MacOS)

    So I upgraded to Photoshop CC 14.1  Mid 2009 Macbook, 10.8.4 6GB ram/NVDIA 9400M GPU 236 MB ram. When I launch PS by itself, my GPU is detected. If I double click on a file, there is a delay in opening and I get this message: All my OpenGL functions

  • In Bridge CS5 thumb nails showing milky sheen and loss of clarity

    When I open up Photoshop CS4 or CS5 and go to bridge , my thumb nails have changed in appearance, they now show a milky sheen and loss of clarity.This has happened mainly with files I have worked with and they are mostly tiff images, the psd images s

  • HT201320 email

    I am trying to add an email to my iphone. I am not savvy enough to do this with such vague instructions. I need a step by step instruction. Can you help me?