Asking about the most simplest SQL technique

select table1.field1,table1.field2
from table1, table2
where table2.category = 'A' and
table1.pk = table2.fk
=========================================
If table1 contains 500 records while table2 contain 400,000 records, then table2 should be placed to the most righthand side ?
If table2 has 1000 category 'A' record while
table2 has 80,000 records contain the pk of table1, then table1.pk = table2.fk should be placed on the most lower part in the where clause ?

It used to be the case that you had to consider these issues with some DBMS's, but generally not any more.
Sophisticated systems like Oracle can maintain sets of statistics on tables, and on the distribution of values within fields. If the DBA chooses to, he can run commands to make Oracle analyze individual tables and columns, and the statistics produced will be considered when choosing an access path for the data.
So, the database will know how many records are in the tables in your example query, and roughly how many category 'A' records are in table2 etc.. It will also know whether there are indexes on the columns, and will work out roughly how many bytes must be read to return the result depending on whether the indexes are used, which table is scanned first, and what join technique should be used.
Look in the Oracle documentation for the description of the ANALYZE command, the SQL*Plus command "set autotrace traceonly explain", and in the section on performance have a read of everything to do with the optimizer. It's an important area to know more about if you want to get the most out of Oracle, and is quite an eye-opener if you are moving to Oracle (or any complex RDBMS) frm simpler products (Foxpro, Access etc). Good luck.

