Select sql running very long when made to select many columns from a table

Hi,
I am using an Oracle DB 10g. I have a table with 250 columns and I need to select 200 columns out of them. The table holds around 0.1 million rows. But when I run the select sql it takes 15 mins to return .1 million rows. Where as if I select only 10 or 15 columns the sql runs in less than a minute returning same number of rows. My sql looks like below:
select p.col1,p.col2,.......,p.col200
from table Parent p;
The table also has a Primary key Index but it does not seem to be using it even when I forced an Index hint. Could you pls help?

961796 wrote:
I am using an Oracle DB 10g. I have a table with 250 columns and I need to select 200 columns out of them. The table holds around 0.1 million rows. But when I run the select sql it takes 15 mins to return .1 million rows. Where as if I select only 10 or 15 columns the sql runs in less than a minute returning same number of rows. My sql looks like below:
As Sven points out, it is likely that most of your time is network (and client) time. You are sending 20 times as much data (based on column counts, at any rate) across the network, and concerned that it's taking 15 times as long.
If you're testing from SQL*Plus then setting the arraysize to a value larger than the default might help.
If you have control over the SQL*Net settings then you may get some benefit by adjusting the SDU sizes at both ends of the link.
If you have control over the tcp configuration (transmit and receive buffer sizes) then you may get some benefit by adjusting these.
Simple test, by the way, if you're on SQL*Plus
set autotrace traceonly statistics
select ...This will dump your data in the bit bucket as it arrives giving you
a) the database time plus network time
b) some statistics including the volume of data down the network and the number of network round-trips that Oracle saw.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
Author: <b><em>Oracle Core</em></b>

