Which is better in terms of performance

Dear All,
which is better..
to use FOR ALL ENTRIES      or
to build a range and use  WHERE IN RANGE_TABLE     .. Does this have data limitation problem.
is there a better method?
Thanks,
Raghavendra
Moderator message - Please search before asking - post locked
Edited by: Rob Burbank on Jul 7, 2009 10:53 AM

I want to know which is betterThere's not enough information for anyone here to be able to tell you.
Obviously the first one "looks" faster, but without knowing the tables, structure, data, indexes, platform etc. etc. etc. we won't have a clue.

Similar Messages

  • Code comparission which is better in terms of performance

    In my pl/sql procedure the following code exist
    SELECT count(*) INTO L_exists
              FROM txt
         WHERE templ_id in (ISecurTempl,ESecurTempl);
    Now i want to replace the query with
    SELECT count(*) INTO L_exists
              FROM txt
    WHERE templ_id in (                                                       SELECT INT_SEC_TMP FROM table(cast(parse_table as sec_template_tbl))
                                                      UNION
    SELECT EXT_SEC_TMP FROM table(cast(parse_table as sec_template_tbl))
    Can you please tell me which part of code is better in terms of performance
    and why?
    Thanks in advance

    I want to know which is betterThere's not enough information for anyone here to be able to tell you.
    Obviously the first one "looks" faster, but without knowing the tables, structure, data, indexes, platform etc. etc. etc. we won't have a clue.

  • Which is better in term of power consumption for L...

    Hello!
    I would like to know in terms of power consumption which connection type should I use on my Lumia 1020. 4G LTE or 3G. I'm not a person who watches movies on his smartphone, and I don't browse the Internet intensively using my smartphone. I use it to take pictures, check my e-mails, access Facebook, Twitter, Instagram  and Flickr.
    Thank you.
    Cosmin Petrenciuc

    3G is in general less power hungry.

  • How  to make  Purging better in terms  of performance

    Hi
    I am trying to purge(delete) data from 4 tables on the basis of a flag in the lookup table.
    Now, there are 3 million records to be deleted from each of the 4 tables .
    My piece of code is like this
    for i in(select ids from lookup_table where flag_val='N')
    loop
    delete from table_a where id=i.ids;
    delete from table_b where id=i.ids;
    delete from table_c where id=i.ids;
    delete from table_d where id=i.ids;
    if commit_interval=5000 then
    commit;
    commit_interval:=0;
    end if;
    commit_interval:=commit_interval +1;
    end;
    I am trying to commit for 5000 records.
    its taking a lot of time
    like 10-12 hrs .
    Can anyone solve this issue its urgent .
    regards
    shubh

    Now in your code you have written delete statements for all the four tables. Now convert it to four different procedures each handling only a single table.
    something like this.........
    for i in(select ids from lookup_table where flag_val='N')
    loop
    delete from table_a where id=i.ids;
    if commit_interval=5000 then
    commit;
    commit_interval:=0;
    end if;
    commit_interval:=commit_interval +1;
    end;
    for i in(select ids from lookup_table where flag_val='N')
    loop
    delete from table_b where id=i.ids;
    if commit_interval=5000 then
    commit;
    commit_interval:=0;
    end if;
    commit_interval:=commit_interval +1;
    end;
    Run these procedures simultaneously.... say thru different windows/terminals.
    Since these procedures are running simultaneously, the server efficiency will improve. Also make sure that the server is not used by other users/ less number of users so that max. resources are available for your code.

  • Which is better, a G4-450 Dual or a Mac Mini 1.42?

    which is better in terms of Sequencing and plug in performace, the G4-450 Dual or a Mac Mini 1.42?

    G4-450GHz Dual with 896MB RAM
    Mac Mini 1.42GHz with 1 gig of Ram
    G4-450GHz Dual gets more instances with plugs, more tracks and performance then the 1.4GHz 17" Powerbook, 12" powerbook and Mac Mini which all have the same G4 processor.,
    Today, i took the same 34 track session,
    -all 34 tracks have a Logic Comp, Eq, Gate
    -and also 8 Buses with Comp, EQ, Gates, Delays, Flange, Phasors, Pitch Shifters, 2 Reverbs (1 long and 1 plated) as well as some other toys.
    -Master with Waves Ren Comp, Logic EQ.
    -6 esx24 Instruments with high loads ( Harps, Strings, Cellos, Drums and Perc)
    -8 Long (16 Bar) drum tracks ( Bass, HH, Snare, Toms, Overheads, Fills, Percussion dubs)
    -4 Vocal takes and Dubs (more then 16 Bars long)
    -Bass Track
    -2 Acoustic stereo tracks
    -4 Guitar tracks, dubbs and fills
    -4 Slide Acoustic guitar tracks
    -4 dubbed effect vocal tracks
    AT first, he G4-450GHz Dual choked with 2 errors, then it buffered into the session well and played everything back fine of the same FW drive.
    The mac mini got major problems and only performed 28 tracks with the esx24 tracks frozen, and from time to time after heating up chokes again, i had to wait a few minutes before i bounced the session due to overload errors.
    Over all, Both have G4 Processors and about 1GIG ram (450GHz Dual is under 1 GIG), but its a clear fact that double processors win, even the lowest 450GHz Dual is still hotter then any flashy fast Bused mac mini, powerbook or iMac.

  • Touch or Classic? Which is better (quality)?

    Which is better in terms of sound quality?

    Classics. The Older 5.5 gens and Older series Ipods. The Newer 5.5 gens and the 6th Gens use a new sound chip. Same as for the Ipod Touches but Im not 100% sure with the Iphones.
    Be careful though, The Ipods with that use the old style sound chip, which is far superior in quality of sound,  wasn't soldered well and the chip can seperate with The constant temperature change and unobserved  pressure applied to the unit when its in your pocket, book bag... ect.
    Now Im not going to say that is 100% positive. Its just from experience owning a few new and older Ipods/Iphones.
    Besides, How many older Mp3 plays can literally blow out your Earbuds{quality earbuds} if played too loud. I owned Bose Series{IE 2} in ear headphones and klipsch In ear Headphones{S5I Rugged series}.... The Key word is "Owned" lol.
    Find an Older model that works great and compare it to the newer models. You will Hear the DIfference... or make you deaf in the process LOL.

  • Which is better:  extractValue or existsNode for Performance

    Hi,
    We have XMLDB Table with only 1 Column (XMLType) created using below:
    create table TNMAB_AGREEMENT_XML( AGREEMENT_XML XMLType )
         XMLTYPE COLUMN AGREEMENT_XML XMLSCHEMA "ABQuote_V1.xsd" ELEMENT "Quote"
              VARRAY AGREEMENT_XML.XMLDATA."SHIPPING_PARTIES"
                   STORE AS TABLE SHIPPING_PARTIES_NT
                   ((PRIMARY KEY (NESTED_TABLE_ID, ARRAY_INDEX) ENABLE))
              VARRAY AGREEMENT_XML.XMLDATA."SALES_OFFICE_CODES"."STRING_WRAPPERS"
                   STORE AS TABLE SALES_OFFICE_CODES_NT
              ((PRIMARY KEY (NESTED_TABLE_ID, ARRAY_INDEX) ENABLE))
         TABLESPACE RGM_ME_DATA;
    alter table TNMAB_AGREEMENT_XML
    add constraint TNM_AGREEMENT_XML_PK primary key (AGREEMENT_XML.XMLDATA."AGREEMENT_ID",
                                  AGREEMENT_XML.XMLDATA."AGREEMENT_VERSION")
    using index tablespace RGM_ME_INDX;
    We populated around 500K rows and have been seeing some Performance Issues
    in accessing data from above Table, at times.
    What is difference between extractValue and existsNode in terms of performance?
    Here are sample queries:
    SELECT extract(AGREEMENT_XML, '/') "Quote" FROM TNMAB_AGREEMENT_XML WHERE extractValue(AGREEMENT_XML, '/Quote/Identifier') = ‘00003554’
    SELECT extract(AGREEMENT_XML, '/') "Quote" FROM TNMAB_AGREEMENT_XML WHERE existsNode(AGREEMENT_XML, '/Quote[Identifier = "00003554"]') = 1
    Which of the above would be better to use existsNode or extractValue.
    In above case, both the queries are expected to return Single Row (searched
    using Quote Identifier, which is defined as PK of Table) and query explain plan does
    show usage of PK for above queries.
    Thanks
    user641521

    In theory existsNode can be slightly better, however in you cases the two queries are not identical.
    Also there are a number of other issues with your query..
    1. extract(AGREEMENT_XML, '/') is not required. You should just have the AGREEMENT_XML column. Extract is only need when extracting a fragment from the XML. Since you are returning the entire document the use of extract(column,'/') is redundant, but can cause performance issues..
    THis query should be written as
    SELECT AGREEMENT_XML "Quote"
    FROM TNMAB_AGREEMENT_XML
    WHERE extractValue(AGREEMENT_XML, '/Quote/Identifier') = ‘00003554’
    and can be written using existsNode as
    SELECT AGREEMENT_XML "Quote"
    FROM TNMAB_AGREEMENT_XML
    WHERE existsNode(AGREEMENT_XML, '/Quote[Identifier="00003554"]') = 1
    Assuming Identifier can only occur once inside Quote. If Identifier can occur multiple times inside Quote then the existsNode version would still work while the extractValue version would return errors

  • 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

  • Which is better? Code comparsion of performance and style

    Recently I run into a discussion over a small piece of code. Could help me which is better, either in performance or coding style? The code is not complete, the question is the use of local cancellationNumber variable.
    public String cancelAction(/**/) {
    /* some code */
            String cancellationNumber = result.getCancellationNumber();
            if (empty(cancellationNumber)) {
                throw new Exception("Did not receive a cancellation number!");
            return cancellationNumber;
        }or
    public String cancelAction(/**/) {
    /* some code */
            if (empty(result.getCancellationNumber()) {
                throw new Exception("Did not receive a cancellation number!");
            return result.getCancellationNumber();
        }

    Yes, I know profiling can be misleading, also compiler optimization adds to the picture. However seeing the numbers differentially, I think there is still some information, which is faster, even if taking it completely out scope. I didn't paste the code, because it's so trivial. I run the two methods in a loop with same arguments.
    With increased loop count, the difference is 6-7%, cancelActionWithLocal being faster. But this can be pointless, I know.
    package org.helloprofile;
    import static org.helloprofile.Util.empty;
    import java.util.Locale;
    public class CUT {
        public String cancelActionWithoutLocal(Locale locale, String email, long itineraryId, String confirmationId) throws Exception {
            Result result = new Result();
            if (empty(result.getCancellationNumber())) {
                throw new Exception("Did not receive a cancellation number!");
            return result.getCancellationNumber();
        public String cancelActionWithLocal(Locale locale, String email, long actionId, String confirmationId) throws Exception {
            Result result = new Result();
            String cancellationNumber = result.getCancellationNumber();
            if (empty(cancellationNumber)) {
                throw new Exception("Did not receive a cancellation number!");
            return cancellationNumber;
    }Thanks for the comments!

  • Performance wise which is better NOT IN or NOT EXISTS

    Performance wise which is better NOT IN or NOT EXISTS.

    also that not exists is not equivalent to not in
    SQL> select * from dept where not exists (select * from emp where dept.deptno=comm);
        DEPTNO DNAME          LOC
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
    SQL> select * from dept where deptno not in (select comm from emp);
    no rows selectedin most case, Oracle internally rewrite a NOT IN in a NOT EXISTS, because NOT EXISTS usually performs better.
    HTH
    Laurent

  • Subquery vs UNION, which is better for performance?

    I want to know which in better for performance using a subquery method or a UNION?
    Any information would be helpful and appreciated!

    Hi,
    It depends on the SQL statments and each case is different from an other one. Take a look at the oracle doc: "Designing and Tuning for Performance".
    Regards,
    CB

  • 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.

  • Which is better - Add a dimension or create more members in an existing

    Which is better - Add a dimension or create more members in an existing dimension?
    We are trying to figure out which can give us better performance in terms of calculations and retrieving reports - to add another dimension (entity/country) or add about 500-800 more members in an existing location/division dimension?
    Thank you!

    If you have BSO cube i would recommend to add in the same dimension where as ASO you can add members in a new dimension. Adding a new dimension is like creating a new cube you have to change each and every single calc scripts,report scripts,FR reports,Webforms and your rule files .... all the dependencies has to be changed manually . I think 500 members in the exsting BSO dimension will not impact the calc or retrieval times that much .

  • Which is better of MANY_TO_ONE and ONE_TO_MANY

    I am trying je.
    A little confuse is , that suppose A has one_to_many relation to B, then B can have many_to_one relation to A. And both solution is acceptable to my application. Which should I choose?

    Hello Jie,
    This is a very good question, since we do not describe in the documentation how to choose between MANY_TO_ONE and ONE_TO_MANY. As you point out, it can be done either way when a related entity is used.
    For example, here is how MANY_TO_ONE can be used:
    @Entity
    class Person {
      @PrimaryKey(sequence="ID")
      long id;
      @SecondaryKey(relate=MANY_TO_ONE, relatedEntity=Employer.class)
      long employerId;
      String name;
    @Entity
    class Employer {
      @PrimaryKey(sequence="ID")
      long id;
      String description;
    }Of course we will need primary indexes for both entities:
    PrimaryIndex<Long,Person> personById = ...;
    PrimaryIndex<Long,Employer> employerById = ...;To get the employer of a person, we simply pass the employerId to the primary index:
    Person person = ...;
    Employer employer = employerById.get(person.employerId);To get the employees for a given employer, we get a sub-index for the employerId secondary key:
    long anEmployerId = ...;
    SecondaryIndex<Long,Long,Person> personByEmployerId = ...;
    EntityIndex<Long,Person> employees = personByEmployerId.subIndex(anEmployerId);
    EntityCursor<Person> cursor = employees.entities();
    try {
      for (Person employee : cursor) {
        // do something with employee
    } finally {
      cursor.close();
    }And here is how ONE_TO_MANY can be used to provide the same functionality:
    @Entity
    class Person {
      @PrimaryKey(sequence="ID")
      long id;
      String name;
    @Entity
    class Employer {
      @PrimaryKey(sequence="ID")
      long id;
      @SecondaryKey(relate=ONE_TO_MANY, relatedEntity=Person.class)
      Set<Long> employeeIds;
      String description;
    }To get the employer of a person, we simply pass the person id to the employer's secondary index:
    Person person = ...;
    SecondaryIndex<Long,Long,Employer> employerByEmployeeIds = ...;
    Employer employer = employerByEmployeeIds.get(person.id);The primary difference is that with MANY_TO_ONE the collection of employee IDs is maintained by the secondary index, while with ONE_TO_MANY the collection of employee IDs is embedded in the Employer entity.
    Therefore to get the employees for a given employer with ONE_TO_MANY, we get the Employer object from the employerById primary index and then get each person in the employeeIds set:
    long anEmployerId = ...;
    SecondaryIndex<Long,Long,Person> personByEmployerId = ...;
    Employer employer = employerById.get(anEmployerId);
    for (long employeeId : employer.employeeIds) {
      Person employee = personById.get(employeeId);
      // do something with employee
    }There is a major difference in terms of performance and scalability. With ONE_TO_MANY, if the number of employees for a single employer is very large, then the Employer record will be large because the list of employee IDs is embedded in the Employer object. This means that it will be more expensive to load the employer, for example, if all you want is the employer description field. The list of employee IDs will always be loaded whenever you access an employer.
    On the other hand, with MANY_TO_ONE, the set of employers is stored in the sub-index. The sub-index is a Btree. It is very scalable and can easily support large numbers of employees per employer, even millions. And when simply loading the Employer record, the set of employeeIds for that employer will not be loaded. The Employer record will be very small.
    There are four factors in deciding whether to use MANY_TO_ONE or ONE_TO_MANY.
    (1) As shown above, it is slightly easier to use ONE_TO_MANY, because you don't need to use a sub-index as you must do with MANY_TO_ONE.
    (2) MANY_TO_ONE will scale to larger number of entities per relationship, since a sub-index Btree is used to store the related entities.
    (3) With MANY_TO_ONE, the entity object will not grow to a large size as many related entities are added. Smaller records are always better for performance and resource consumption.
    In general, I advise using MANY_TO_ONE because it does not have the potential performance problems of ONE_TO_MANY (items 2 and 3 above).
    But if you know that the number of related entities per relationship will be small, then either technique works well, and you should choose whichever you prefer. You may find that ONE_TO_MANY is slightly easier to use (item 1 above). Or you may choose one technique over the other because you prefer to maintain the relationship via the Person.employerId field or the Employer.employeeIds set.
    There is one additional factor. If you have a secondary key where there is no related entity, just related keys, then you have no choice. There is only one entity, and you choose the relationship type accordingly.
    For example, a Person may have many email addresses, and you may choose not to have an EmailAddress entity. The email addresses are simply secondary keys, not the key of another related entity. If a user can only have one email address, you would use ONE_TO_ONE. If the user can have multiple email addresses, you would use ONE_TO_MANY as shown below.
    @Entity
    class Person {
      @PrimaryKey(sequence="ID")
      long id;
      @SecondaryKey(relate=ONE_TO_MANY)
      Set<String> emailAddresses;
      String name;
    }A gender (male or female) secondary key is an example of a MANY_TO_ONE relationship where no related entity is involved:
    @Entity
    class Person {
      @PrimaryKey(sequence="ID")
      long id;
      @SecondaryKey(relate=MANY_TO_ONE)
      char gender; // M or F
      String name;
    }In this last example, there is no choice about whether to use ONE_TO_MANY or MANY_TO_ONE because there is only one entity involved. So this last rule is:
    (4) If there is no related entity, then because there is only one entity involved the relationship type is determined by the cardinality (number) of entities and keys in each relationship.
    Mark

  • Which is better String null or should i initialize to blank ?

    Hi
    I am persisting one string in coherence which can be null for few cases. so putting null or blank which is better in coherence ?

    Assignment "null" for String references is good because Coherence will use less space of storage during serialization. It other terms, this is good for performance during replication and synchronization.
    Cheers,
    Ricardo Ferreira

Maybe you are looking for