Can anyone tell me how can i optimize this query...

Can anyone tell me how can i optimize this query ??? :
Select Distinct eopersona.numident From rscompeten , rscompet , rscv , eopersona , rscurso , rseduca , rsexplab , rsinteres
Where ( ( (LOWER (rscompeten.nombre LIKE '%caracas%') AND ( rscompeten.id = rscompet.idcompeten ) AND ( rscv.id = rscompet.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rscurso.nombre) LIKE '%caracas%') AND ( rscv.id = rscurso.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rscurso.lugar) LIKE '%caracas%') AND ( rscv.id = rscurso.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rseduca.univinst) LIKE '%caracas%)' AND ( rscv.id = rseduca.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rsexplab.nombempre) LIKE '%caracas%' AND ( rscv.id = rsexplab.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rsinteres.descrip) LIKE '%caracas%' AND ( rscv.id = rsinteres.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rscv.cargoasp) LIKE '%caracas%' AND ( eopersona.id = rscv.idpersona ) )
OR ( LOWER (eopersona.ciudad) LIKE '%caracas%' AND ( eopersona.id = rscv.idpersona )
PLEASE IF YOU FIND SOMETHING WRONG.. PLEASE HELP ME.. this query takes me aproximatelly 10 minutes and the database is really small ( with only 200 records on each table )

You are querying eight tables, however in any of your OR predicates you're only restricting 3 or 4 of those tables. That means that the remaining 4 or 5 tables are generating cartesian products. (n.b. the cartesian product of 5 tables with 200 rows each results in g 200^5 = 320,000,000,000 rows) Then you casually hide this behind "distinct".
A simple restatement of your requirements looks like this:
Select eopersona.numident
  From rscompeten,
       rscompet,
       rscv,
       eopersona
Where LOWER (rscompeten.nombre) LIKE '%caracas%'
   AND rscompeten.id = rscompet.idcompeten
   AND rscv.id = rscompet.idcv
   AND eopersona.id = rscv.idpersona
UNION
Select eopersona.numident
  From rscurso ,
       rscv,
       eopersona
Where LOWER (rscurso.nombre) LIKE '%caracas%'
   AND rscv.id = rscurso.idcv
   AND eopersona.id = rscv.idpersona
UNION
Select eopersona.numident
  From rscurso ,
       rscv,
       eopersona
Where LOWER (rscurso.lugar) LIKE '%caracas%'
   AND rscv.id = rscurso.idcv
   AND eopersona.id = rscv.idpersona
UNION
...From there you can eliminate redundancies as desired, but I imagine that the above will perform admirably with the data volumes you describe.

Similar Messages

  • HT1212 My phone says 'iphone is disabled, try again in 22, 198, 686 minutes'!! Can anyone tell me how to get around this?

    My phone says 'iphone is disabled, try again in 22, 198, 686 minutes'!! Can anyone tell me how to get around this?

    I'm experiencing the same issue, if I restore the devise, won't I lose everything? -- I'm hoping there's another alternative to losing everything from one day to the next :-/
    Thanks in advance for your support :-)

  • I have installed Find My Friends app in my iPhone5 and can anyone tell me how can I insert my photo so that my friends can see me? Thank you.

    I have installed Find My Friends app in my iPhone5 and can anyone tell me how can I insert my photo so that my friends can see me? Thank you.

    I don't have Find My Friends installed but if I understand correctly, the photos that would display on your friends phones would come from the Contacts on their phone. Here is a previous discussion that may help: https://discussions.apple.com/message/25429023#25429023

  • Guys! can anyone tell me how can i download OX mountain lion for my mac?

    I need to download Mac OX mountain lion 10.8 for my friend. Can anyone share how can i download it and from where ..???

    The purchase of Mountain Lion is not an "all you share license". The person who buys ML on their App Store account can install it on as many Macs as they own. No one else's.
    It's only $20. Have your friend buy their own copy.
    http://store.apple.com/us/product/D6377Z/A/os-x-mountain-lion

  • The video on macbook pro 2011 with Lion , is way dark even if i increase the brightness its the same , can anyone tell me how can I fix it , in youtube plugins or in quicktime

    can anyone help please

    actually, it looks like a color management issue and beginning to me
    first, the plain one looks like untagged Adobe RGB (desaturated in web browser)
    if you want the true color in photoshop
    edit> assign profile: adobe RGB
    if you want to jack the saturation up closer to your goal (to begin)
    photoshop> edit> assign profile: prophoto RGB
    then
    photoshop> edit Convert to sRGB
    then
    try photoshop's Selective Color (to go to work on the correcting the blues)...
    the highlights look like some kind of
    photoshop> filter> artistic: plastic wrap
    may have been applied (and painted back in)

  • Hi everyone I got the iphone 4s and I want to unlock it. can anyone tell me how can I unlock it please?

    i really need to unlock my phone. I was living in puerto rico and I have moved to rhode island and I cant use it here because nobody cant unlock it. if someone know something about how can I unlock please let me know

    Only the original carrier can unlock your phone

  • Hi Can anyone tell me how can  i download ios 5 by using itune without connect my iphone?

    Hi, due to my network bandwidth very slow in my area. In order to download ios5 needed about 3 hours thus, i wish to download in my pc by using itune but without connect to my device? Is itpossible? I had try to go to the help in itune - check for update but it only asked me to update the itune version but not
    asking me to download or update my iphone OS. Can anyone slove my problem?

    I believe if you connect the phone, start the download, then disconnect your phone, the download will continue. You can use your phone, and when the download is complete, reconnect it to the computer to update its software.
    This works for an iPad software download through iTunes, I don't see why the same shouldn't work for the iPhone.
    Matt

  • Can anyone tell me how can I watch any video on Firefox without Adobe Flash Plugin?

    OK I don't know but the latest version of flash player really frustrated me. I don't like Chrome been my entire life Firefox user, but I will have to switch over since I can't stand adobe flash plugin. I uninstalled it and after reboot Firefox automatically plays videos in youtube but does not do the same thing in dailymotion or vimeo or other websites. Is there a solution? Please help me i like Firefox a whole lot.

    ''I don't have problems playing videos but with the new version I cant cycle through tabs with Ctrl+(Shift)+Tab once I click something inside the flash, even if I click outside the flash. The key functions vanish (tab-key cycles inside the flash through pause, volume, full screen button etc.) and the only way to change tab is with the mouse, which I don't like.''
    Hi Raynover, was this with the Flash plugin or with native HTML5 video support? I think plugins have always captured keyboard input once you activate them, but I haven't tested with native HTML5 video.

  • I just recently purchased the mac so can anyone tell me how so i apply imessage

    Hello, i just recently purchased the IMAC so can anyone tell me how can i apply imessage? 

    Welcome to the Apple Support Communities
    See > http://support.apple.com/kb/HT5395

  • HT4436 I wish to cancel my Icloud subscription, anyone tell me how to go about this?

    I wish to cancel my I Cloud subscription, can anyone tell me how to go about this?

    Open iTunes, go to your account and turn auto-renew off.

  • I've used Firefox for years. 2 days ago it wouldn't open. I uninstalled it using Revo uninstaller and put it back. Its still the same. Can anyone tell me how 2 fix this or change my mail settings for I Explorer. thx

    and now it just wont open can anyone tell me how 2 change my mail going 2 firefox and start going 2 i explorer please

    For gmail there are no settings to change, you can access gmail from any browser just by going to the gmail site and logging in.
    The [[Firefox will not start]] article should help with the problem you are having with Firefox.

  • I am new to Mac Pro but am purchasing one online.  can anyone tell me how to get the information from my Toshiba onto the Mac.  there are no stores in the state I live in.  Do I need to find a location and will they do a transfer from my I Tunes etc?

    I am new to Mac Pro and am purchasing one online  tonight.  Can anyone tell me how to get my information - Itunes, photos, and videos transferred onto the Mac from my Toshiba.  the state I live in doesn't have an Apple store but I could take it to Minneapolis when I go.  Any ideas where to begin?

    You might profit from a visit to a Minneapolis Apple store. With a brand new Mac, I think they will be most helpful - not just with transferring files, but with other advice as well. And I strongly recommend you invest in a back up drive. The Apple folk can help with that as well.

  • Can anyone tell me how to I get an old account information and recorded messages from a conversation

    I am totaly confused by eircom and efibre.......last year I was in arrears with eircom to the tune of( as I thought) of €357.66and I was disconnected but in the long run I got a huge bill in my door of  €656.48 , when I had to the money to pay the original amount, I was put through to efibre who told me that remaining amount of €298.77 shouldnt have been on my account and they would take it off I was also given a new account and phone number. I have now got several bills from my old account plus a letter from a company called BCW (debt collectors) who are treathening to take legal proceeding against me...... can anyone tell me how do I get my old account information and that conversation I had that day??

    Thanks Tracey,I got a letter from the debt collectors BCW on Thursday to say if I didn't respond to that letter within 5 days they were going to take legal proceeding against me. 10 minutes from receiving the letter I got a call from BCW to say that eircom had been in touch with them to say the issue has been resolved and that I don't owe the money,I am now waiting on a letter from BCW to tell me same so as I have it in writing. So hopefully that is the end of the issue, Many thanks Confused 1

  • Can anyone tell me how to check the balance on an iTunes gift card that is not yet scratched?

    Can anyone tell me how to check the balance on an iTunes gift card that is not yet scratched or activated?

    If it's not printed on the card, then you'll need to check the receipt from the purchase of the card. There's no way to check the value from the card itself without redeeming it.
    Regards.

  • Hi, I recently changed my username for my iTunes/iCloud account. Can anyone tell me how i change the username on my iCloud iPad? When I go onto setting to change it it keeps the username grey so I can't even select it?

    Hi, I recently changed my username for my iTunes/iCloud account. Can anyone tell me how i change the username on my iCloud iPad? When I go onto setting to change it it keeps the username grey so I can't even select it?

    Welcome to the Apple Community.
    In order to change your Apple ID or password for your iCloud account on your iOS device, you need to delete the account from your iOS device first, then add it back using your updated details. (Settings > iCloud, scroll down and hit "Delete Account")
    Providing you are simply updating your existing details and not changing to another account, when you delete your account, all the data that is synced with iCloud will also be deleted from the device (but not from iCloud), but will be synced back to your device when you login again.
    In order to change your Apple ID or password for your iCloud account on your computer, you need to sign out of the account from your computer first, then sign back in using your updated details. (System Preferences > iCloud, click the sign out button)
    In order to change your Apple ID or password for your iTunes account on your iOS device, you need to sign out from your iOS device first, then sign back in using your updated details. (Settings > iTunes & App store, scroll down and tap your ID)
    If you are using iMessages or FaceTime, you will also need to log out and into your ID there too.

Maybe you are looking for

  • Creating control area,Company codes and Cost centres

    Hello experts, I want to create a new controlling area,company code and cost centres for a new client. I know the transaction codes/menu path, but I would like to get an exact guidance for creating these. Experts pls comments on this, I want exact pr

  • Report output to spool...

    i am running a report in background and the report is having some write statements which automatically comes into the spool. now the question is when this write statements come into the spool as a output, the page display is not coming as it usually

  • Add apps to apple tv

    hello there's a lot of this content i don't have on my apple tv2: http://www.apple.com/appletv/whats-on/ including itunes festival which i would really like. anyobe knows how i add extra apps? they don't show up automatically after reboot? regards

  • Arbitrary JNDI names

    I am trying to deploy a session bean by specifying an arbitrary JNDI name in the file ejb-j2ee-engine.xml as below <?xml version="1.0" encoding="UTF-8"?> <ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLoca

  • Idevice share export is jittery

    I have 1080p AVCHD video that I have edited and when I share (export) to idevice 720 or 1080 the export is jittery and has frequent pixilation.  If I share it as archive, the video comes out fine.  I've checked the source mov files and they are fine.