No of columns in a table and SQL performance

How does the table size effects sql performance?
I am comparing 2 tables , with same number of rows(54 million rows) ,
table1(columns a,b,c,d,e,f..) has 40 columns
table2 (columns (a,b,c,d)
SQL uses columns a,b.
SQL using table2 runs in 1 sec.
SQL using table1 runs in 30 min.
Can any one please let me know how the table size , number of columns in table efects the performance of SQL's?
Thanks
jeevan.

user600431 wrote:
This is a general question. I just want to compare table with more columns and table with less columns with same number of rows .
I am finding that table with less columns is good in performance , than the table with more columns.
Assuming there are no row chains , will there be any difference in performance with the number of columns in a table.Jeevan,
the question is not how many columns your table has, but how large your table segment is. If your query runs a full table scan it has to read through the whole table segment, so in that case the size of the table matters.
A table having more columns potentially has a larger row size than a table with less columns but this is not a general rule. Think of large columns, e.g. varchar2 columns, think of blank (NULL) columns and you can easily end up with a table consisting of a single column taking up more space per row than a table with 200 columns consisting only of varchar2(1) columns.
Check the DBA/ALL/USER_SEGMENTS view to determine the size of your two table segments. If you gather statistics on the tables then the dictionary will contain information about the average row size.
If your query is using indexes then the size of the table won't affect the query performance significantly in many cases.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/

Similar Messages

  • How do I add more than one column to a table using SQL?

    Hi
    I need to add 3 columns to a table using SQL
    the syntax
    "ALTER TABLE TEST ADD COLUMN newcol1 float";
    works fine - for adding one coumn only.
    For multiple columns I tried various permutations along the lines of
    "ALTER TABLE TEST ADD (COLUMN newcol01 float, COLUMN new2 float,COLUMN new3 float)";
    "ALTER TABLE TIPSTEST ADD COLUMN new1 float"
    "ALTER TABLE TIPSTEST ADD COLUMN new2 float"
    "ALTER TABLE TIPSTEST ADD COLUMN new3 float"
    etc., but this doesn't work.
    From a web search it sounds like SQL can only add one column at a time.
    I have a workaround : create intermediate temporary tables , copying data and adding
    one column at each stage. It seems a fairly awkward way of programming though.
    Am I missing something simple : is there a way to add multiple columns in one go?
    Thanks

    OK : solved an underlying problem with this one myself
    for the code
    String createString;
    createString =  "select COFFEES.* INTO NEWCOFFEES FROM COFFEES"; // example
              Statement stmt;
              try {
                   stmt = a_Globals.database1Connection.createStatement();
                          stmt.executeUpdate(createString);
                   stmt.close();
                   a_Globals.database1Connection.close();
              } catch(SQLException ex) {
                   System.err.println("SQLException: " + ex.getMessage());
              }                    commenting out the line:
    a_Globals.database1Connection.close();
    Allowed the subsequent SQL statement(s) to work OK. Looks like this was the cause of several
    difficulties, preventing me doing several SQL instructions in turn.
    Thanks for the responses.
    Mike2z

  • How to provide joins between oracle tables and sql server tables

    Hi,
    I have a requirement that i need to generate a report form two different data base. i.e Oracle and Sql Server.
    how to provide joins between oracle tables and sql server tables ? Any help on this
    Regards,
    Malli

    user10675696 wrote:
    I have a requirement that i need to generate a report form two different data base. i.e Oracle and Sql Server. Bad idea most times. Heterogeneous joins do not exactly scale and performance can be severely degraded by network speed and b/w availability. And there is nothing you can do in the application and database layers to address performance issue at the network level in this case - your code's performance is simply at the mercy of network performance. With a single glaring fact - network performance is continually degrading. All the time. Always. Until it is upgraded. When the performance degradation starts all over again.
    If the tables are not small (few 1000 rows each) and row volumes static, I would not consider doing a heterogeneous join. Instead I would rather go for a materialised view on the Oracle side, use a proper table and index structure, and do a local database join.

  • Virtualised Servers and SQL  performance

    Virtualised Servers and SQL  performance
    A client would like to virtualise their Servers as this will enhance their redundancy.
    This will include their SQL Server where SAP B1 is running on.
    I would like to know whether this will be a good idea concerning SQL performance. (it is said that it does have a negative impact.)
    Specs concerning the company:
    1.     They would like to set up a ZEN layer u201CLinuxu201D and then run their virtual machines from it on a SAN format, and use another server as redundancy.
    2.      Their SBO Companyu2019s total to about 30 gig.
    3.     They have about 100 users 30% log on using Citrix.
    Can anyone tell me if this would be a good solution for them, or is it a complete no no concerning performance?
    Thank you

    Hi,
    We have done exactly what your client wants to do and I would strongly recommend to spend a significant amount of time testing performance. AddOns are loading normally (Sachin, you should check if you don't have 2 network cards on your license server).
    However, I am still not convinced that it is the best solution in terms of performance. If I had to do it again, I would probably have 2 physical SQL servers with full redudency instead.
    Vincent

  • How to add the values of all selected columns in a table and display it ?

    Hi all,
    I am using jdeveloper 11.1.1.6.0
    Page:
    my page jsff page contains one ADF table and one textbox
    DB:
    i have two database tables A & B ,
    i need 2 columns from each table . say (A.product_no ,A.product_name,B.prodeuct_price ,B.confirm)
    here product_no is primary key and present in both tables.
    i need to create a VO combining these two tables and put it as ADF table in a jspx page
    Functionality :
    my 'confirm' field is a checkbox field in table . whenever the checkbox is selected,
    the corresponding price will be getting added and display it in a textbox.
    Eg:
    if my first 4 price values are 3000 , 2000 ,4000,2000
    and if i select first 3 values , then the text box should contain 9000 value.
    i need help ...
    Problem:
    i need help in creating VO and functionality part

    Hi,
    it is easy: create an entity object for every table and one view object where you select your both entity objects and join them in your select statement.
    Your desired 'confirm' functionality could be achieved with helpp of view object transient attributes - for more information see: http://docs.oracle.com/cd/E21764_01/web.1111/b31974/bcquerying.htm#CHDHJHBI
    Regards
    Pavol

  • Sort table columns in a table and context created dinamically

    Hello all,
    I have implemented the table sorting several times in another developments, but now I'm facing a problem.
    I have created the table and context node that I need to sort dinamically (before somebody ask me why, I would say that it's the only way to do that for my current project, there was no possibility of doing that in dessign time). I have implemented the table sorting more or less the same way I would do with a table created in dessing time, but when I run my WD the sorting of columns doesn't work.
    In the wdDoModifyView, I have put the following code:
    if(firstTime){
    IWDAction ordenacion     = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ORDENACION,  null);
    IWDParameters param = ordenacion.getActionParameters();
    param.addParameter("nombreNodo",nombreNodo);
    and in the code of the action
        //@@begin onActionOrdenacion(ServerEvent)
         System.err.println("**** NOMBRE NODO **** "+nombreNodo);
         wdContext.currentContextElement().getTableSorter().sort(wdEvent, wdContext.getChildNode(nombreNodo, IWDNode.LEAD_SELECTION));
        //@@end
    The name of the node ("nombreNodo) it's only correct the first time I click on a column.
    Has anybody implemented the table sorting in a dinamically created table and context node? And how do you do to make it works.
    Thank you very much

    Here is the code
    //Preparamos Navegaciones
    IWDAction abrirProyecto = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ABRIR_PROYECTO, null);
    IWDAction abrirDisp     = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ABRIR_DISPONIBLE,  null);
    //IWDAction ordenacion     = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ORDENACION,  null);
    IWDAction ordenacion=wdThis.wdGetOrdenacionAction();
    IWDParameters param = ordenacion.getActionParameters();
    param.addParameter("nombreNodo",nombreNodo);
    IWDTable table = wdThis.wdGetInformesController().crearTabla(view, nombreNodo, movimientosInfo,new String[]{"Codi Projecte",null,"Nom Projecte", "Import Projecte", "Client", "Increment Disponible futur per facturació no emesa i / o anualitats pendents","Increment Disponible futur per ingressos pendents de cobrar", "Disponible"},new String[]{"10px", null,"10px", "10px","10px","10px","10px","10px"},new IWDAction[]{abrirProyecto,null, null, null, null,null,null,abrirDisp}, -1);
    //ordenar tabla
    wdContext.currentContextElement().setTableSorter(new TableSorter(table, ordenacion,null));
    containerTablasProyecto.addChild(table);
    Edited by: Mireia Romo on May 28, 2009 12:27 PM

  • HOW TO RETRIEVE A LONG RAW COLUMN FROM A TABLE AND WRITE TO OS FILE

    Good evening.
    Please how can I read a long raw datatype from a table and insert into an operating system file using PL/SQL.
    Thank you.

    What does this have to do with LONG RAW? It is about UTL_FILE and not especially great code.
    The question is how to retrieve and write LONG RAW and that is quite a different matter.
    First you must convert it to BLOB.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:13213885403654
    Then you can write it out to the file system
    http://www.morganslibrary.org/reference/utl_file.html
    Look at the "Extract Blob" demo

  • Request: PL/SQL, External Table and SQL Loader

    I see lately Questions asked in SQL and PL/SQL forum regarding SQL Loader and External Table are being moved to {forum:id=732}.
    Being an PL/SQL developer for some time now i feel External Table (and if i may, SQL Loader and DBMS_DATAPUMP) are very much an integral part of a PL/SQL development and the question related to these topics are well suited in SQL and PL/SQL forum. Even in SQL and PL/SQL FAQ we have exclusive content that discuss on these topics {message:id=9360007}
    So i would like to request the moderators to consider not moving such questions out of the SQL and PL/SQL forum.
    Thanks,
    Karthick.

    Karthick_Arp wrote:
    I see lately Questions asked in SQL and PL/SQL forum regarding SQL Loader and External Table are being moved to {forum:id=732}.
    Being an PL/SQL developer for some time now i feel External Table (and if i may, SQL Loader and DBMS_DATAPUMP) are very much an integral part of a PL/SQL development and the question related to these topics are well suited in SQL and PL/SQL forum. Even in SQL and PL/SQL FAQ we have exclusive content that discuss on these topics {message:id=9360007}
    So i would like to request the moderators to consider not moving such questions out of the SQL and PL/SQL forum.
    Thanks,
    Karthick.Not sure which moderators are moving them... cos it ain't me. I'm quite happy to leave those there.

  • Adding a column to a table in SQL

    My problem is a bit more complex, but I want to try and figure it out piece by piece. First, a table gets pulled into a temporary table ("data" table to "#r1" table). Second, another table gets pulled into a separate temp table ("data2" table into "#r2"). Finally, the temporary tables are combined into a third table (join where blah, blah, blah).
    Okay, here is problem: both tables contain a date column, "data" has actual dates and "data2" has NULL values (which is okay). I want to add a column to the end of the third table; if there is a NULL value in the date, place a "0" (zero), if it has an actual date (example, 5/5/08), place a "1".
    How do you solve this? I've tried and keep getting errors further down the code.

    Okay, cool, thanks Frank. Now it moves on...the third table that I was talking about gets used multiple times down the code; do I have to modify every procedure that extracts from this table? Because the table that I need to have it show the last column result ("0" or "1") is actually four tables down into the code (each time the table is transferred and renamed). It goes from the raw data into temporary tables, then into permanent tables, back to temporary tables, and finally into my end result.
    By the way, I didn't write this original code, someone else did and now I'm stuck trying to modify it.

  • How to add description of a column of a table in SQL Azure

    Hi
    I have some tables in my application database where there are descriptions added against certain columns. Needless to say they were done by using sp_addextendedproperty.
    Now I am trying to migrate the Database to SQL Azure. SQL Azure does not support sp_addextendedproperty.
    Hence I am not able to figure out how to add descriptions to those columns.
    Any help would be much appreciated.
    Thanks
    Soumyadeb

    Hello,
    Just as Latheesh post above, Windows Azure SQL database are not support extended stored procedures. That’s one of the limitations on SQL database, and I don’t know there is another way to achieve the same on Azure.
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • Self referencing table and SQL statement

    In my database, I have a self-referencing table, the table itself is for projects, and it allows users to get a hierarchical view of the company.
    Here is the SQL (modifier is the term we use for project code, BBCI is the top project)
    SELECT
    modifier, modifierDescription, level
    FROM
    modifier
    WHERE
    level <= 2
    CONNECT BY PRIOR
    modifier = parentModifier
    START WITH modifier = 'BBCI'
    ORDER BY level
    That perticular query gets the first two levels in the structure. I use this information to produce a tree structure in a web app.
    But users have requested it would be good if in the tree structure is showed an + or - depending on whether there were anymore children under each parent, or better still the number of children under it, for example
    BBCI
    + BBCI_CHILD
    + BBCI_CHILD2
    - BBCI_CHILD3
    or
    BBCI
    + BBCI_CHILD (3 projects underneath)
    + BBCI_CHILD2 (2 projects underneath)
    - BBCI_CHILD3 (0 projects underneath)
    I am really stumped on this issue, and I am sure there is a way to do this in the web app, so for example do a query for each child node to see how many child nodes are underneath, but I figure it would be a lot tidier and faster if I could do it from a single SQL statement. Unfortunately I have tried to do this and am very much stuck.
    If you need more information please let me know
    Thanks!
    Jon

    You may be able to do this using analytical functions but it depends on the Oracle version you are using. It can also be done with standard SQL - you just need to count the number of child rows for each modifier/project first and supply that list as an in-line view:
    SELECT decode(modifier,'X',null,decode(child_rows,null,'-','+')),
    m.modifier,
    decode(modifier,'X',null,'('||nvl(cq.child_rows,0)||' projects underneath)')
    FROM modifier m,
    (select parentModifier,
         count(parentModifier) child_rows
    from modifier
    where parentModifier is not null
    group by parentModifier) cq
    WHERE m.modifier=cq.parentModifier(+)
    AND level <= 2
    CONNECT BY PRIOR
         m.modifier = m.parentModifier
    START WITH modifier = 'X'
    ORDER BY level, modifier;
    which gives you something like...
    D MODIFIER DECODE(MODIFIER,'X',NULL
    X
    - Y1 (0 projects underneath)
    + Y2 (2 projects underneath)
    + Y3 (3 projects underneath)
    The decode stuff is just to show you the result, you can format the output in your calling code. Just extend the columns to include everything you want, modifierDescription etc..
    Hope this helps.

  • Why mandatory columns of  Base tables and interface are differant?

    Hi guys , i have load supplier into AP(ap_suppliers) through Interface table(ap_suppliers_int) but my confusion is that ap_suppliers have 8 mandatory columns but it's interface ap_suppliers_int have only 2 mandatory column.why?and also with these 2 columns records are also loading.
    Regards,
    Shakeel khan

    Hi Shakeel,
    If you are using 12.0, data in AP_SUPPLIERS is not imported from AP_SUPPLIERS_INT table, data in AP_SUPPLIERS_INT corresponds to data in PO_VENDORS(Vendors data Maintained in 11i).
    If its 11i, If Segment1 is NULL, its generated from below sql,
    SELECT user_defined_vendor_num_code
    INTO l_ven_num_code
    FROM financials_system_parameters;
    And if summary flag is NULL its inserted 'N' and if Enabled Flag is NUll its inserted as 'Y'.
    The rest are WHO columns.
    Refer to AP_PO_VENDORS_APIS_PKG for additional info on this.
    Hope this helps.
    Thanks,
    Kiran

  • How to read BLOB column from a table in SQL or PL/SQL

    I have table which is having one BLOB data type column . Ihave inserted few rows in that table . Now i want to see wheather BLOB column has been inserted properly or not . How to read that column through SQL or PL/SQL.
    Can anyone help me to do this.

    You can only manipulate LOBs in PL/SQL because you have to use the DBMS_LOB package.
    Check out the Oracle Developer's Guide

  • Get Total of a Column of Advanced Table and use it in Controller in OAF

    I have an advanced table on my custom page. I am calculating total of a column in my footer. I am acheiving this using the standard functionality of advanced table by setting total value property of my column to "TRUE" and displaying the total in the tablefooter components.
    In addition to this I want to retreive the total value from my footer and use it in my Controller for further validations but I am not able to acheive this.
    I tried some code already present in the Community for the same but nothing turned out right for me.
    Can anyone please help me on this.

       Hi there ,
      You can manually add the values of each row of a  column and make use of the value obtained in your controller .
    Here is the logic ,
    1) get the vo instnace attached to that table .
    2) Loop through every single row in the table .
    3) get the value and sum up the value and use it in your controller .
    int fetchRowCount = vo.getFetchRowCount();  
    voRowImpl row = null;  
    int count =0;
    if (fetchRowCount  > 0) { 
    RowSetIterator iter = vo.createRowSetIterator("Iter"); 
    iter.setRangeStart(0);
      iter.setRangeSize(fetchBidderRowCount);
       for (int i = 0; i < fetchBidderRowCount; i++) {
      row = voRowImpl iter.getRowAtRangeIndex(i);
       //use RowImpl getters   10.   
             Number personId = row.getPersonId();
    count =personId+count;         // add each and every value and have in variable
    iter.closeRowSetIterator();
    Regards ,
    Keerthi

  • Insert direct column from database table and function value into a table

    Hi All,
    Please resolve this query for me....
    Suppose my select query is like this
    Select empno from EMP; (simple select)
    Select fun_dept(empno) from dual;(function)
    i want both the output of the select query to be written into a table like this....
    Suppose out of the First Select query is ..... 45009
    Output for the Second Query is...................ECE
    i want to insert this output into a table...like
    something like this
    XX:
    Empno Dept
    45009 ECE
    how to do this..??
    Thanks in Advance,
    Regards,
    Gita

    My exact query is like this.
    create or replace function fun_sal(v_rno number,v_year number,v_period number)
    return number as
    cursor s is
    select salary from emp where eno=v_rno and eyear=v_year and eperiod=v_period;
    begin
    open s;
    loop
    exit when s%notfound;
    fetch s into v_sal;
    if v_sal<1000 then
    sal:=v_sal*1555;
    else
    sal:=0;
    return sal;
    end if;
    end loop;
    close s;
    end;
    create or replace procedure pro_act(v_rno number,v_year number,v_period number) as
    v_eno number(10);
    v_ename varchar2(10);
    cursor c is
    select eno,ename from emp where eno=v_rno and eyear=v_year and eperiod=v_period;
    begin
    open c;
    loop
    exit when c%notfound;
    fetch c into v_eno,v_ename;
    insert into master(empno,empname,rev_salary)values(v_eno,v_ename,"*****function fun_sal value has to come here*******");
    commit;
    end loop;
    close c;
    end;
    how to do....

Maybe you are looking for

  • Laptop for Premiere CS6

    Hi All I  check buy this laptop for editing video via Premiere CS6. FHD via effects. If it is good enough? Lenovo Ideapad y70-70 Cpu : i7 4710HQ Ram: 16gb ddr3 GC:  Nvidia gforce gtx 860m 4gb HD: 256 SSD Thanks Best Regards

  • How to use the result from a taglib?

    Hi people. I've been looking arround for some feedback on how to use the output generated by a taglib on jsp code but I haven't been able to find any. Could somebody tell me how to do that please?

  • My report not accepting desformat=delimiteddata

    My report not accepting desformat=delimiteddata...when i open help of rwservelt, It was not a valid value for DESFORMAT parameter. Actually I want output of my paper layout in Excel. May I have to download any patch for this? if yes then provide the

  • Where can I get the plug in for firefox so I can view like internet explorer...

    where can I get the plug in for firefox so I can view like internet explorer...

  • FC Crashes and enjoys using 1 GB of RAM

    Hello All, I am creating an interactive timeline and have imported artwork from Illustrator, optimized many of the vector graphics (still need to edit some of the vectors, so I do not want to optimize all yet), and I keep the size of the resulting SW