UNION or what else?

Hi,
I have the next problem:
I have thousands of nodes, each node has different kind of statistical data stored in eight different tables (huge ones). The data in each table is stored based on node, day and hour. somethink like
node_id, day, hour_0, hour_1, hour_2 ... hour_23
I firstly download the info I need from the first table, the whole data of all days and all hours of one specific month for thousands of nodes is needed. If data in one hour is missed I need to go to look for that specific value of the same node, same day, same hour in the second table, if the second table does not have it I need to go to the look for it at the third table and so on until I reach the last table.
In order to improve performance, we decided to download the data massively (JDBC), that means that we downloaded all the info of all nodes for the thity days of an specific month of the first table at once, then we calculate what values are missed and we look for them in the second table, third .... eighth, all in massive downloads.
We noticed that it was a good idea to massively look for data in the first fetch,
select node_id, day, hour1, hour2 ... hour 23
from table1
where node_id in (thousands of nodes here)
and day between (first_day_month, last_day_month)
it drastically improved the response time, but for the next fetches (that are very specific) we use UNIONs like this
select val1 from table 2 where node=x1 and day=y1 and hour=z1
union
select val2 from table 2 where node=x2 and day=y2 and hour=z2
union
select valn from table 2 where node=xn and day=yn and hour=zn
We notice that using UNIONs does not make big difference than doing JDBC statements for each value separated, and our performance is far from the requirements.
Question: What would you do in order to improve performance in such a situation?
Thank you!!!

Not sure if I understood your requirement correctly. But maybe you can do it all in one select. Something long the lines of this
select t1.node_id,
          t1.day,
          t1.hour1,
          nvl(t1.hour2, (select min(val1) from table2 t2 where t2.node=t1.node_id and t2.day=t1.day and hour=2)) as hour2,
          nvl(t1.hour3, (select min(val1) from table2 t3 where t3.node=t1.node_id and t3.day=t1.day and hour=3)) as hour3,
          nvl(t1.hour23, (select min(val1) from table2 t23 where t23.node=t1.node_id and t23.day=t1.day and hour=23)) as hour23
from table1 t1
where t1.node_id in (thousands of nodes here)
and t1.day between (first_day_month, last_day_month)