Similar Messages

  • Certificate for the website, was going to copy and send an email to the website to ask about the certificate. I got my cursor just inside the pop up and the whole computer shut down. Why what happened i am not sure about going to the website now....

    Question
    Went to Crossings Book Club website while there something popped up about the certificate for the website, i was going to copy it and send an email to the website to ask about the certificate. I got my cursor just inside the pop up and the whole computer shut down.

    If you think getting your web pages to appear OK in all the major browsers is tricky then dealing with email clients is way worse. There are so many of them.
    If you want to bulk email yourself, there are apps for it and their templates will work in most cases...
    http://www.iwebformusicians.com/Website-Email-Marketing/EBlast.html
    This one will create the form, database and send out the emails...
    http://www.iwebformusicians.com/Website-Email-Marketing/MailShoot.html
    The alternative is to use a marketing service if your business can justify the cost. Their templates are tested in all the common email clients...
    http://www.iwebformusicians.com/Website-Email-Marketing/Email-Marketing-Service. html
    "I may receive some form of compensation, financial or otherwise, from my recommendation or link."

  • TS1702 when I am installing a new free app on my iphone , 'm asked about the way of payment . I check the none option in my apple Id account but it wouldn't be accepted . what should I do ?

    hi , I faced with a new problem recently while installing a free app.
    when I am installing a new free app on my iphone , I'm asked about the way of payment . I check the none option in my apple Id account but it wouldn't be accepted . what should I do ?
    regards

    You need to ask Apple for assistance with getting back into your old ID. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to resolve this issue through the Account Security team, fill out and submit this form.
    (118441)

  • My home button isn't working well so i went to my service provider to ask about the problem. They advised me to update my iPhone to iOS 5 but the problem is no matter what i do, there is always an error. What should I do?

    My home button isn't working well so i went to my service provider to ask about the problem. They advised me to update my iPhone to iOS 5 but the problem is no matter what i do, there is always an error. What should I do?

    If you are having Issues with downloading iOS 5....
    Try temporarily disabling your firewall and antivirus software and try again...
    See here for Connection Issues
    http://support.apple.com/kb/TS1379
    From Here
    http://www.apple.com/support/itunes/troubleshooting/

  • Application Tuning to find the most expensive sqls

    I have a schema in oracel 9i Release 2 and I want to do a performance testing from application side. Application is developed in Java . There are many queries in java side and some stored procedures are called while running the application.
    So I need to find the most expensive sqls by running the application and tracing the top sqls
    If I set trace enable at database level the trace files will be generated for all the connected sessions right? I want the trace file for only one schema. If I enable trace for a session I will not be able to trap the sqls since the application runs from another session . connection pooling also is used. suggest some good approaches to capture the most expensive sqls?

    Does the answers in your application tuning not suitable for you ?
    Nicolas.

  • Hi i just wanna ask about the volume down button in the ipad 2 ,it was mute the device when hold it at once but before 2days i noticed that the device did not mute when i hold it ,why? and how i fix this by the way it is still volume down

    hi i just wanna ask about the volume down button in the ipad 2 ,it was mute the device when hold it at once but before 2days i noticed that the device did not mute when i hold it ,why? and how i fix this by the way it is still volume down

    Have you tried restarting or rebooting the iPad and then see if the volume control will work again?
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • I ask about the price of changing ipod 4G screen in apple store?

    i ask about the price of changing ipod 4G screen in apple store?

    Apple will exchange your iPod for a refurbished one for $199 for a 64 GB one and $99 for the others. They do not fix yours.
      Apple - iPod Repair price
    Make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar      

  • I do not have credit card but in review your account always ask about the card information. what should i do?

    i do not have credit card but in review your account always ask about the card information. what should i do?

    Call the Apple Store and ask them what you should do if you want to purchase on line without a credit cart and without purchasing a gift card which seems to me would require a credit card.

  • I already  bought the annual plan, I installed PS, but i cant open the LR, it keeps asking about the serial no.

    I already  bought the annual plan, I installed PS, but i cant open the LR, it keeps asking about the serial no.
    isn't the annual plan for ps and lr?

    Download LR did you remove and reinstall your installation of Photoshop Lightroom 5?  The licensing for your membership will only be applied to Lightroom if you install through the Creative Cloud Desktop application.  You can find additional details at Install and update apps - https://helpx.adobe.com/creative-cloud/help/install-apps.html.

  • Payed for light room annual price, keep asking about the serial no.

    payed for light room annual price, keep asking about the serial no?

    Uninstall the "stand-alone" version of Lr, install the CC version via the CC Desktop app.

  • I have few questions to ask about the Expert Series and Valet Series

    Hello.
    I have few questions to ask about the Expert Series and Valet Series.
    1. I see there aren't any print server/bridge/access point for these two new series. Do I have to use previous ones? Or the new ones are in planned in near future?
    2. Do I "HAVE TO USE CONNECT SOFTWARE"?  Can I just use web interface to do every setting that these routers features?
    3. Does expert series routers support guest network and parental control?
    4. When I look into informations of these router, some router doesn't give information about backward compatible to older standards. Do I have to consider that as they are backward compatible with older standards?
    Ok, that's all for now.
    If I need to ask more questions I will do that in this thread as reply

    With the New Expert or the Valet Series Router, you still can use the Print Server / Bridge and Access Points.
    Well with the Expert and Valet Series router, you have an option to User Cisco Connect Software or you can User Web Interface of the Router. But with the Cisco Connect Software you have an Advantage of creating a Guest Account and using Parental Control , which is not available using the Web Interface.
    These both the routers are backward compatible and they can connect to your G Series Product.

  • Hello,  Recently, I asked about the possibility of swap the Adobe Design Standard CS5.5 from windows to mac. In response, I was directed to the help page and and i know that it is possible. Today I see that the help page is out of date. How cann I now swa

    Hello
    Recently, I asked about the possibility to swap from windows to mac with Adobe Design Standard CS5.5. In response, I was directed to the help page and i know that it is possible. But today I see that the help page is out of date.
    How cann I now swap platforms for Adobe Design Standard CS5.5? Do I realy need to buy CS6? Or afer dowloading the mac version of CS5.5 I get the key. And if I realy need upgreade the CS5.5 cann I use the Mac version of CS6 for the dowloaded mac version of CS5.5? Is it possible?

    Thanks !
    I didn't know that I cann buy CS6 Mac upgrade in Adobe Store.
    So I have only to buy the CS6 Mac versions and upgrade CS5.5 Win to CS6 Mac?
    How does look the procedure?
    Do I need to install first the CS5.5 Mac on my Macbook and then upgrade it or is it not necessary?
    Thanks
    Langosz

  • I wanted to ask about the iOS 7.

    Hello
    I wanted to ask about the iOS 7 This software will be available for iPod Touch 4?
    Thanks

    The iPod touch has only 256MB for RAM and has a single core Apple A4 Processor, While the iPhone 4 does share the same chip, it has more RAM (512MB) features like Parallax Wallpapers, Dynamic Wallpapers, Animated weather, Dynamic clock app, Translucency, and not to mention all the camera features and improvements cannot be on only 256MB RAM. The newer iPod touch features a dual core A5 chip with (512MB) RAM, This is also a reason the older iPod touch didn't get Siri.

  • I run OSX10.6.8. Just dwnlded FF8.1 and everytime I go to open it I am asked about the disk image. But if I delete the dmg, the program won't run.

    I just downloaded the 8.1 version. It was a 30+mb file. Previously I ran 4.0. So I drag the new Firefox icon into the Apps folder. It does its merge thing with the old version. Problem is when I click to open FF now, it always throws up this window asking me about the disk image of what I just downloaded. I even tried restarting the computer--but the same message pops up. I checked on your website and it says that I need to "eject" the disk image (i.e. I'm guessing that means the 30+ mb file I just down loaded), so since I don't have an eject option that I can find (except for external harddrives and cd/dvd), I just drug it into the trash. I go to empty the trash and I get a message that that dmg file is "in use" even though FF is completely shut down. So again I'm guessing that means that even though I already merged that dmg file with the old 4.0 version file, if I dump the update file it seems that it's going to mess up the actual revised program file still remaining. I just want to be able to click on the icon in my dock like I've always done and have FF open. I don't want to keep being asked about disk image stuff. Somehow this feels like an easy resolution, but I just can't seem to put my finger on how to resolve it. Thanks for you help.

    Nope---didn't work. I've owned Macs for about 12 years so although I am brain dead on some things, I do have a working knowledge on most things. I only say that to say this--I did try holding down the mouse and choosing empty trash. It asks if I want to permanently delete what's in there. I say yes--and then I get the same identical message again-----'The operation can't be completed because the item "Firefox 8.0.1.dmg" is in use I can then click stop, or continue.' So apparently that complains the same way it does if I click it up on the menu :)))
    As for item owned by---that's not an issue and isn't coming up. User is not a problem either as I am the only user on this system. There is only ONE file in my trash at the moment at that is this dmg file. Nothing Mac. Nothing owned by anyone other than Firefox. The problem seems to be that the dmg file and the original 4.0 FF file are working in tandem with each other--even though I have already drug the new 8.0 globe into the Apps folder and it updated the FF app with the new stuff. If I could force the dmg file to go away, I would do so, but at every turn the system is telling me it can't be done because it seems to think that dmg file is in use---even though everything is shut down and/or ejected. Hey--I'm getting ready to head out and won't be back till evening. I'll check back in this evening. Thank you again for your help.

  • A question about the impact of SQL*PLUS SERVEROUTPUT option on v$sql

    Hello everybody,
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0  Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>
    OS : Fedora Core 17 (X86_64) Kernel 3.6.6-1.fc17.x86_64I would like to ask a question about the SQL*Plus SET SERVEROUTPUT ON/OFF option and its impact on queries on views such as v$sql and v$session. Here is the problem
    Actually I define three variables in SQL*Plus in order to store sid, serial# and prev_sql_id columns from v$session in order to be able to use them later, several times in different other queries, while I'm still working in the current session.
    So, here is how I proceed
    SET SERVEROUTPUT ON;  -- I often activate this option as the first line of almost all of my SQL-PL/SQL script files
    SET SQLBLANKLINES ON;
    VARIABLE mysid NUMBER
    VARIABLE myserial# NUMBER;
    VARIABLE saved_sql_id VARCHAR2(13);
    -- So first I store sid and serial# for the current session
    BEGIN
        SELECT sid, serial# INTO :mysid, :myserial#
        FROM v$session
        WHERE audsid = SYS_CONTEXT('UserEnv', 'SessionId');
    END;
    PL/SQL procedure successfully completed.
    -- Just check to see the result
    SQL> SELECT :mysid, :myserial# FROM DUAL;
        :MYSID :MYSERIAL#
           129   1067
    SQL> Now, let's say that I want to run the following query as the last SQL statement run within my current session
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;According to Oracle® Database Reference 11g Release 2 (11.2) description for v$session
    http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_3016.htm#REFRN30223]
    the column prev_sql_id includes the sql_id of the last sql statement executed for the given sid and serial# which in the case of my example, it will be the above mentioned SELECT query on the employees table. As a result, right after the SELECT statement on the employees table I run the following
    BEGIN
        SELECT prev_sql_id INTO :saved_sql_id
        FROM v$session
        WHERE sid = :mysid AND serial# = :myserial#;
    END;
    PL/SQL procedure successfully completed.
    SQL> SELECT :saved_sql_id FROM DUAL;
    :SAVED_SQL_ID
    9babjv8yq8ru3
    SQL> Having the value of sql_id, I'm supposed to find all information about cursor(s) for my SELECT statement and also its sql_text value in v$sql. Yet here is what I get when I query v$sql upon the stored sql_id
    SELECT child_number, sql_id, sql_text
    FROM v$sql
    WHERE sql_id = :saved_sql_id;
    CHILD_NUMBER   SQL_ID          SQL_TEXT
    0              9babjv8yq8ru3    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;Therefore instead of
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;for the value of sql_text I get the following value
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES);Which is not of course what I was expecting to find in v$sql for the given sql_id.
    After a bit googling I found the following thread on the OTN forum where it had been suggested (well I think maybe not exactly for the same problem) to turn off SERVEROUTPUT.
    Problem with dbms_xplan.display_cursor
    This was precisely what I did
    SET SERVEROUTPUT OFFafter that I repeated the whole procedure and this time everything worked pretty well as expected. I checked SQL*Plus documentation for SERVEROUTPUT
    and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
    are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
    Could anyone kindly make some clarification?
    thanks in advance,
    Regards,
    Dariyoosh

    >
    and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
    are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
    Hi Dariyoosh,
    SET SERVEROUTPUT ON has the effect of executing dbms_output.get_lines after each and every statement. Not only related to system view.
    Here below what Tom Kyte is explaining in this page:
    Now, sqlplus sees this functionality and says "hey, would not it be nice for me to dump this buffer to screen for the user?". So, they added the SQLPlus command "set serveroutput on" which does two things
    1) it tells SQLPLUS you would like it <b>to execute dbms_output.get_lines after each and every statement</b>. You would like it to do this network rounding after each call. You would like this extra overhead to take place (think of an install script with hundreds/thousands of statements to be executed -- perhaps, just perhaps you don't want this extra call after every call)
    2) SQLPLUS automatically calls the dbms_output API "enable" to turn on the buffering that happens in the package.Regards.
    Al

Maybe you are looking for

  • Backup problems with external hard drive

    I bought a WD passport external hard drive and copied my itunes library onto a file there. I re-set the location of the library on itunes to the drive on the external hard drive. So far I have not deleted anything from my computer hard drive. However

  • Vendor ID and Vendor name don't appare

    Hi experts i've done a  Questionnaire via transaction ROS_QSTN_SURVEY. I've filled into the questionnaire the parameters VENDOR_NAME and VENDOR_ID but, at the end of the Registration of Supplier the Vendor ID and the Vendor Name don't appare. Any sug

  • PDF links (7.11.2.2) and behavior on the web

    Hello all, I'm trying to generate a PDF file (from scratch, using a C++ library - but that's not relevant to my question) that uses links to specify the location of linked files relative to the root of a drive - NOT relative to the PDF file itself (i

  • How to do transports in bpc 7.0 netweaver version?

    Hi all, I am new to bpc can anyone pls tell me how to carryout transports in bpc 7.0 netweaver version? thanks Pooja

  • Which components need to be monitored for a productive BO Enterprise XI 3.1

    Dear colleagues, we will start soon with a productive BO Enterprise XI 3.1 system. We do not have detailed information which components need to be monitored in a productive system. Is there any experience or are there documents available which give a