Create table as select statement (ETG) takes a long time.

Hi all

One of my procedure launched a table create as select statement each month.
Usually it ends in 20 minutes. for 6172063 records and 1 hour in 13699067.
But this time it never even takes to 38076 records.
When I checked everything he does is the CPU usage. No e/s.
I did a count (*) using the query, it has brought very good results.
BUT guard going on DEC.
I use Oracle 10.2.0.4.
temp_ip of the main table has 38076
table nhs_opcs_hier has 26769 records.
and table nhs_icd10_hier 49551 records.
-------------------
Query is:
create the table analytic_hes.temp_ip_hier as
Select b.*, (select nvl (max (hierarchy), 0))
of ref_hd.nhs_opcs_hier one
where fiscal_year = b.hd_spell_fiscal_year
and a.code in
(primary_PROCEDURE, secondary_procedure_1, secondary_procedure_2,
secondary_procedure_3, secondary_procedure_4, secondary_procedure_5,
secondary_procedure_6, secondary_procedure_7, secondary_procedure_8,
secondary_procedure_9, secondary_procedure_10,
secondary_procedure_11, secondary_procedure_12)) as hd_procedure_hierarchy,
(select nvl (max (hierarchy), 0) for ref_hd.nhs_icd10_hier one)
where fiscal_year = b.hd_spell_fiscal_year
and a.code in
(primary_diagnosis, secondary_diagnosis_1,
secondary_diagnosis_2, secondary_diagnosis_3,
secondary_diagnosis_4, secondary_diagnosis_5,
secondary_diagnosis_6, secondary_diagnosis_7,
secondary_diagnosis_8, secondary_diagnosis_9,
secondary_diagnosis_10, secondary_diagnosis_11,
secondary_diagnosis_12, secondary_diagnosis_13,
secondary_diagnosis_14)) as hd_diagnosis_hierarchy
of analytic_hes.temp_ip b
-----------------

Any help would be greatly appreciated

Hello

It is a bit of a wild card, I think because it will require 14 scans to fill the table temp_ip to unpivot codes diagnostic and procedure, so this lilkely things are moving slower than the original. However, as it is a temporary table, I guess you could have some control over its structure, or at least be able to dismiss it and try something else. If you are able to change the structure of this table, you could make the application much simpler and probably much faster. I think that you need a list of codes of procedure for the year and a list of diagnosis for fiscal codes. I do this through the large list of UNION all THE INSTRUCTIONS, but you can have a more efficient way to do according to the base tables you are people temp_ip of. In any case, it's here (as far as I can tell this will do the same job)

WITH codes AS
(   SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        primary_PROCEDURE       procedure_code,
        primary_diagnosis       diagnosis_code,
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_1    procedure_code,
        secondary_diagnosis_1    diagnosis_code
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_2    procedure_code ,
        secondary_diagnosis_2    diagnosis_code
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_3    procedure_code,
        secondary_diagnosis_3    diagnosis_code
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_4    procedure_code,
        secondary_diagnosis_4    diagnosis_code
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_5    procedure_code,
        secondary_diagnosis_5    diagnosis_code
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_6    procedure_code,
        secondary_diagnosis_6    diagnosis_code
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_7    procedure_code,
        secondary_diagnosis_7    diagnosis_code
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_8    procedure_code,
        secondary_diagnosis_8    diagnosis_code
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_9    procedure_code,
        secondary_diagnosis_9    diagnosis_code
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_10  procedure_code,
        secondary_diagnosis_10    diagnosis_code
    FROM
        temp_ip
    UNION ALL
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_11  procedure_code,
        secondary_diagnosis_11    diagnosis_code
    FROM
        temp_ip
    SELECT
        bd.primary_key_column_s,
        hd_spell_fiscal_year,
        secondary_procedure_12  procedure_code,
        secondary_diagnosis_12    diagnosis_code
    FROM
        temp_ip
), hd_procedure_hierarchy AS
(   SELECT
        NVL (MAX (a.hierarchy), 0) hd_procedure_hierarchy,
        a.fiscal_year
    FROM
        ref_hd.nhs_opcs_hier a,
        codes pc
    WHERE
        a.fiscal_year = pc.hd_spell_fiscal_year
    AND
        a.code = pc.procedure_code
    GROUP BY
        a.fiscal_year
),hd_diagnosis_hierarchy AS
(   SELECT
        NVL (MAX (a.hierarchy), 0) hd_diagnosis_hierarchy,
        a.fiscal_year
    FROM
        ref_hd.nhs_icd10_hier a,
        codes pc
    WHERE
        a.fiscal_year = pc.hd_spell_fiscal_year
    AND
        a.code = pc.diagnosis_code
    GROUP BY
        a.fiscal_year
)
SELECT b.*, a.hd_procedure_hierarchy, c.hd_diagnosis_hierarchy
  FROM analytic_hes.temp_ip b,
       LEFT OUTER JOIN hd_procedure_hierarchy a
          ON (a.fiscal_year = b.hd_spell_fiscal_year)
       LEFT OUTER JOIN hd_diagnosis_hierarchy c
          ON (c.fiscal_year = b.hd_spell_fiscal_year)

