On query performance problem. Need help.

It is essentially a performance problem. I hope someone can help me with that.

Basically, I have four old masters (150000 records), (100000 records) Child1, Child2 (50 million records!), child 3 (10000 + records)
(please forgive the alias).

Each record in the master has now more than one matching record in each table child (one to many).
Also there may be any record in any or all of the tables for a particular master record.

Now, I need to get the maximum of last_updated_date for each master record in each table 3 child and then find the maximum of
the three obtained last_active_dates from the 3 tables.
for example: Master ID 100, to interrogate Child1 for all Master ID 100 records and get the max last_updated_date.
Same for the other 2 tables and get the most out of these three values.
(I also need to deal with cases where no trace may be found in a child table to a Master ID)

Write a procedure that uses sliders that the value of each of the performance hits of child table
evil. And that's, I need to know the last_updated_date for each master file (all 150000 of them). It will probably take days to do this.

SELECT MAX (C1. LAST_UPDATED_DATE)
MAX (C2. LAST_UPDATED_DATE)
MAX (C3. LAST_UPDATED_DATE)
OF CHILD1 C1
CHILD2 C2
CHILD3 C3
WHERE C1. MASTER_ID = 100
OR C2. MASTER_ID = 100
OR C3. MASTER_ID = 100

I tried the above, but I got an error in tablespace temp. I don't think that the application is good enough at all.
(The GOLD clause is to take care of any records in a child table. If there is an AND, then the join and then select
No, not even if there is no record in a child table, but valid values in the other 2 tables).

Thank you very much.

Published by: user773489 on December 16, 2008 11:49

You want alias to this field then.

SELECT MAX (C.LAST_UPDATED_DATE)
FROM
(select child1_master_id MASTER_ID, field2, field3,... field4 from CHILD1 UNION ALL
 select child2_master_id MASTER_ID, field2, field3,... field4 from CHILD2 UNION ALL
 select child3_master_id MASTER_ID, field2, field3,... field4 from CHILD3) C
WHERE C.MASTER_ID = 100

If do you something like that, and explicitly list the columns you want.

Edit: for something like a specific query for a MASTER_ID...

SELECT MAX (C.LAST_UPDATED_DATE)
FROM
(select child1_master_id MASTER_ID, LAST_UPDATED_DATE from CHILD1 where child1_master_id = 100 UNION ALL
 select child2_master_id MASTER_ID, LAST_UPDATED_DATE from CHILD2 where child2_master_id = 100 UNION ALL
 select child3_master_id MASTER_ID, LAST_UPDATED_DATE from CHILD3 where child3_master_id = 100) C
WHERE C.MASTER_ID = 100

That should give you very good performance by raising a record. But a better idea, as indicated, would be to get it all at once with a sql:

SELECT MASTER_ID, MAX(C.LAST_UPDATED_DATE)
FROM
(select child1_master_id MASTER_ID, LAST_UPDATED_DATE from CHILD1 UNION ALL
 select child2_master_id MASTER_ID, LAST_UPDATED_DATE from CHILD2 UNION ALL
 select child3_master_id MASTER_ID, LAST_UPDATED_DATE from CHILD3 ) C
GROUP BY MASTER_ID

This will give you the max for each MASTER_ID in a sql without a cursor.

Published by: tk-7381344, December 16, 2008 12:12

Tags: Database