Similar Messages

  • TS3276 I'm now having trouble getting mac mail to work on my mac. The mobile me account works great on iphone and ipad but it won't connect to my mail account. Password is correct. What else can I do? Using OS10.68

    I'm now having trouble getting mac mail to work on my mac. The mobile me account works great on iphone and ipad but it won't connect to my mail account. Password is correct. What else can I do? Using OS10.68

    HI,
    The Apple IDs from @mac.com and @me.com (Older MobileMe and more recent iCloud Names) are also Valid AIM Screen names.
    Any other sort of Apple ID is not a Valid AIM Name.
    A Google ID that is associated with Google Mail Account (And has "Talk" enable on your Google Settings) can be used in iChat as  Jabber Name/ID.  (Google Run  Jabber server).
    Jabber and AIM are different IM Services and it is not easy or straight forward to add Buddies from one Service to the Buddy List of another.  (As A Starting point consider it "impossible")
    iChat 4 and 5 have links to the registration page of @Mac.com here with a "Get an iChat Account" button in the add (Account) screen  (You select @mac.com or MobileMe and then press the Button - Choosing AIM and then pressing the button used to lead to the AIM registration page but AIM moved their page).
    Apple IDs can be any valid email (or an @mac.com or iCloud registration)
    Therefore you could make a Google ID into an Apple ID.
    However this will not be a valid AIM Screen Name the way @mac.com or MobileMe/iCloud ones are.
    Valid AIM Screen Names in Table (pic)
    7:46 PM      Monday; December 5, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • My itunes will not work at all. i have deleted and reinstalled in over ten times, i have ended the process, i have reinstalled quicktime i few times, i have deleted many folders. What else can i do? Please help:(

    My itunes will not work at all. i have deleted and reinstalled in over ten times, i have ended the process, i have reinstalled quicktime i few times, i have deleted many folders such as TEMP, itunes helper et What else can i do? Please help:(

    Now it sometimes keeps coming up and working but once i plug an ipod in it freezes my whole computer up and no i dont get any response from itunes at all

  • I don't know what else to try to download iTunes! Please help!

    I'm going crazy... I have been reading forums and troubleshooting pages for about 15 hrs and I do not know what else to try. I have 32-bit Win Vista and it will not let me download iTunes. I have run my anti-virus, my spyware remover, cleaned my registry, emptied my temporary internet files folder, restored my hard drive, and I tried turning off my anti-virus and spyware remover and then downloading... nothing works. First I was getting the pop-up box that said it does not recognize the publisher... when I tell it to continue anyway I get the "this is not a valid Win32 application" error. The past few times that I have tried to download it, I get an error that says the connection with the server was lost. I really don't think there is a problem with my connection. I hope that all made sense... I have been staring at this screen for so long that I can't think anymore. If anybody has any other suggestions to try, Please let me know!
    Thanks,
    Heather

    Perhaps the tip on this web page will help.
    Hope it does.

  • There's a black and white striped glitch on the left side of my screen on my Macbook Air! Its happened before and has been an easy fix, usually just restart or turn off my computer but don't know what else to do. Is there anything I can try now?

    There's a black and white striped glitch on the left side of my screen on my Macbook Air! Its happened before and has been an easy fix, usually just restart or turn off my computer but don't know what else to do. Is there anything I can try now? I wont be able to make it to the Apple store until tomorow and would prefer if there was something I could do that didnt cost money, my computers very new and I really need help.

    Hi and welcome to the community! Since you're new please be sure that you have checked out our Discussion guidelines.
    I suggest that you try to repair the phone software using PC Companion..
    Before repairing your device you may want to backup your information first. Check out this topic for more information on how to.
    How to backup?
    If the issue should still remain I think that this needs to be examined and fixed at a repair center. For more information about how to submit your phone for repair and where, contact your local support team.
     - Official Sony Xperia Support Staff
    If you're new to our forums make sure that you have read our Discussion guidelines.
    If you want to get in touch with the local support team for your country please visit our contact page.

  • Ok, so I transferred my 3S info to my 4S by restoring from an old phone backup.  But SIRI is gone and god knows what else??  Can I get my old stuff into the new phone and keep the 4S new functionality?

    ok, so I transferred my 3S info to my 4S by restoring from an old phone backup.  But SIRI is gone and god knows what else??  Can I get my old stuff into the new phone and keep the 4S new functionality?

    I suspect unless he had some items in iCloud backup then they are gone.  Connecting an iPhone to a different library from that to which it was previously connected will result in the device asking if you want to erase it.

  • HT201263 My ipod Touch does not want to turn on. I've tried all the different methods and I'm stuck and dont know what to do now. What else can I try?

    My ipod Touch does not want to turn on. I've tried all the different methods and I'm stuck and dont know what to do now. What else can I try?

    JesusDGZ wrote:
    My ipod Touch does not want to turn on. I've tried all the different methods and I'm stuck and dont know what to do now. What else can I try?
    I have no clue what you mean by "all the different methods."  Here are my suggestions.
    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.

  • HT201210 Itunes will no longer open with the error message MSVCR80.dII is missing from the computer, and I'm advised to reinstall itunes but that hasn't worked.  What else can I try?

    Itunes will no longer open with the error message MSVCR80.dII is missing from the computer, and I'm advised to reinstall itunes but that hasn't worked.  What else can I try?
    Thanks for your help
    Pippa

    Click here and follow the instructions.
    (98708)

  • Itunes won't work on windows 7 64 bit computer don't know what else to do

    i have an HP G60-530US notebook with windows7 64 bit operating system.
    i downloaded the proper version of itunes from the apple site but when i open the program on my computer itunes doesn't respond. i cannot do anything with it. i've tried reinstalling several times and am at a loss as to what else to do.
    i have a new ipod touch that is just sitting in the box because i can't load music onto it

    All righty then.
    Here's the basic document:
    [Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7|http://support.apple.com/kb/HT1923]
    The instructions for removing the applications:
    iTunes
    QuickTime
    Apple Software Update
    Apple Mobile Device Support
    Bonjour
    Apple Application Support (iTunes 9 or later)
    ... are pretty much fine *with one caveat.* If you have *Safari 4.0.4* installed, close it *prior to uninstalling Apple Application Support.* That version of Safari also uses Apple Application Support, and will interfere with the Apple Application Support uninstall if you have it open. After Apple Application Support has been uninstalled, Safari 4.0.4 will no longer launch until Apple Application Support is reinstalled. (It should be reinstalled when iTunes is reinstalled.)
    When you get to the "Verify iTunes and related components are fully uninstalled" step, use the following checklist rather than the one in the document:
    (1) Restart your computer.
    (2) After the computer restarts, open Local Disk (C:) located in Computer or whichever hard disk your programs are installed on.
    (3) Open the Program Files folder.
    (4) Right-click the iTunes folder, choose Delete, and choose Yes when asked to confirm the deletion. Note: This folder may have already been deleted if iTunes was successfully removed using the "Uninstall a program" control panel.
    (4.5) Right-click the iPod folder (if it exists), choose Delete, and choose Yes when asked to confirm the deletion. Click Continue if Windows needs confirmation or permission to continue.
    (5) Right-click the Bonjour folder (if it exists), choose Delete, and choose Yes when asked to confirm the deletion. Click Continue if Windows needs confirmation or permission to continue.
    (6) Open the Common Files folder.
    (7) Right-click the Apple folder (if it exists), choose Delete, and choose Yes when asked to confirm the deletion. Click Continue if Windows needs confirmation or permission to continue.
    (8) Open Local Disk (C:) located in Computer or whichever hard disk your operating system is installed on.
    (9) Open the Program Files (x86) folder.
    (10) Right-click the iTunes folder (if it exists), choose Delete, and choose Yes when asked to confirm the deletion.
    (11) Right-click the iPod folder (if it exists), choose Delete, and choose Yes when asked to confirm the deletion. Click Continue if Windows needs confirmation or permission to continue.
    (12) Right-click the QuickTime folder (if it exists), choose Delete, and choose Yes when asked to confirm the deletion. Click Continue if Windows needs confirmation or permission to continue.
    (13) Right-click the Bonjour folder (if it exists), choose Delete, and choose Yes when asked to confirm the deletion. Click Continue if Windows needs confirmation or permission to continue.
    (14) Right-click the Apple Software Update folder (if it exists), choose Delete, and choose Yes when asked to confirm the deletion. Click Continue if Windows needs confirmation or permission to continue.
    (15) Open the Common Files folder.
    (16) Right-click the Apple folder (if it exists), choose Delete, and choose Yes when asked to confirm the deletion. Click Continue if Windows needs confirmation or permission to continue.
    (17) Open Local Disk (C:) located in Computer or whichever hard disk your operating system is installed on.
    (18) Open the Windows folder.
    (19) Open the SysWOW64 folder.
    (20) Right-click the QuickTime file (if it exists), choose Delete, and choose Yes when asked to confirm the deletion. Click Continue if Windows needs confirmation or permission to continue.
    (21) Right-click the QuickTimeVR file (if it exists), choose Delete, and choose Yes when asked to confirm the deletion. Click Continue if Windows needs confirmation or permission to continue.
    (22) Right-click the Recycle Bin and choose Empty Recycle Bin.
    Now download and install the 64-bit version of iTunes:
    http://support.apple.com/kb/DL925
    ... any better luck with getting her to launch properly this time around?

  • Ipod Touch 1st generation: blank white screen - I tried holding both buttons and connecting it to the computer, restoring it, and still nothing. What else can I do?

    Ipod Touch 1st generation: blank white screen - I tried holding both buttons and connecting it to the computer, restoring it, and still nothing. What else can I do? I did not drop it in water.

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar

  • I'm trying to connect to my home wifi with my imac gh5. After I enter the password it says connection timeout or password incorrect. I know there's no issue with the connection but I don't know what else to do. Does anyone know how to fix this problem?

    I'm trying to connect to my home wifi with my imac gh5. After I enter the password it says connection timeout or password incorrect. I know there's no issue with the connection but I don't know what else to do. Does anyone know how to fix this problem?

    What is the make & model of your home Wi-Fi router that you are attempting to connect your G5 iMac to? Which exact model of iMac do you have?
    What wireless security type is your router using: WEP, WPA, or WPA2? If you temporarily disable wireless security, can the iMac connect to it now?

  • My ipod touch isn't letting me download any apps or games and I've tryed to restart it what else can I try to do?

    My ipod touch isn't letting me download any apps or games and I've tryed to restart it what else can I try to do?

    Go to Settings > General > Restrictions and check the configurations in there.
    ps.
    By the way don't use bold text, it's not helping!
    Message was edited by: ckuan

  • My Android Galaxy S5 has locked up and gone into endless loading while trying to update to the Kitkat update. I have set it back to factory settings and tried again and it has locked up again. My phone no longer works. What else can I do?

    My Android Galaxy S5 has locked up and gone into endless loading while trying to update to the Kitkat update. I have set it back to factory settings and tried again and it has locked up again. My phone no longer works. What else can I do?

        Oh goodness,SLEEPER888. We wish you didn't have this problem while trying to complete this update.You have done quite a bit of troubleshooting on your own. If the phone update does not take, we would need to replace it with the warranty. Is it still locked up?
    TamaraH_VZW
    Follow us on Twitter @VZWSupport

  • After a one week logout and shutdown my macpro 1,1 laptop shows a black screen at startup attempts. The battery is fully charged and both resetting the power manager  and zapping the PRAM have failed to permit startup. What else can I try?

    After a one week logout and shutdown my macpro 1,1 laptop running OSx 10.6.8 shows a black screen at startup attempts. The battery is fully charged and both resetting the power manager  and zapping the PRAM have failed to permit startup. What else can I try?

    Startup – Black screen with cursor
    Startup Issues - Resolve
    Startup Issues - Resolve (2)

  • My iPhone 5c is not being recognized by my mac except to charge it. I'm up to date on all updates and don't know what else to do. I have restarted several times. I have even tried to update my iPhoto and I can't even do that with iPhoto 9.0, but can't.

    My Iphone 5c is not being recognized by my Mac computer. I have done all of the upates, restarted several times and I'm not sure what else to do. I have searched and searched and searched and have come up with nothing. Also, my Iphoto can not be updated. I'm still using version 8. something, and it won't update without this update and that update. It needs 9.0 but I can't find that download anywhere. The only one that I can find is 9.1. That won't update. Is there anything that I can do, or should I just bite it and take it to apple to get looked at?

    Does iTunes not see the phone?
    If not, make sure you're running the current version of iTunes.
    If you are running the current version and it still doesn't recognize it, see this: http://support.apple.com/kb/TS1591?viewlocale=en_US&locale=en_US
    As for iPhoto, you will have to purchase a newer version. It's not a free upgrade. Or, you can use Image Capture, which is built into OS X, to import the photos.

Maybe you are looking for