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.

Similar Messages

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

  • 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? 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!

  • Which is better to use: BEx query or Web Application as an iView in portal?

    Hi gurus!
    Are there any experienced opinions, which is better - publish a BEx query in portal or publish a BEx Web Application in portal? Is it easier to alter the layout attributes etc. if I create a BEx Web Application first before publishing?
    What is the way of fixing for example filter item height if I publish BEx query in portal - is there a Web Application that it uses anyhow which I can fix? Or can I use in that case iView -properties in portal?
    Thankful for advice
    Sari

    ok, means i can use jsp:useBean tag for all my
    classes that are not actually bean. so it will be
    instantiated at run time and provide efficiency .No. Jsp:useBean is used for java bean components.
    >
    but when should i use import statement in my jsp and
    it happen at translation time so will it create any
    type of burden for my code if i import multiple
    classes.For non-java beans, you need to import the classes, period.
    It's not a burden, it's a necessity.

  • 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 for newbies?

    Which is better for newbies, Jgrasp or Netbeans? I need something that explains errors more thoroughly than Jgrasp.

    Here's my code with 3 errors. Now bear in mind that my program has compiled completely and ran correctly up to this method. All I'm trying to do with this method is get the average of all grades in a multi-array. I researched and found some code that was similar to what I needed to do but it's not working out yet. All other methods in my program work perfectly but I can't get this one to compile.
    public double getMean(int allGrades[][])
              int total = 0;
              for (int grade : allGrades)
              total += grade;
         System.out.println("Total is "+getMean(grades));     
              return total/allGrades.length;
    } // end class GradeBookGradebook.java:100: illegal start of type
              return total/allGrades.length;
              ^
    Gradebook.java:100: <identifier> expected
              return total/allGrades.length;
              ^
    Gradebook.java:100: <identifier> expected
              return total/allGrades.length;
              ^
    3 errors

  • Which is better approach to manage sharepoint online - PowerShell Script with CSOM or Console Application with CSOM?

    Which is better approach to manage sharepoint online - PowerShell Script with CSOM or Console Application with CSOM?
    change in sharepoint scripts not require compilation but anything else?

    Yes, PowerShell is great, since you can quick change your code without compilation.
    SP admin can write ps scripts without specific tools like Visual Studio.
    With powershell you can use cmdlets,
    which could remove a lot of code, for example restarting a service.
    [custom.development]

  • Coding Preference ..Which is better for memory?

    Hey all,
    Javas garbage collection is sweet. However, I was reading somewhere that setting some objects to null after I'm done with them will actually help.
    (help what .. I'm not sure.. my guess is memory used by the JVM)
    Thus I have two ways to do the same thing and I'd like to hear peoples comments on which is "better" ... or will yield faster performance.
    Task: I have a Vector of Strings (called paths) that hold absolute file paths. (Don't ask why I didn't use a String[]) I'd like to check and see if they exist, and if not, create them... I'll use the createNewFile() method for that.
    Method A -- Here I'll reuse that File object
    public void myMethod()throws Exception{
    File file = null;
    for(int i = 0; i < paths.size(); i++){
      file = new File(paths.get(i).toString());
      boolean made  = file.createNewFile();
      if(made){doSomething();}
    file = null;
    }Method B -- Here I'll use um... "dynamically made" ones that I won't eventually be set back to null
    public void myMethod()throws Exception{
    for(int i = 0; i < paths.size(); i++){
      boolean made  = (new File(paths.get(i).toString())).createNewFile();
      if(made){doSomething();}
    }So when the code eventually exists myMethod, the object "file" will be out of scope and trashed.... correct? If thats the case, then would there be any other differences between the two implementations?
    Thanks

    There's no real difference between the two. Choose the style you prefer,
    although in the first one I'd lose the "file = null" statement since that
    variable is about to disappear, and I'm move the definition into the loop
    -- always give variables as small a scope as possible, mainly to
    keep the logic simple:
    public void myMethod()throws Exception{
        for(int i = 0; i < paths.size(); i++){
            File file= new File(paths.get(i).toString());
            boolean made  = file.createNewFile();
             if(made){doSomething();}
    }

  • Which is better storing string values in Map or String buffer

    Hi,
    I have a store a 10 string values in a cookie. Do i use a String buffer and append all values or put it in a hash map.
    If i put in a string buffer i have to use a string tokenizer to loop and extract the values., but if i am using a map then
    retrieval will be easier, but in terms of memory management, which is better. as i have to create this cookie for every unique IP hitting my site.
    Thanks,
    Viiveek

    viiveek wrote:
    I have a store a 10 string values in a cookie. Do i use a String buffer and append all values or put it in a hash map.
    If i put in a string buffer i have to use a string tokenizer to loop and extract the values., but if i am using a map then
    retrieval will be easier, but in terms of memory management, which is better. as i have to create this cookie for every unique IP hitting my site. In terms of memory management, StringBuffer could potentially be better as there is no need to keep key objects in memory.
    That doesn't make it a good idea. The bytes of memory you'd lose by using a Map would be made up by the fact that Map was expressly made for storing key/value pairs. Memory management should be about the 200th factor you should consider.

  • 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 and why a = new String("AA") or a = "AA"

    Hi,
    Which is better and why
    String a = new String("AA") or
    String a = "AA"
    Does invoking a construtor waste memory? Please explain in detail.
    Thanks in advance
    Deepak

    > So in case "AA" not there in string pool,
    That is not correct.
    does new creates "AA" on string pool as well as heap memory?Yes. The literal "AA" points to a pooled String object. The new operator creates a new String object with the same character sequence ("AA"). You can verify this with a little code...
    String s = new String("AA");
    assert s != "AA";
    assert s.equals("AA");
    assert s.intern() == "AA";~

Maybe you are looking for

  • Itunes keeps freezing when i try to sync my ipod to it....

    Every time I try to sync my Ipod to Itunes it keeps freezing. I tried using wi-fi and usb way and it gets to step 3-4 and freezes, How do I get my Ipod to sync without it freezing.

  • Quicktime 7.7.1 plugin not displaying .tif legibly

    Since the update to Quicktime 7.7.1, I have not been able to view .tif files legibly in either Firefox (9.0.1 at the moment) or Chrome. I've tried updating the browser, disabling and re-enabling Quicktime, updating my system from 10.6.8 to 10.7.4, et

  • No accts maintained for company code clearing between comp.cds RTIL and RCP

    Dear sir i am stock transfer in one plant ot another plant  on 301MVT use in MB1B t code that time below error is showing No accts maintained for company code clearing between comp.cds RTIL and RCPL.

  • MSAccess Count Field incorrect problem

    Hello I am trying an update of Details, I traced the code along to it populated fields and verified values as correct.I am getting an error on the int resultCount = stmt.executeUpdate();             if ( resultCount != 1 ) {Why is this ? My error lin

  • Get Linked Document info into Purchase Order

    Hi, There is a popup which comes up upon pressing the attachment key in ME21N. This is currently blank. My requirement is to fill this popup with Linked Document Info from Material master into Purchase order at PO creation (ME21N). The fields that I