Similar Questions

  • Autoruns.exe serious problem, need help urgent please

    Hi, someone there is familiar with this software from sysinternals? Have accidentally disabled key drivers in my laptop with this software and cannot run again. Anyone know how to reverse the errors using this application? Posted full problem in the recovery and repair forum. Have had no response from sys internals forum and really need help. Thank you, Jay

    Try to reactivate the drivers tab drivers doesn't work, so did system restore. Thanks to all who responded, the problem is solved

  • 5 D Mark III video problem - need help!

    Hello

    Been using my 5 d Mark III for video for about a month now. I noticed a problem occurring in the middle of some plans where the color seems to pass. The problem is so weak that it will take full screen, full HD and a high level of concentration to detect. In my opinion, the most obvious presence is 28 seconds where the valley below suddenly takes a different color. Here is a video of my question: http://www.youtube.com/watch?v=Xw9IHYkUEqQ

    I performed these parameters:

    Manual focus

    Opening, ISO: Manually set

    Shutter speed: 1/50

    1920 x 1080 EVERYTHING I have 24 p

    Photo Style: faithful

    Custom white balance

    Auto Lighting Optimizer: OFF

    Highlight priority: OFF

    Speed High ISO NR: OFF

    I tried to see if they were detectable on the LCD on the camera, but to the naked eye, they are not. The original. Show them the MOV files that were transferred from the camera.

    Maybe that Chromatic Aberration or the peripheral illumination Correction? I did not disable these, and they are the only automatic settings I can think that would change Mid-shot.

    In my view, what ISO was set at 100 for these plans.

    Any ideas what could be causing this? Any suggestions would be much appreciated!

    Thank you

    Max

    I tested it on multiple devices, and it seems that there is a problem with my primary monitor. I will definitely test it next time I have a problem on multiple devices. Thanks for all the help!

  • Audio problem (NEED HELP)

    Hello

    I met a very weird audio problem yesterday, I'll try to explain as best as possible what the problem is.

    For some reason, I can hear audio in games and videos I have in my computer very well. But the problem is that I don't hear nothing else coming from my pc, I do not mean the being emptied recycling bin, I don't hear any sound of internet explore or firefox, even when it starts I can't hear anything in my headset.

    But when I test with my audio software (Realtek HD audio manager) or when I use of playback devices I can hear JUST fine.

    I think that this problem started with livestream, I used it yesterday and it has caused a few errors that required me to restart my computer.

    So please if anyone of you has a solution for me I would like to hear it, I quite to reinstall my audio drivers fiddling around with Device Manager.

    Thank you for your time, I hope to hear from you soon.

    If you need further details please do not hesitate to ask.

    What happens when you test these sounds in the control panel - sounds - sounds tab?

    When you re-install your Sound Drivers have you checked to make sure that you have installed has shown
    upward into the device as Manager they often rollback so you need to install - reboot - check - repeat until the
    vouchers are installed

    Click right speaker in the near right lower clock - reading devices - right click in white/white
    area - check Show hidden devices and display devices disabled. To the lower right of all stakeholders
    Properties - check the settings on all tabs.

    If no joy try System Restore to save before this happened

    How to make a Vista system restore
    http://www.Vistax64.com/tutorials/76905-System-Restore-how.html
    I hope this helps.

    Rob - bicycle - Mark Twain said it is good.

  • Three problems needing help

    Hello out there, I have Windows 7 home and office on an old Dell that is six years old.

    It seems that if I have three problems maybe not connected.

    Translation

    I installed the update simplified Chinese but do not see it as an option in the taskbar. It STILL shows only English for the US or Australia in option. The elanguage Chinese update was ranked managed in my updates BTW.

    Cursor

    When I type the cursor moves around the screen, then type will whenever the cursor is located. It's really annoying and means that if I type something that I have to stop and move it where I've finished typing otherwise I move around. Annoying bloody.

    Micro

    I have Skype and every time I do an Audio check the microphone does not work. For some reason any driver for the microphone is not listed as an option, although the speakers work now. Maybe I do need to update the drivers for the Dell printer, but I don't know how and I don't get live chat with Microsoft.

    I have run a check of the hardware (which has not yet finished), but I am aware that everything works fine. Here are software problems.

    Any help is appreciated

    When I type the cursor moves around the screen, then type will whenever the cursor is located. It's really annoying and means that if I type something that I have to stop and move it where I've finished typing otherwise I move around. Annoying bloody.

    This is usually caused by the Palm spraying it on the touchpad. Disable the touchpad, the problem will be solved.

  • First Pro Debug event problem [NEED HELP]

    Hello guys and guys, Hello staff!

    For a few hours, I have a huge problem from first pro cc 2014!

    Premiere Pro Problem.png

    Since the beginning, that I'm not able to load an existing one or start a new project, which is very annoying, because I'm a youtuber and I need to edit videos to download. Now, I have to pause until the issue is resolved.

    Thank you very much for your help!

    Best regards

    Kevin

    It seems that you do not have this file:

    Workaround Remove the folder effect presets and Custom Items.prfpset of Documents\Adobe\Premiere Pro\8.0\Profile-CreativeCloud (or user name) - folder.

  • volume iPhone6s problems - need help!

    Sometimes when I use Siri as "Hey Siri" when I'm not able to reach for the phone, or driving, the volume is so low I can hardly hear it. This happens in my car via bluetooth or in my house. My volume controls are all the way up, so it isn't that. It is an intermittent problem. Is there a known issue with the iPhone of 6 s?  I have a friend with the same phone and the same problem.

    The steps detailed here to try to see if they help you:

    If you hear no sound or distorted sound from your iPhone, iPad or iPod touch speaker - Apple Support

  • Serious manual Windows Update problem, need help

    Hello when you run the microsoft update in the start menu, I am now getting a totally different message, then I have before I've never had this problem before when I'm trying to update I get the error message "403 - Forbidden: access denied."
    You are not authorized to view this directory or page using the credentials you supplied. »

    I have automatic updates turned off that I prefer to manually update.

    This has happened only since I installed the microsoft security essentials, but I also got nod32 on my computer as I have now deleted these two and nothing will do, the problem persits, I decided just to install security essentials miccrosoft and I can't update as well as the exact message I get is as follows


    "" microsoft security essentials was not able to verify the defination of virus and spyware updates
    error code: 0 x 80004002

    "" error description: the microsoft security essentials was unable to download definition updates, because your computer uses an older version of the windows update client or becvause windows could not start the service that transfers data.

    I use 32 bit microsoft xp professional, sp3 installed with all the updates until about 3 weeks ago

    Any help would be appreciated!

    Thank you

    Please stay with your original thread on this subject: http://social.answers.microsoft.com/Forums/en-US/vistawu/thread/89a95d94-0257-4250-a6bc-cc1bf08802b2

    There are many more things that simply installing MSE.

    Thank you.

  • When I try to open and turn on windows Defender I manually get 0X800106ba code have not been able to solve this problem, need help!

    do not have mcafee just use windows security, with all the protections on and running except windows Defender, it's my error 0X800106ba issue code

    The game, 16 December 2010 15:19:47 + 0000, redbluemoon wrote:
     
    > do not have mcafee
     
     
    Good. It is a very bad choice, in my opinion.
     
     
    > Just use windows security.
     
     
    It has no product called Windows Security. Do you mean Microsoft
    Security Essentials?
     
     
    > with all the protections on and running except windows Defender, it's my error 0X800106ba issue code
     
     
    If you mean that Microsoft Security Essentials, it turns off Windows
    Defender, because it does essentially the same thing itself and you
    don't need both. It is not a problem, and you should not try to fix it.
     

    Ken Blake (MS-MVP)

  • I have windows live photo gallery error 0 x 80004005 problem. need help anyone?

    can anyone help to problem, keep getting error code.  Windows live photo gallery error 0 x 80004005. I remove the program and download it again and have same prolbem

    Windows Live Photo Gallery is a database that can
    corrupted. (it is not affected by the uninstall /)
    relocation of WLPG)

    If you rename the file... it will force the photo gallery to create a
    new database file the next time, it is launched and the Gallery
    will be as it was the first time it was launched.

    I'm not positive that this will solve the problem that you are
    dealing with but if you want to test, the file name
    is... Pictures.PD6.

    Just rename it to OLDPictures.pd6. This can cause you to
    lose tags and metadata that are not rewritten on
    the photo files.

    The path to the file is:

    Windows\Users\%username%\AppData\Local\Microsoft\
    Windows Live Photo Gallery\Pictures.pd6

    Pictures.PD6 is a file... the following article explains
    How to show hidden files:

    Windows 7 - show hidden files
    http://Windows.Microsoft.com/en-us/Windows7/show-hidden-files

    If you decide to try it... Let us know if it's an improvement.

  • Query performance problem

    I have two schemas of two databases.

    When I check the sql plan, both the schema contains diffrently (one is underway for a full table scan and a scan of systematic index range).

    Both the scheme almost similar kind of data, indexes, and charges.

    What is causing the performance of sql

    in the second plan, the optimizer expects the analysis of range on IDX_TSK_ID step 5 to return to only 14 lines and decides it's a good idea to join the second TB_TRANS_MSTR table with a nested loops join (make a loop on 14 TASK_INSTANCE results and do a search on each iteration of the use of the PK_TRANS_ID index).

    In the foreground, the optimizer decides to read TB_TRANS_MSTR (containing 978 lines) and build a table of hash in memory of the results - and then probe against the TASK_INSTANCE second set.

    The next question is: which plan is most suitable and translates into better performance? The chances are high that the best plan is one that includes an estimate more fitting of the cardinalities. These estimates are based on a simple arithmetic (more or less) - and they depend on the table and column statistics. So the dba_tab_column entires Swen W. mentioned would be useful. In addition the text of the query would probably we shed some light on the question.

  • HP Compaq Presario CQ61-355SQ - wireless driver problem - need help

    Hello

    First of all, I would like to thank all the people posting here some very interesting information on installing the drivers under Win XP. You do a great job!

    I followed the steps described in the guide and I arrived to install most of them (chipset intel, nvidia graphics, realtek network card)

    The only problem I have now is with the WiFi card driver intel. From here: http://h30434.www3.hp.com/t5/Operating-systems-and-software/General-XP-Downgrade-Guide-for-HP-Laptop... I tried this:

    Intel Wireless, (Note: MS Windows Installer 3.1or later, must be installed), here

    and he did not sense that accrued installers ok but nothing happened, in Device Manager, no change has been made. After that I tried the method with 'Have disk', I chose in the list and tried some of the drivers, but in Device Manager it says that the "device cannot start".

    What could try then?

    Help, please

    Is that what you have installed MS Windows Installer 3.1?

    Indeed you have intel wireless, try sp45837, here

  • ProBook G2 450: PROBLEM NEED HELP

    NOTE: Game: vacuum/g (186 GB) drive

    Recently, I installed a GAME: / G DRIVE... (186 GB)
    When I uninstalled this game my drive was not get full vacuum... his show (185 186 GB), but it takes (186 186 GB) and there's nothing else that to always see the 185 then what happens?

    Help, please...

    [Sorry for the no grammatical language... This isn't my mother tongue...]

    imran450 wrote:
    NOTE: Game: vacuum/g (186 GB) drive

    Recently, I installed a GAME: / G DRIVE... (186 GB)
    When I uninstalled this game my drive was not get full vacuum... his show (185 186 GB), but it takes (186 186 GB) and there's nothing else that to always see the 185 then what happens?

    Help, please...

    [Sorry for the no grammatical language... This isn't my mother tongue...]

    Hello

    Thanks for posting in the Forum from HP Support.

    If I understand correctly, you have installed a software/game on disk/partition G.

    G: has 186 until the game has been installed.

    Game is now uninstalled and when you open the disk/partition G:\ Windows shows there is nothing there. However, at the same time you see free 185/186 (a.k.a 1 GB is absent)?

    Am I right my assumptions?

    If so, please format this disk/partition. This erases everything.

    Right-click on the drive, choose the Format and follow the on-screen instructions. Select 'Quick format' on/check and format NTFS or FAT32 file system

  • x 86 update (KB951647) problems need help

    Microsoft .NET Framework 3.5 Service Pack 1 and the .NET Framework 3.5 Family Update for versions of .NET 2.0 to 3.5 (KB951847) x 86

    computronico,
    Post the information here: what to post in the Windows Update forum

    If you are still having this problem then take a look at this thread because it addresses the issue of update of .net.

    Mike - Engineer Support Microsoft Answers
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • bad problem need help ASAP

    Hi I get on my computer and programs let, I get an error message saying the service cannot start, either because it is disabled or because it has no enabled devices is associated to him. I have no idea what I did or should do

    Hello

    You didn't say what services were involved.

    Try to set that all Windows Services back to their default values.

    List of Services BlackViper
    http://www.blackviper.com/WinVista/servicecfg.htm

    Start - type in the area of research-> Services find top - make a right click on - RUN AS ADMIN

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

Maybe you are looking for

  • Satellite Pro 6000 SD card - can't copy photos on my computer

    Hello I had problems with my SD card on my laptop. I bought it second hand some time now and I just bought a camera with an SD card. I wanted to put my SD card in, so I can download photos directly to comp, but I tried to do and nothing happens. I lo

  • Add radio station to a playlist?

    I have an older versions of iTunes radio playlist. I want to add a station to the list of internet stations iTunes. I can't do the sidebar while I put station highlighted to drag in the display list. I can't copy and paste into the playlist. Why is i

  • Tecra A3: Intel 2200bg card compatible with only 11 channels

    As we know Wifi network cards have Channel 13 (European version). Tell me if I'm wrong. I have wifi card Toshiba Tecra A3-184 with 11 chains only (American version). What I would do. I installed the new drivers bu t that nothing has changed.

  • HP envy m6: upgrade hard drive

    Hello please my drive hard crashed that is 500GB, so I had a new hard drive of 1 TB of the same model to replace... After you install the new hard drive, I turn on the laptop it will make a sound 3 times... As bippp bippp bill and stop... But the cus

  • Acer laptop opportunity; looking for a good OS software

    I recently bought an Acer laptop from a computer retailer.  The computer model is ZG5.  Only, the computer was shipped with a power supply cord.  I don't have a backup of the operating system drive.  The computer running XP Professional.  The windows