BETWEEN operator or = and =

From a performance point of view, Which is better? BETWEEN operator or >= and <= . And why?

A simple test..
SQL> explain plan for
  2   select * from emp
  3   where sal between 1000 and 3000;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3956160932
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |      |     9 |   333 |     3   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| EMP  |     9 |   333 |     3   (0)| 00:00:01 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
   1 - filter("SAL"<=3000 AND "SAL">=1000)
13 rows selected.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Query performance - Difference between OPERATOR - Exists and IN

    Hi,
    I Have Two Tables VD,ID .Each table containg one lakh rows.
    CREATE TABLE VD (
    SRNO NUMBER(12) ,
    UNIT Varchar2(2) ,
    CREATE TABLE ID ( SRNO NUMBER(12),
    PID Varchar2(2) ,
    Sid Varchar2(20)
    In my Application i need to display Column(SRNO) from table VD If the Column(SRNO)exists in Table ID
    for the given PID and SID.
    Which query has better performance in below Queries ?
    Select SRNO from VD Where SRNO in( Select SRNO From ID Where PID = :A
    And Sid = :B )
    Select SRNO from VD V Where Exists( Select 'X' From ID Z Where Z.PID = :A
    And Z.Sid = :B
    And Z.SRNO = V.SRNO )
    Version : Oracle 10g
    Thanks ....
    Sathi

    user10732947 wrote:
    pls refer to :-)
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:953229842074
    And which part are you referring to specifically?
    It backs up what Toon already mentioned....
    ops$tkyte@ORA10GR2> SELECT /* EXISTS example */
      2           e.employee_id, e.first_name, e.last_name, e.salary
      3    FROM employees e
      4   WHERE EXISTS (SELECT 1 FROM orders o                  /* Note 1 */
      5                    WHERE e.employee_id = o.sales_rep_id   /* Note 2 */
      6                      AND o.customer_id = 144);
    Execution Plan
    Plan hash value: 551415261
    | Id  | Operation                    | Name      | Rows  | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT             |           |    67 |  4087 |    49   (3)|
    |   1 |  NESTED LOOPS                |           |    67 |  4087 |    49   (3)|
    |   2 |   SORT UNIQUE                |           |    67 |  1139 |    14   (0)|
    |*  3 |    TABLE ACCESS FULL         | ORDERS    |    67 |  1139 |    14   (0)|
    |   4 |   TABLE ACCESS BY INDEX ROWID| EMPLOYEES |     1 |    44 |     1   (0)|
    |*  5 |    INDEX UNIQUE SCAN         | EMP_PK    |     1 |       |     0   (0)|
    Predicate Information (identified by operation id):
       3 - filter("O"."CUSTOMER_ID"=144)
       5 - access("E"."EMPLOYEE_ID"="O"."SALES_REP_ID")
    ops$tkyte@ORA10GR2>
    ops$tkyte@ORA10GR2> SELECT /* IN example */
      2           e.employee_id, e.first_name, e.last_name, e.salary
      3      FROM employees e
      4     WHERE e.employee_id IN (SELECT o.sales_rep_id         /* Note 4 */
      5                               FROM orders o
      6                              WHERE o.customer_id = 144);
    Execution Plan
    Plan hash value: 551415261
    | Id  | Operation                    | Name      | Rows  | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT             |           |    67 |  4087 |    49   (3)|
    |   1 |  NESTED LOOPS                |           |    67 |  4087 |    49   (3)|
    |   2 |   SORT UNIQUE                |           |    67 |  1139 |    14   (0)|
    |*  3 |    TABLE ACCESS FULL         | ORDERS    |    67 |  1139 |    14   (0)|
    |   4 |   TABLE ACCESS BY INDEX ROWID| EMPLOYEES |     1 |    44 |     1   (0)|
    |*  5 |    INDEX UNIQUE SCAN         | EMP_PK    |     1 |       |     0   (0)|
    Predicate Information (identified by operation id):
       3 - filter("O"."CUSTOMER_ID"=144)
       5 - access("E"."EMPLOYEE_ID"="O"."SALES_REP_ID")Two identical Execution plans...

  • Difference between AP Operational Status and Registered Controller

    When reviewing the AP Details page in Prime there are two fields I'm not sure what they mean specifically:
    1) Operational Status - Registered
    2) Registered Controller - Not Associated
    Any clarity or document references would be greatly appreciated.           

    This is in CPI viewing the AP Details tab.
    The only valid values for Operational Status are Registered/Not Registered.
    The only valid values for Registered Controller are Associated/Not Associated
    The IP address is not a valid input.
    It is still unclear to me what the specific and fuctional differences and impacts are between Operational Status and
    Registered Controller? How do the values of each impact the client device?
    Thank You.

  • Difference in between operator in oracle 8i and 9i version

    Is their any difference between the functioning of Between operator in 8i and 9i?

    I agree that there should be no differences in behavior of the between operator from version 8.1 to 9.2. If you can run the same query with the same data on the two versions and get different results then you would need to look for version specific, possibly platform specific, bugs on metalink.
    HTH -- Mark D Powell --

  • Is there any Similar between Class.forName() and new operator ???

    Plz tel me is there any Similar between Class.forName() and new operator ??? i have been asked this ques in interview

    You probably should have used the other thread:
    http://forum.java.sun.com/thread.jspa?threadID=792678
    To add a little confusion to the matter...Class objects are in fact objects. They're objects representing classes. So, in a sense, I guess, you could say they're similar -- in each you get an object. But in practice Class objects and all other objects should be considered semantically different unless you're doing some pretty unusual stuff. Also Class.forName is more of a factory method than a constructor.

  • Diffrence between Class.forName() and new Operator

    What is diffrence between class.forName() and new operator.Please tell in much detail.
    Also about classloader.loadclass.
    Suppose the class that we are tring to load with the help of class.forname is not compiled. Again if I make changes at runtime to that class will that get reflected.

    What is diffrence between class.forName() and new
    operator.Please tell in much detail.Class.forName loads a class. The new operator creates a new instance. Apple trees and apples.
    Also about classloader.loadclass.Read the API.
    Suppose the class that we are tring to load with the
    help of class.forname is not compiled.Then you can't load it and get an exception. Read the API.
    Again if I
    make changes at runtime to that class will that get
    reflected.Depends on the changes and when exactly you do them.

  • Between operator is taking as = and = in physical query

    Hi,
    i am implementing filter in obiee as follows,
    calendar date between 01/01/2010 and 01/01/2010
    or
    calendar date between 01/01/2009 and 01/01/2009
    when i executed the query it is showing the above logic in obiee logical query,where as in physical query it is taking as
    (T1233290."CALENDAR_DATE" >= DATE '2009-01-01' or T1233290."CALENDAR_DATE" >= DATE '2010-01-01') and (T1233290."CALENDAR_DATE" >= DATE '2009-01-01' or T1233290."CALENDAR_DATE" <= DATE '2010-01-01') and (T1233290."CALENDAR_DATE" >= DATE '2010-01-01' or T1233290."CALENDAR_DATE" <= DATE '2009-01-01') and (T1233290."CALENDAR_DATE" <= DATE '2009-01-01' or T1233290."CALENDAR_DATE" <= DATE '2010-01-01') )
    how to get the between operator in physical query.
    please help me out in this.

    Why are u using the same dates in between option ?

  • Differences between operational systems data modeling and data warehouse da

    Hello Everyone,
    Can anybody help me understand the differences between operational systems data modeling and data warehouse data modeling>
    Thanks

    Hello A S!
    What you mean is the difference between modelling after normal form like in operational systems (OLTP) e. g. 3NF and modelling a InfoCube in a data warehouse (OLAP)?
    While in a OLTP you want to have data tables free of redundance and ready for transactions meaning writing and reading few records often, in an OLAP-system you need to read a lot of data for every query you do on a database. Often in an OLAP-system you aggregate these amounts of data.
    Therefore you use another principle for these database scheme. This is called star schema. This means that you have one central table (called fact table) which holds the key figures and have keys to another tables with characteristics. These other tables are called dimension tables. They hold combinations of the characteristics. Normally you design it that your dimensions are small, so the access  on the data is more efficent.
    the star scheme in SAP BI is a little more complex than explained here but it follows the same concept.
    Best regards,
    Peter

  • Trouble with Between operator and Order by clausule

    Hello, can somebody help me?
    I have this setup:
    create table test (cod varchar2(10));
    insert into test (cod) values ('1');
    insert into test (cod) values ('2');
    insert into test (cod) values ('3');
    insert into test (cod) values ('4');
    insert into test (cod) values ('5');
    insert into test (cod) values ('49');
    insert into test (cod) values ('CN0047');
    commit
    Then this query:
    SQL> select * from test order by 1;
    COD
    CN0047
    1
    2
    3
    4
    49
    5
    7 filas seleccionadas.
    SQL> select * from test order by 1 desc;
    COD
    5
    49
    4
    3
    2
    1
    CN0047
    7 filas seleccionadas.
    SQL> select * from test where cod between 'CN0047' AND '49';
    no row selected
    SQL> select * from test where cod between '49' AND 'CN0047';
    COD
    5
    49
    CN0047
    Why Between operator works different than Order by?
    This query: select * from test where cod between 'CN0047' AND '49';
    Shouldn't return CN0047, 1, 2, 3, 4 and 49?
    Thanks in advance.
    Joel Orta

    This may help;
    SQL> --
    SQL> -- ******************** NLS SORT ********************
    SQL> --  
    SQL> select * from v$nls_parameters where parameter = 'NLS_SORT'
    parameter            value              
    NLS_SORT             BINARY             
    1 row selected.
    SQL> select * from test order by 1
    COD      
    1        
    2        
    3        
    4        
    49       
    5        
    CN0047   
    7 rows selected.
    SQL> alter session set NLS_SORT = FRENCH
    Session altered.
    SQL> select * from v$nls_parameters where parameter = 'NLS_SORT'
    parameter            value              
    NLS_SORT             FRENCH             
    1 row selected.
    SQL> select * from test order by 1
    COD      
    CN0047   
    1        
    2        
    3        
    4        
    49       
    5        
    7 rows selected.
    SQL> --
    SQL> -- ******************** NLS COMP ********************
    SQL> --
    SQL> select * from v$nls_parameters where parameter = 'NLS_COMP'
    parameter            value              
    NLS_COMP             BINARY             
    1 row selected.
    SQL> select * from test where cod between '49' AND 'CN0047'
    COD      
    5        
    49       
    CN0047   
    3 rows selected.
    SQL> alter session set NLS_COMP = ansi
    Session altered.
    SQL> select * from v$nls_parameters where parameter = 'NLS_COMP'
    parameter            value              
    NLS_COMP             ANSI               
    1 row selected.
    SQL> select * from test where cod between '49' AND 'CN0047'
    no rows selected

  • Relation between operation and component in Production order

    Hi All
    I am new to PP. I need to get the tables which gives relation between operation and components in Production Order. I need to display in smartform the components assigned.
    Thanks and regards
    Swetabh Shukla

    Hi,
    Try with AFVV Table.
    You need to get the Details of the Filed : AUFPL from AFKO.
    Hope this helps..
    Regards,
    Siva
    Hi,
    You can get the details from Table : RESB.
    Regards,
    Siva
    Edited by: Siva Kumar M on May 23, 2008 10:49 AM

  • Difference between parallel sequence and parallel operation in a routing.

    Hi Experts,
    Can any one explain me with example the difference between parallel sequence and parallel operation in a routing? wHEN CAN WE USE PARALLEL OPEARTION AND PARALLEL SEQUNCE WITH COMPONENT ALLOCATION.
    Regards
    Deepak sharma

    I think u need to modify ur quest... i think u r asking about Parallel sequence and alternate seq. Below are the details from SAP site.
    A parallel sequence enables you to process several operations at the same time.
    You use an alternative sequence for example, if
    --The production flow is different for certain lot-size ranges
    For instance you can machine a work piece on conventional machine or on NC machines. A NC machine has a longer set-up time than a conventional machine. However the machining costs are considerably less. Therefore whether you use NC machines will depend on the lot size.
    ---The production flow changes under certain business conditions.
    For instance, if you have a capacity problem, you have some production steps performed externally by a vendor.

  • Difference between "base quantity" and "operation quantity" in an operation

    Hello
    what is the difference between "base quantity" and "operation quantity" in a production order ?
    thank you for your answers

    Base Quantity - Quantity of the material to be produced to which the standard values of the operation refer.
    Operation Quantity - Quantity planned for this operation.
    Base quantity and operation quantity may not always be the same, if we have partial lots delivered during the sequence of operations, the operation quantity will be equal to the lot delivered during the operation.
    Base quantity is dependent on the BOM, where it signifies the total quantity of output after using the components of certain quantity.
    Hope this may help you.

  • WCS difference between "admin status" and "oper status"

    Can anyone explain what the difference is between admin status and oper status within the WCS GUI. It appears that disbaling either on effectively disables the radio...is that correct?

    I think I got it figured out...thanks for lookin....

  • Difference between operating concern, segment and business area

    hi,
    can any one tell me the diffrence between operating concern, segment and business area with example.
    regards,
    ankur

    Hi,
    Operating concern is the highest level of hierarchy in controlling area.  Operating concern used to
    do analysis on PCA (Profit Center Acctg) / CO-PA.  This is basically used for the analysis of parameters, like measuring
    internal profit of a SBU, Sales data analysis (COPA).They can even be used for Analysing balance sheet items
    (Stocks,Assets,cash etc.)
    Segment- financial report information by line of business and geographical area
    business area- equivalent to a specific area of responsibility within your company or business segment.  This can be used for both internal and external reporting
                          Business areas are primarily used to facilitate external segment reporting across company
    codes, covering the company's main areas of operation (product lines, branches)
          organizational units in FI module are ( in sequence): Client, company code, business area, company, credit cotrol area, funds
          management area, dunning area, chart of accounts and controlling area.
    Thanks,
    Rod

  • How do you sync itunes between a MacBook and ipad mini with different operating systems ?

    I own a Macbook with OS X 10.5.8 operating system, and have recently bought an ipad mini but I cant sync itunes because it operates on the 10.6.8 system, is ther an upgrade for the Macbook, or is there another way of syncing the two ?

    You need to be running Snow Leopard 10.6.8 to sync with your iPad.
    Start by checking if you can run Snow Leopard:
    Requirements for OS X 10.6 'Snow Leopard'
    http://support.apple.com/kb/SP575
    The OS 10.6 Snow Leopard install DVD is available for $19.99 from the Apple Store:
    http://store.apple.com/us/product/MC573/mac-os-x-106-snow-leopard
    and in the UK:
    http://store.apple.com/uk/product/MC573/mac-os-x-106-snow-leopard
    When you have installed it, run Software Update to download and install the latest updates for Snow Leopard to bring it up to 10.6.8, or download the combo update from here:
    http://support.apple.com/kb/DL1399
    Check via Software Update whether further updates are required.

Maybe you are looking for