Similar Messages

  • Query is running very long when I bring in an attribute

    I am running into an issue when i bring in an attribute from the filter.  It is taking a very long time to display.  When i run the same query against the DSO i copied form it runs fast but not on the one I copied.  what could be the issue.

    So, you copied an existing report to a new report. Both the reports are on a DSO. Old report runs fine, but the new report runs very long. Is all this correct?
    How is the new report different? You said something about an attribute. Are you just displaying this attribute or are you filtering the results using this new attribute?
    Without understanding your question clearly, here is my speculation: Your selection filters on the new query are not in any DSO index.
    If I misunderstood your question and scenario, then please clarify.

  • Easy Question:Select many rows from a table and execute BAPI for these rows

    Hi Experts,
    I have created one WD project. The WD project fetches some records of backend using BAPI and displays in a table. I have to select some rows from the table and then execute BAPI for selected rows.
    How I can select multiple records from the table and then execute another BAPI for selected rows.
    Regards,
    Gary

    Hi,
    In the Node which you binded to the table create one more attribute of type boolean.
    For example your node is as below:
    //Table Node
    TableNode
    > Att1
    > Att2
    > isSelected(boolean) - Newly created attribute for this requirement.
    //Result Node contains the elements selected in TableNode
    ResultNode
    >Att1
    >Att2
    Now in the table create one more Column with Checkbox as tablecell editor. Now bind this boolean attribute to that check box.
    Now in the code you can get the selected rows by user as below:
    for(int i=0;i<TableNode().size();i++)
      if(wdContext.nodeTableNode().getTableNodeElementAt(i).getIsSelected()==true)
        IPrivateTestView.IResultNode element=wdContext.createResultNodeElement();
        element.setAtt1(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt1());
        element.setAtt2(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt2());
       wdContext.nodeResultNode().addElement(element);
    Regards,
    Charan

  • Selecting only columns from a table

    Could someone help me with a SQL query to select all the columns in a table as an array?

    Hello
    if you are on 9i upward, you can define a pl/sql table of the rowtype and use bulk collect to populate that table, otherwise, you can create separate array types for each column:
    create table dt_test_tab (id number, col1 varchar2(10));
    insert into dt_test_tab values(1, 'X');
    insert into dt_test_tab values(2, 'X');
    insert into dt_test_tab values(3, 'X');
    insert into dt_test_tab values(4, 'X');
    insert into dt_test_tab values(5, 'X');
    commit;
    declare
        type tt_TestTab is table of dt_test_tab%rowtype index by binary_integer;
        type tt_TestTabid IS TABLE OF dt_test_tab.id%type index by binary_integer;
        type tt_TestTabcol1 IS TABLE OF dt_test_tab.col1%type index by binary_integer;
        lt_TestTab     tt_TestTab;
        lt_Id          tt_TestTabId;
        lt_col1        tt_TestTabcol1;
    begin
        --use the rowtype array
        select
             id,
             col1
        BULK COLLECT INTO
             lt_testtab
        FROM
            dt_test_tab;
       --use the individual column arrays
        select
             id,
             col1
        BULK COLLECT INTO
             lt_id,
             lt_col1
        FROM
            dt_test_tab;
        dbms_output.put_line('loop through the rowtype array');
        FOR x in lt_TestTab.FIRST..lt_TestTab.LAST LOOP
           dbms_output.put_line(to_char(lt_TestTab(x).id)||to_char(lt_TestTab(x).col1));
        end loop;
        dbms_output.put_line('loop through the two column arrays');
        FOR x in lt_Id.FIRST..lt_Id.LAST LOOP
           dbms_output.put_line(to_char(lt_Id(x))||to_char(lt_Col1(x)));
        end loop;
    END;

  • Selecting a column from a table conditionally

    I'm trying this select statement (example):
    select np.phone_number from name_phone np, reservation_general_view rgv
    where rgv.resort='HVILLA'
    In this table there is a column called "phone_type" and I only want my column to display values that are associated to the column when the "phone_type" = 'EMAIL'
    I tried this:
    select np.phone_number(select np.phone_number from name_phone np where np.phone_type='EMAIL')
    from name_phone np, reservation_general_view rgv
    where rgv.resort='HVILLA'
    This doesn't seem to work...can someone tell me how to do that?
    Message was edited by:
    JonnyOpera

    select phone_number from name_phone
    where resort='HVILLA'
    and phone_type='EMAIL'

  • UTLRP.SQL run very long, how to check ?

    Hello all
    Need your help and advice on my problem that i facing now,
    I did to recompile all the object in oracle using
    @UTLRP.SQL in $ORACLE_HOME\rdbms\admin
    The sql was running about 4 hours but still running, but actually i dont know is it hang or still running
    My question is
    - is this normal, since that already run for 4 hours
    - how to check whether is still running or hang, I did check on the task manager, the oracle.exe keep moving
    - Can i cancell it ? any problem later on if i cancel it ?
    - Is there any log to check
    Sorry so many question, need all of your advice
    Thanks in advance
    Cheers
    Surya

    You can check the decreasing number of invalid objects using below query:
    select count(*) from dba_objects where status = 'INVALID'You can also check session waits for that session that is running utlrp.sql
    With kind regards
    Krystian Zieja
    http://www.projectenvision.com

  • Selecting date column from a table

    hi
    I have a problem that looks wierd for me.
    I have a table called blog_post which has a date field called publish_date
    I have done this first.
    alter session set nls_date_format='dd/mm/yyyy';
    then
    SQL> select publish_date from blog_post;
    PUBLISH_DA
    09/07/2007
    02/07/2007
    02/07/2007
    02/07/2007
    09/07/2007
    now the wierd thing is that when i am selectin the same date it is not returning anything
    SQL> select publish_date from blog_post where publish_date='09/07/2007';
    no rows selected
    Thanks for any help.
    Ganesh

    I don't know anything about Hibernate, but the reason why you need to specify the trunc(publish_date) = to_date('09/07/2007','dd/mm/yyyy') is because of the way that Oracle stores date/time internally.
    It's labelled as a date field, but the time is automatically stored as well. So, if you're just wanting to compare the date to another date, you need to ignore the time part of the column - the trunc function does this.
    As for the "to_date(<date>, <date mask>)", well, you want to compare a date to a date, not a string. You could rely on the implicit conversion, governed by the nls settings, but I really, really, really wouldn't. In fact, I can't stress enough how much of a bad idea that would be! It's best to make things explicit.

  • Selecting columns from two table is slow but same

    I am selecting 27 columns from two tables
    which running for more than 30 minutes. but
    if I select count(*) with the same query
    except the columns it is coming in seconds.
    Where is the error?

    If you post
    1) The table definitions for the underlying tables
    2) The indexes that are on the tables
    3) The two SQL statements you're running
    4) The explain plan for both statements
    we can probably be of some assistance.
    My guess is that the count(*) is able to return much more quickly because the optimizer is able to use a significantly faster query plan that is based on an index which the longer-running query cannot utilize. Without the information I've requested, though, it's hard to do more than speculate.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Oracle 10gr2 Master/detail form running very slow when you navigate to the detail record.

    Hi All, I have a master detail  form, running in webserver, when I navigate to the detail block, the form start buffering and buttering for about 2 min. There is a trigger when-new-record instance that is firing when you navigate to  a new record : The select part of this stament is taken a long time to execute. I modified this in toad and what used to take 25 seconds to run is taken less than a second now, but the slowness still persists in the form.
    for rec in (select wrrh_col
                      wpbh_col_lvd,
                       wpbh_col_doc_no
          from wh_col,
               wkpl_col,
               wh_col
         where wrrh_col_no = :block.wreh_wrrh_col_no
           and wrrh_col_no = wreh_wrrh_col_no
             and wrrh_col_no = wpbh_col_no
           and wrrh_col_proj    = wpbh_col_proj
           and wrrh_proj_no     = wpbh_proj_no) loop
       if fun_name(rec.wpbh_col_lvd) = 'Y' then                      
        do something,
       end if;
      end loop;
    The select staement that used to run for 23 seconds is running in less than one second, but the form is still running very slow when I navigate to the detail record.
    Please advise.
    Thanks.

    Thanks Andrea for your prompt response, the problem is the select statement and like I stated, I tuned the select statement in toad and what normally takes 23 secs is taking less than 1 sec to run. If I comment out the call to the function, it is still slow. The select stament will returned null and it will still be slow. When I comment out the for loop, it run very fast. I dont know what else to do than tuned the select statement.

  • Adobe Premier pro running very slow when rendering a file

    Adobe Premier pro running very slow when rendering a file

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    The title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen. Click the Clear Display icon in the toolbar. Then take one of the actions that you're having trouble with. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    Some private information, such as your name, may appear in the log. Anonymize before posting.

  • My MacBook Pro is running very slow when using the internet and sometimes gives the pinwheel of death, any suggestions on how to fix?

    My MacBook Pro is running very slow when using the internet and sometimes gives the pinwheel of death, any suggestions on how to fix?

    <http://www.thexlab.com/faqs/sbbod.html>

  • Utlrp.sql takes very long (8 hours) while upgrade database from 9i to 10g

    1) Follow the note of 369693.1 ; and 362203.1 to upgrade database from 9.2.0.6 to 10.2.0.4 for e-business suite 11i (11.5.10.2)
    2) utlrp.sql takes very long (8 hours), even the job_queue_processes > 20.
    This is not acceptable for the upgrade in production environment which will take a long down time.
    Appreciate that any one can share tips on this, our database is about 400 GB, 4 CPU on production.

    in which our database has about 40,000 packages and 28,000 Virews. With this number of invalid objects, it is ok that utlrp.sql takes this time.
    using parallel worker of 4 for 2 CPUMake this 8 (4 * No. of CPUs).

  • MSCOBJCL.sql runs for long while applying patch 6678700 for 12.1.1 upgrade

    DB:11.2.0.3.0
    OS: IBM AIX Power system 64 bits 6.1
    Hi All,
    MSCOBJCL.sql runs for long while applying patch 6678700 for 12.1.1 upgrade. We are upgrading from 11.5.10.2.0 to 12.1.1
    Could anyone please share why the script takes so much of time to run?
    Thanks for your time
    Regards,a1_win

    As per Mscobjcl.Sql Is Running Long While Applying Patch.8671960 (Doc ID 1295881.1)
    The patch is already applied in the instance
    BUG_NUMBER CREATION_DATE
    8671960 19-SEP-10
    Thanks,
    a1_win

  • SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)

    SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)
    SELECT    
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO AS T0 LEFT OUTER JOIN
                          VPM2 AS T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
         OVPM AS T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1 AS T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate>='[%0]' and T0.DocDate<='[%1]'

    Hi,
    Try this:
    SELECT   
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO  T0 LEFT OUTER JOIN
                          VPM2  T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry
    LEFT OUTER JOIN
         OVPM  T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1  T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate >= '[%0]' and T0.DocDate <='[%1]'
    group by T0.DocStatus,T0.DocDate ,
    T0.DocNum ,
    T0.NumAtCard,
    T0.TransId ,
    T0.Comments ,
    T0.CardCode,
    T0.CardName ,
    T0.WTSum ,
    T3.DueDate ,
    T3.CheckSum
    Thanks & Regards,
    Nagarajan

  • Hello, I have a macbook pro late 2011 15 inch with 4 gb ram. My macbook runs extremely slow when logging in after waking up from sleep, locking up and I am unable to use the keyboard. Is there a fix?

    My macbook runs extremely slow when logging in after waking up from sleep, locking up and I am unable to use the keyboard. Furthermore, when just using safari to watch streaming television, my computer gets really slow, and locks up, and the dock appears blank and I sit here frustrated. Anytime i wake up my computer, my keys don't respond and I've waited at most 3 minutes untill i can type in my password. Even sometimes when i type in my password and hit enter, it takes forever to open up my mac. I have barely used any storage in my macbook, since i only use it for college, and I have run clamscan wiht no viruses showing... Any ideas?

    when just using safari to watch streaming television, my computer gets really slow, and locks up, and the dock appears blank
    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, or by a peripheral device. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including sound output andWi-Fi on certain iMacs. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

Maybe you are looking for