In terms of performance which is better?

Hi I have a query ...
I have table t1 which has 1.5 million records .
now ,
which will be a better option ?
Pls note I need to do it at run time from a procedure.
create procedure p1
is
begin
execute immediate 'create table tidup nologging parallel as select * from t1';
end;
Or having the structure and do inserts in append mode ?
say ,
create procedure p1
is
begin
insert /*+append*/ into  tidup select * from t1;
Commit;
end;
I knew that a DDL is far faster than a DML .
Kindly let me know if I am correct or is inserting in append mode is faster ?
Regards
SHUBH

Hi I have a query ...
have table t1 which has 1.5 million records .
now ,
which will be a better option ?The one that runs the fastest, obviously.
Pls note I need to do it at run time from a
procedure.
create procedure p1
is
begin
execute immediate 'create table tidup
nologging parallel as select * from t1';
nd;Creating tables at runtime is a bad idea. If you need temporary tables, use Global Temporary Tables.
Or having the structure and do inserts in append mode
say ,
create procedure p1
is
begin
insert /*+append*/ into  tidup select * from
t1;
Commit;This would be better than the first option in terms of sensible coding.
I knew that a DDL is far faster than a DML .Oh really? Kindly provide proof of this.
Kindly let me know if I am correct or is inserting in
append mode is faster ?Logically think about it.
1 = Create Table and Insert Records
2 = Insert Records
Which do you think may take a smidgen longer to perform?

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 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:  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, 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.

  • 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

  • Which is better? ArrayList or LinkedList

    Do you know which one is better between ArrayList and LinkdedList in terms of performance, speed and capacity?
    Which one do you suggest to use ?
    Thanks

    It depends upon how the list is going to be used. ArrayLists and LinkedLists work differently -- you need to think about how they each store their data.
    ArrayLists store their list items in, well, arrays. This makes them very fast at addressing those items by index #. So any implementation that needs a lot of random access to the list, such as sorting, is going to be relatively fast.
    The downside of storing the list in an array presents itself when it comes time to add more items to the list. When it runs out of space in the array, it must create a new larger array and copy the items over to it. Also, if you need to insert or remove an item anywhere other than the end of the list, ArrayList must shift the subsequent items in the list by doing an array copy.
    This can be a real drag if you're implementing a queue. This is where LinkedList shines. Each item in the list points to the next and previous ones in the list. Inserting, appending or removing list items involves a couple simple assignment statements. No reallocations or large memory copies are involved. Access is easy as long as it is sequential.
    Random access in a linked list is problematic however. In order to get to the Nth item in the list, LinkedList must start with the first item in the list and step through the list N-1 times. An order of magnitude slower than using an ArrayList.

  • Airport Base station (g) and Express (g) - Which is better?

    I have both from an older wireless system in the house. Both were replaced by a new Time Capsule, which is an (n) system, of course. I currently use the older base station for my printer so all computers can use it wirelessly. The Express is at the other end of the house supplying wireless to my entertainment center.
    The Q: would it be better to move the base station to the entertainment center, or would it even make a difference. It seems it wouldn't matter, but I thought I would ask anyway.

    The Q: would it be better to move the base station to the entertainment center, or would it even make a difference. It seems it wouldn't matter, but I thought I would ask anyway.
    Let's review the absolute best way to connect and then work back from there so you can make a decision based on your requirements.
    The "best" connection in terms of performance (speed and network bandwidth) is always a wired ethernet connection. Newer routers and computers will allow Gigabit speeds between devices up to 300+ feet away. In terms of numbers, that's 1000 Mbps.
    The very best 802.11n 5 GHz wireless systems will allow up to 300 Mbps bandwidth. Most "n" wireless systems are operating at 2.4 GHz, which will allow up to 130 Mbps. I think you may already be seeing where this is going.
    Now, the bandwidth (speed capability) on any wireless system falls off in proportion to the distance from the main router to the device receiving the signal. It's not exactly accurate, but safe to say that a device at 50 feet from the main router is only going to get about half of the signal that a device at 25 feet will get.
    So, with wireless, the rules are always the same. The closer a device is to the broadcast source, the better the performance. Any obstructions like walls or ceiling that absorb the signal come into play as well.
    I think you have your answer.

Maybe you are looking for

  • HP Deskjet 3510 Series (3512) only printing in black and yellow.

    Hello. My HP Deskjet 3510 recently ran out of ink (or so I thought.)  I purchased new 61xl color and black cartridges and replaced them.  However, the printer is only printing in black or yellow.  I am unable to get any red, blue, or grayscale.  I ha

  • "did not respond"-i've tried everything

    I have been spending the last 2 weeks trying to get the AV to work to no avail. I've spent over 40 hours of my time. As a first time Apple user, I wish I had stayed with XP and saved myself $2500 and lot's of frustration. How can Apple market this so

  • Manage On Demand Does Not Work on the Web Site

    Trying to Manage on Demand on the web site.  Page does not load correctly.  IE Crashes.  Firefox just does not work.  Something wrong with the web site.

  • Running total with specific criterea

    Hey Everyone, Quick question I hope. I have report that we want to add a running total of all records in the report that contain the numbers 1100 to 1400. What I have been trying to currently do is create running total sum that uses a formula to eval

  • Spreadsheet Columns -- How to Name?

    I've learned how to Define the Names of Columns but what I want to do is change the A, B, C, D etc in a spreadsheet column to a name like Author -- so that it shows instead of A, B, C, D across the top and leave a1, b1,c1,d1 empty to add content? I w