HTH

David

Tags: Database

Similar Questions

  • ALTER TABLE SHRINK the SPACE COMPACT takes a long time

    Hello
    I run:
    ALTER TABLE TOM. TAB1 SHRINK SPACE COMPACT;
    ALTER TABLE TOM. TAB1 SHRINK SPACE WATERFALL;


    The "ALTER TABLE TOM. Tab1 SHRINK SPACE COMPACT"was completed in 2 hours, but"ALTER TABLE TOM. Tab1 SHRINK SPACE WATERFALL"is still underway after 8 hours, less than the size of the table TAB1 and index:

    NOM_SEGMENT... GB
    TAB1................................. 166
    IDX01................................ 83
    SYS_C00......................... 42
    IDX02............................. 142
    IDX03.............................. 66
    IDX04............................. 122


    Why 'SHRINK the SPACE COMPACT' takes a lot of time?
    Is it possible to check how much time should I take?

    Thanks in advance!

    Running

    ALTER INDEX TOM. TAB1_IDX03 SHRINK SPACE COMPACT;

    ALTER INDEX TOM. TAB1_IDX03 SHRINK SPACE;

    set is useless, as does 'SHRINK the SPACE' that means "SHRINK SPACE COMPACT" and much more (see the quote from the Doc Oracle Hemant).  2, 'SHRINK the SPACE' is the operation that will take more time.  So if 'SHRINK the SPACE' is what you wanted (reclaim space) and you can afford to wait, run 'SHRINK the SPACE' only.

    "SHRINK the COMPACT SPACE" is a part of the work that 'SHRINK the SPACE' is only.  Generally, use you it when time is at a premium: you run SHRINK SPACE COMPACT a weekday evening (because SHRINK the SPACE does not fit in one night and accrue hourly) and you run SHRINK SPACE on the weekend to finish following the recovery of your space.

    Regarding the fact that the entire segment or a partition after another, I have no experience - I both of their time and test methods.  Perhaps running several sessions at the same time on different partitions would save time (but be more heavy on the CPU and storage).

    Also note that SHRINK the AREA generates a lot of REDO (keep an eye on the free space of your ARCHIVELOG destination).  With your data volume, I would expect dozens (or even hundreds) of gigabytes of roll forward must be generated.

  • Select the query takes a long time to run the second time

    Hi all

    I have Oracle 11 GR 1 material in windows server 2008 R2.
    I have a few tables with 10 million documents. When I run the select query to the tables of first time, it gives me a result in 15 seconds, but if I run the script even twice in the same session, I get the result in 15 minutes to complete...

    Why it's happening? What can be the solution for this?

    Thank you and best regards,
    Vikash jain (DBA Junior)

    What I know is that this feedback from cardinality generates more problems than improving the performance is, in fact, its main objective. But first look at which is was written in the link I posted above

    "Return of cardinality was introduced in the Oracle 11 g database 2. The purpose of this function is to automatically improve plans for queries that are executed repeatedly, _For that the optimizer does not estimate the cardinalities in the properly_ plan"

    If the cardinality feedback kiks in your case it is certainly because you do not have an exact statistics. Get the command the explain plans that I have shown you with the E-lines and A-lines (lines estimates and actual lines) and see where things are poorly estimated.

    If you want to disable the cardinality feedback then add the indicator according to your request

    /*+ opt_param('_optimizer_use_feedback','false') */
    

    Best regards

    Mohamed Houri
    www.hourim.WordPress.com

    Published by: Mohamed Houri on November 22, 2012 02:11
    Published by: I was looking for the exact indication of how do I deactivate the cardinality feedback and I foud in an ot the Dominic post in otn :-)

    Published by: Mohamed Houri on November 22, 2012 02:15

  • Query takes a long time

    Hi Experts

    I'm using Oracle 11 g, I use under delete query to remove records of staging table.

    under query takes a long time (ranging from 1 hour, even there is no record to delete.

    I created payment_id indexes also did not help.

    delete from siebelwb.stg_p where payment_id not in (select * from siebel.s_src_payment)

    I know NOT of IN is degreding performace, is there another way to write above request so that we can remove them in NOT IN use.

    Try to use NOT EXISTS clause...

    Also you inner query must match the payment_id with query parent then here's the example query...

    removal of siebelwb.stg_p where THERE is NO payment_id (select 1 from siebel.s_src_payment where s_src_payment.payment_id = stg_p.payment_id)

  • create table as select or parallel table / * + parllel() * /.

    Dear Experts,


    I have two huge table almost 300 GB each.
    create table as 
    select * from table t1 ,t2
    where t1.row_id=t2.row_id
    How to run this query in parllelism. Withou Parlell, it takes too much time.

    as it should be
    create table parallel 15 as 
    select * from t1,t2;
    or in another way

    and if it was it y 3 table to join to

    My * wrote:
    Dear Experts,

    I have two huge table almost 300 GB each.

    create table as
    select * from table t1 ,t2
    where t1.row_id=t2.row_id
    

    How to run this query in parllelism. Withou Parlell, it takes too much time.

    as it should be

    create table parallel 15 as
    select * from t1,t2;
    

    or in another way

    and if it was it y 3 table to join to

    What happens if the slowdown occurs on SELECT it & not create?

  • Update statement takes a long time...

    Hi, I'm below the update statement to update a table, which takes a long time (more than 4 hours).
    The credit of table has records 3crore and temp 22 k table records.
    Is there a better way to write this. A merger may be used?

    Update credit subpartition (pc_2011) pc set pc.principal = (select temp t.principal t where t.pc_id = pc.pc_id);

    Please help me.
    How abt merge...
    
    MERGE into credit SUBPARTITION (pc_2011) pc
                            using temp t
                            On(t.pc_id = pc.pc_id)
                            when matched then update set
                            pc.principal=t.principal
    
    plz post your oracle version...
    
  • The system preference takes a long time to load

    As the title suggests, end of 2013 (10.11.4) System Preferences on my iMac takes a long time to load, even after a fresh reinstall and/or reboot (tried both). It takes about 20 seconds to one minute each time to open (except when I close it and immediately open it once again, as it is always loaded in memory). This problem existed only after the upgrade to El Capitan, and I saw many other people with iMacs with the same problem. I tried to remove cache for before system preferences files, but that did not help at all. I don't have a FileVault if it makes a difference, even if I did before reinstall, but never turned back (persistent question anyway). Any recommendations would be useful. Thank you!

    Data sheet:

    iMac (end 2013)

    Intel Core i5 at 2.7 GHz

    8 GB 1600 MHz DDR3

    1 TB 5400 RPM HARD DRIVE

    Intel Pro Iris 1536 MB

    I found it is the State of affairs in 10.11 if running a HD spinning.  Don't feel alone.

    I suspect that it is a function of low priority in the memory compressed algorithm.

    Upgrading to an SSD and it will rise to attention.

  • Satellite M300 PSMDCA takes a long time to start

    I have a Toshiba Satellite M300 PSMDCA - 01800C and there are some problems with it.

    First of all, when you start the computer, it takes a long time to start and activate Outlook.
    I am running Windows 7Home Premium.
    Computers arrow where I bought the computer told me that it can take up to three hours to go back through each process at startup?

    Is it normal that all I wanted was a simple portable easy fast, but it seems that I am stuck again.

    Also, when I go back to the computer, even after some time the mouse it does not provide new and pushing the Start button just a blank screen. Alt + Ctrl + delete, then he activates Windows again and then after having put my password and I have to wait for that be again loaded everything that takes so long. Any ideas?

    Also I often get the message when the computer starts "error has occurred in Toshiba PC Health Monitor. He will leave the application. "Main.frm.cpp (184). Any ideas?

    Quite often when I am scrolling with the mouse, the screen will turn black and flash and a message «the NVIDIA display driver... couldn't Reg...» "and he will correct itself after awhile. Frustrating!
    Quite often when scrolling on the websites of the page I'm going to freeze?

    I use MS Office 2010 and there is a problem trying to save Word documents and a message comes up with "a file permission error.

    Any thoughts? Thanks, Shirl51

    > First of all, when you start the computer, it takes a long time to start and activate Outlook. I am running Windows 7Home Premium. Computers arrow where I bought the computer told me that it can take up to three hours to go back through each process at startup?

    This nonsense!
    The system should boot up quickly my laptop needs 30 seconds to start.
    In my opinion, the system is screwed

    In your case, I recommend to reinstall the system.
    Did you create the recovery disk?
    If this isn't the case, I think that detailed instructions should be placed in the user's manual.

    After the recovery of disk has been created, restore the system, BUT save the data before doing so because the recovery disk would be to format the HARD drive and you lose data!

  • 7 OCX WMP on Windows ce 6.0 R3 takes a long time to start playback of video files.

    I try to use the WMP OCX 7 under windows ce 6.0 R3. My application written in c# and works fine, the only problem is the time it takes to start plaing a video file. I noticed that the more the file is large the longer it takes to start. With the debugger, I tried to step of the procedure of game, and the statement that takes all the time is the parameter of the URL property of the OCX.
    Have you ever seen something similar? Can you help me solve the problem? I have not found information about this behavior in on line documentation.

    Hi Danisan,

    Since you are facing problems with Windows CE, you can ask your question in the following MSDN forum to improve assistance:

    http://social.msdn.Microsoft.com/forums/en-us/category/EmbeddedWindows

  • My computer may take a long time to stop.

    * Original title: Shut down

    My computer off button does not work correctly. My computer may take a long time to stop.

    Do not press the power button to turn off the computer or to solve a gel. Click on the ORB at the bottom left of the desktop and click stop. If you are having shutdown problems, then select the hotkey Ctrl + Shift + Esc to bring up the Task Manager and click the Applications place the cursor on a running application to select and click on the end task button. As the application is removed from the list, repeat the procedure on the next application in the list until all are gone from the list. If you use the taskbar to access programs simply close all open windows. Then, you should be able to shut down your computer.

    http://Windows.Microsoft.com/en-in/Windows7/turning-off-your-computer-properly

  • Z10 Z10 Blackberry BlackBerry takes a long time to start when the parameters "SIM card PIN lock" is activated

    Device: BlackBerry Z10
    Model: STL100-1
    Software version: 10.2.1.537
    OS version: 10.2.1.1925
    Carrier: Beeline (KZ)

    Z10 takes a long time to start when the parameters 'SIM card PIN lock' is running

    Tried to activate or disable this setting, the result:

    On - 5 min 13 sec (on-screen progress bar has reached 100% for ~ 1 minute, then waited for another 4 minutes in this State)

    Off - 1 min 17 sec

    What is the problem of the time difference?

    Good, thanks

  • Devices and printers takes a long time to open

    In Windows 7, the devices and printers open almost instantly. In Windows 8 Pro x 64, devices and printers takes almost 30 seconds to open, and it takes a long time whenever I open it. How can I shorten the time required for the devices and printers to open?

    Before you answer, please note the following:
    • I don't get an error message when I open devices and printers.
    • I have not made any recent hardware or software changes to the computer.
    • I experience the same behavior when Windows 8 starting in a boot environment.

    My problem is solved.

    Instead of wasting time on generic solutions, I should look for a specific cause from the start. In my case, the problem was with my scanner. In devices and printers, I open my scanner and selected properties of analysis. On the events under Actions tab, Windows had chosen to 'Interrogate what program to run.' I changed it to "Start this program" and choose my scanner software in the drop-down list.
    Devices and printers now opens almost instantly.
  • All while saving the have drop its takes a long time

    I am using windows 7 and have CC, when I'm working on files while saving the file have its takes a long time. I have 4 GB of RAM. now I'm better system too with 6 GB ram. stillthe HERE takes a long time to save the 300 MB file.

    It could be where you register to.  Make sure that you set up a database on your local drive (that is, your computer's hard drive).  Then select your disks scratch in the preferences (make sure you have enough free space and there is enough defragmented).  Backup speed is not a problem of RAM.  Make sure that you save not on a network drive. People have also disabled 'save with PDF compatibility' > OFF in the preferences help to accelerate.

  • Video takes a LONG time

    Howdy, everyone. I am currently shopping around for a video editing application, and I'm using the trial version of Adobe Premiere Elements. I love everything about it so far, except for one thing. It takes a long time to save the final video file (from the tab share). I noticed he gets to 50% fairly quickly, probably within five minutes and at that time there the progress bar slows down to a crawl. It takes more than two hours for the last 50% complete. Is this rare or should I wait?

    Here's a little history of my project, in case this is useful.

    The video project is a little less than 30 minutes.

    On the sharing tab, I selected to export files for viewing on computers.

    The type of video I want is WMV (Windows Media). I can vary from this format. It is a requirement of the project.

    Image size: 1024 x 768. At the moment I can't vary that size. The video must be 1024 x 768.

    Frame rate: 30 fps

    Audio: mono 48 kbps, 44 kHz, CBR

    Codec: Windows Media 9

    Encoding Passes: 1

    Bitrate Mode: Constant (I also tried of Variable quality, but noticed no difference in time rendering)

    Maximum flow: 200 Kbps (the first time I tried 2 000 kbit/s, but I noticed no difference in time rendering)

    Image quality: 3 (I also tried 90 but once again without any perceptible difference when rendering time)

    My laptop:

    Windows XP Pro SP3

    Intel Core 2 Duo 2.2 GHz

    2 GB of RAM

    The window says that I would wait the video size to be 53MB in size, which seems reasonable. But when it finishes, it is more than ten times greater than this estimate. I don't understand why the file size is so big and the render time is so long.

    My rendering time is governed or strangled because I am using a trial version of Premiere Elements?

    If this is not the case, what suggestions you all for me? Am I be unreasonable while waiting for my render times to be faster than the duration of the video?

    Thanks in advance for your help. Please let me know if I can provide any other details.

    WMV is a highly compressed format/CODEC, and the duration of the treatment will depend on several factors:

    Your CPU, which is not as powerful in your case

    Your auxiliary I/o system, which is probably a single HDD on your laptop

    The source footage. What is your source footage?

    No effect added to the images. You have all the effects?

    Each of them will have an impact on the time required.

    The trial is that a single main limitation - watermark. Now, there are some components that need to be triggered, but are not tested, but they would not obvious with the import of your source footage, if it is a question.

    Good luck

    Hunt

  • Still burned DVD takes a long time to load into the reader

    I created a DVD in Encore CS3.  The final DVD is approximately 60 minutes and has 4 menus created in Photoshop CS3.  I purchased the Dolby converted in first and used this file as PCM format indicated by a friend vs.   The DVD works fine but takes a long time to load in one of my DVD players.

    A Sony player, it takes between 40 minutes and up to 70 seconds to load and play the first menu.  Each time is different.

    (This same drive load purchased in-store Hollywood style DVD in about 15 seconds on average)

    In another Sony player my DVD on average about 25 seconds

    A Panasonic player, it takes about 15 seconds

    In a portable player from JVC, it takes about 8 seconds.

    That is what it is?  This DVD is created for replication in a large number, but I'm afraid the long loading time is a problem and you want to solve this problem before sending it to the wide for replication.

    Help, please

    Thank you

    EDM

    EDM,

    One consideration is that there is no DVD drive certified to play any burned DVD, only those press/replicated. Most do and do as well, with provisions, but some don't.

    Now for these provisions. High quality blank media will get a closer all the success, just like using a slower speed of the burn, as the max. These two considerations will get a close, as it is possible.

    What brand of blank media are you using? Verbatim and Taiyo Yuden are about as good as it gets.

    How fast you burn to? I would look into a speed in the middle of the range permitted by the combo of speed by the media and the burning speed. Slower is better than more fast.

    As Stanley, there may be differences with r and + R media and players. There has been much more a problem, but some players still might prefer a vs the other.

    Finally, when you say "replicated", do you mean that you send in a DLT to make a House of replication a glassmaster, where the DVD is going to be in a hurry? If Yes, these replicated discs will be like the Hollywood DVD and will be NOT burnt, as was your test drive. The question will be moot with these, as they will be DVD-videos, where your burned DVD is really a DVD - ROM.

    Good luck

    Hunt

Maybe you are looking for