Need Query Optimization Info

Hi Everyone:
I have a user on my site who's trying to find information on database query optimization. She's willing to pay $3 to someone who will give her some very basic information. I figured those of you who read this forum would have something handy you could just provide to her. It's not the information she's paying for, but the service of someone retrieving it for her. Would someone take a look? You can find her request here:
http://www.yepic.com/index.php?module=ContReq&hdnRequestID=8
The one problem is you have to register on the site before you can post your response. You just need to give create a username, email and password, though. It's very easy. I'd appreciate someone helping one of my users out.

. . . she's trying to avoid the
search taxSearch tax... never heard it put that way. I guess you are trying to avoid the "search engine" tax by advertising your site here? Maybe some one will help you out by answering the request from Corey for Search Engine Optimization.

Similar Messages

  • Needs Query Optimization

    Hi All
    I have the below query - which is a great performance killer.
    SELECT A~VBELN A~POSNR A~MATNR A~KWMENG A~KBMENG
             A~ERDAT A~ERZET A~PSTYV D~AUART E~ETTYP
             E~EDATU
               INTO TABLE INT_FIN
          FROM VBAP AS A
          INNER JOIN VBAK AS D ON D~VBELN EQ A~VBELN AND
                               D~MANDT EQ A~MANDT
          INNER JOIN VBEP AS E ON E~VBELN EQ A~VBELN AND
                               E~POSNR EQ A~POSNR    AND
                              E~MANDT EQ A~MANDT
               WHERE           A~VBELN IN s_VBELN AND
                               D~auart in s_auart AND
                               D~vkorg in s_vkorg AND
                               D~vbtyp eq 'C'     AND
      ( ( matnr LIKE c_prefix_sp AND zz_msposnr NE 0 AND kbmeng EQ 0 )
      OR ( matnr LIKE c_prefix_fp AND kwmeng NE A~kbmeng ) ) AND
                               A~ABGRU EQ SPACE      AND
                               A~MTVFP IN R_MTVFP    AND
                               A~PRCTR IN R_PRCT     AND
                               E~ETENR EQ '1'.
      SORT INT_FINBY VBELN POSNR ETTYP.
      DELETE ADJACENT DUPLICATES FROM INT_FIN COMPARING VBELN POSNR.
      CHECK NOT INT_FIN[] IS INITIAL.
      SELECT VBELN UVALL CMGST INTO TABLE INT_VBUK
              FROM VBUK FOR ALL ENTRIES IN INT_FIN
              WHERE VBELN = INT_FIN-VBELN AND
                    UVALL NE 'A'.
      SORT INT_VBUK BY VBELN.
      DELETE ADJACENT DUPLICATES FROM INT_VBUK COMPARING VBELN.
    How can I optimize this? Please help me to rewrite the same.
    Thx

    SELECT ...
          FROM VBAP AS A
          INNER JOIN VBAK AS D ON D~VBELN EQ A~VBELN AND
                               D~MANDT EQ A~MANDT
          INNER JOIN VBEP AS E ON E~VBELN EQ A~VBELN AND
                               E~POSNR EQ A~POSNR    AND
                              E~MANDT EQ A~MANDT
               WHERE           A~VBELN IN s_VBELN AND
                               D~auart in s_auart AND
                               D~vkorg in s_vkorg AND
                               D~vbtyp eq 'C'     AND
      ( ( matnr LIKE c_prefix_sp AND zz_msposnr NE 0 AND kbmeng EQ 0 )
      OR ( matnr LIKE c_prefix_fp AND kwmeng NE A~kbmeng ) ) AND
                               A~ABGRU EQ SPACE      AND
                               A~MTVFP IN R_MTVFP    AND
                               A~PRCTR IN R_PRCT     AND
                               E~ETENR EQ '1'.
    What is that ????
      ( ( matnr LIKE c_prefix_sp AND zz_msposnr NE 0 AND kbmeng EQ 0 )
      OR ( matnr LIKE c_prefix_fp AND kwmeng NE A~kbmeng ) ) AND
    adding the aliases would make your statement clearer.
    This can not be such a big issue, start with that one.
    SELECT ...
          FROM VBAP AS A
          INNER JOIN VBAK AS D
              ON D~MANDT EQ A~MANDT
              ON D~VBELN EQ A~VBELN
          INNER JOIN VBEP AS E
              ON   E~MANDT EQ A~MANDT
              AND E~VBELN EQ A~VBELN
              AND E~POSNR EQ A~POSNR  
        WHERE   A~VBELN IN s_VBELN.
    How many records are in s_VBELN?  Check number of entries of all three tables
    and use the alias of the smallest table.
    How does that work?
    Add the other conditions, without the complicated thing.
    At the end add the complicated condition with the correct aliases.
    Siegfried

  • Help needed to optimize the query

    Help needed to optimize the query:
    The requirement is to select the record with max eff_date from HIST_TBL and that max eff_date should be > = '01-Jan-2007'.
    This is having high cost and taking around 15mins to execute.
    Can anyone help to fine-tune this??
       SELECT c.H_SEC,
                    c.S_PAID,
                    c.H_PAID,
                    table_c.EFF_DATE
       FROM    MTCH_TBL c
                    LEFT OUTER JOIN
                       (SELECT b.SEC_ALIAS,
                               b.EFF_DATE,
                               b.INSTANCE
                          FROM HIST_TBL b
                         WHERE b.EFF_DATE =
                                  (SELECT MAX (b2.EFF_DATE)
                                     FROM HIST_TBL b2
                                    WHERE b.SEC_ALIAS = b2.SEC_ALIAS
                                          AND b.INSTANCE =
                                                 b2.INSTANCE
                                          AND b2.EFF_DATE >= '01-Jan-2007')
                               OR b.EFF_DATE IS NULL) table_c
                    ON  table_c.SEC_ALIAS=c.H_SEC
                       AND table_c.INSTANCE = 100;

    To start with, I would avoid scanning HIST_TBL twice.
    Try this
    select c.h_sec
         , c.s_paid
         , c.h_paid
         , table_c.eff_date
      from mtch_tbl c
      left
      join (
              select sec_alias
                   , eff_date
                   , instance
                from (
                        select sec_alias
                             , eff_date
                             , instance
                             , max(eff_date) over(partition by sec_alias, instance) max_eff_date
                          from hist_tbl b
                         where eff_date >= to_date('01-jan-2007', 'dd-mon-yyyy')
                            or eff_date is null
               where eff_date = max_eff_date
                  or eff_date is null
           ) table_c
        on table_c.sec_alias = c.h_sec
       and table_c.instance  = 100;

  • Autonomic Query Optimizer

    Hi All,
    I'm doing some bit of study on that portion of Query Optimizer in Oracle9i that is autonomic (I mean it is dynamic and a self learning one).Can anyone give me some pointers to this topic(In fact I doubt whether something like this at all exists, or is still a topic of research); I need some more info on this topic.Some papers or articles may be handy.
    Greetings,
    Kaustav Ghoshal

    I think u mean CBO (Cost Based Optimizer). If your database is running in "choose" mode so yes, CBO will automaticly optimize your query.
    Check the doc here : http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96533/part1.htm
    Fred

  • Oracle 11g on Linux : Query Optimization issue

    Hi guru,
    I am facing one query optimization related problem in group by query
    Table (10 million Records)
    Product(ProductId number,ProductName varchar(100),CategoryId VARCHAR2(38),SubCategoryId VARCHAR2(38))
    Index
    create index idxCategory on Product (CategoryId,SubCategoryId)
    Query1:To find product count for all CategoryId and SubCategoryId
    select CategoryId,SubCategoryId,count(*) from Product group by CategoryId,SubCategoryId
    Above query is not using index idxCategory and doing table scan which is very costly.
    When I fire Query2: select count(*) from Product group by CategoryId,SubCategoryId
    then it is properly using index idxCategory and very fast.
    Even I specified hint in Query1 but it is not using hint.
    Can anybody suggest why oracle is not using index in Query1 and what should I do so that Query1 will use Index.
    Thanks in advance.

    user644199 wrote:
    I am facing one query optimization related problem in group by query
    Query1:To find product count for all CategoryId and SubCategoryId
    select CategoryId,SubCategoryId,count(*) from Product group by CategoryId,SubCategoryId
    Above query is not using index idxCategory and doing table scan which is very costly.
    When I fire Query2: select count(*) from Product group by CategoryId,SubCategoryId
    then it is properly using index idxCategory and very fast.
    Even I specified hint in Query1 but it is not using hint.
    Can anybody suggest why oracle is not using index in Query1 and what should I do so that Query1 will use Index.The most obvious reason that the table needs to be visited would be that the columns "CategoryId" / "SubCategoryId" can be NULL but then this should apply to both queries. You could try the following to check the NULL issue:
    select CategoryId,SubCategoryId,count(*) from Product where CategoryId is not null and SubCategoryId is not null group by CategoryId,SubCategoryId
    Does this query use the index?
    Can you show us the hint you've used to force the index usage and the EXPLAIN PLAN output of the two queries including the "Predicate Information" section? Use DBMS_XPLAN.DISPLAY to get a proper output, and use the \ tag before and after when posting here to format it using fixed font. Use the "Quote" button in the message editor to see how I used the \ tag here.
    Are above queries representing the actual queries used or did you omit some predicates etc. for simplicity?
    By the way, VARCHAR2(38) and ...ID as name, are these columns storing number values?
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • OBIEE 11.1.1.7-Ago Function Error-[nQSError: 46008] Internal error: File server\Query\Optimizer\SmartScheduler\PhysicalRequestGenerator\Src\SQOSPMarkMultiTargetSupport.cpp

    Hi All,
    I was performing the steps mentioned in Oracle Tutorial"http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/bi11115/biadmin11g_02/biadmin11g.htm#t10"-BI RPD creation.
    After Using the AGO function data in the Time series metric(Month Ago Revenue) was null always. I updated the DB features in RPD physical layers by selecting support for time series functions.
    After that report started to fail with below error. Please let me know if its a bug and any option to fix it.
    Thanks,
    Sreekanth
    Error
    View Display Error
    Odbc driver returned an error (SQLExecDirectW). 
      Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P 
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 46008] Internal error: File server\Query\Optimizer\SmartScheduler\PhysicalRequestGenerator\Src\SQOSPMarkMultiTargetSupport.cpp, line 1680. (HY000) 
    SQL Issued: SELECT 0 s_0, "Sample Sales"."Time"."Year-L1" s_1, "Sample Sales"."Revenue"."Ago-Year Revenue" s_2, "Sample Sales"."Revenue"."Revenue" s_3 FROM "Sample Sales" FETCH FIRST 65001 ROWS ONLY
      Refresh

    I know that there is no relation between "SampleApp Lite"."D3 Orders (Facts Attributes)"."Order Date", "SampleApp Lite"."D0 Time"."Calendar Date", it's also the same thing in my own RPD.
    But as it's working with the 11.1.1.6.2 BP1 version I don't understand why it's not working with 11.1.1.6.9.
    Implicit fact column is not set on my repository, but I don't have any request with only dimensional column, so if my understanding is correct I don't need to use it. Also, the problem appears during the check of the repository not in answers.
    thanks anyway

  • Query on Info record

    Hi All,
    I have query on info recor. When we create info record(Me11), I am not able to see candition tab on info record where we maintained price.
    Please let me know what is the problem, let me know incase need some  more information.
    REgards,

    Hi,
    Do you really mean the info-record or Purchase order.
    Normally if the item category is U, then conditions tab will not come in purchase order.
    Regards,

  • Regarding Query Optimization

    Hi Gurus,
    I am preparing for an interview. I need to know about Query Optimization, explain plan, Cost analysis.
    Can anyone please give me some reference link or site where i can get step by step details for the above..
    It would be really helpfull.
    Thanks in advance..
    Ameya.

    RTFM [url http://oraclesvca2.oracle.com/docs/cd/B10501_01/server.920/a96533/toc.htm]Performance Tuning Guide and Reference

  • HFR - Data Query Optimization Settings

    hi
    In HFR, in a grid there are Data Query Optimization Settings, can you please help me on the settings property.
    Our report fetches data using lot of attributes. When we don't use MDX setting, it fetches very fast, but the alias doesn't come.
    However, when we use MDX setting, the alias comes, but the report takes lot of time to run(approx 1 min / row of data fetched)
    Can you please guide on the same.
    Thanks

    pm wrote:
    Hi ,
    I am working on below query optimization/Tuning.
    SELECT
    c_date,
    c1,
    c2,
    c3,
    c4,
    c5,
    c6
    FROM tab1
    WHERE
    ROWNUM <= &param
    AND ( c_date BETWEEN &date1 AND &date2 )
    AND c3 in (
    select c3
    from tab2
    where xxx='abc')
    ORDER BY c1, c_date;
    Note : &param,&date1 ,&date2 are parameters runtime getting from UI code .
    tab1 having huge data around 10lacs to crores. and it has range partition on c_date column and subpartiotion on c1 column.
    To get best throughput in less time, what i need to do ?
    Please do let me know steps to tune/optimize the sql query.Also which hint we can use on sql query to better results.
    Thanks in advanced.
    PMBefore you start worrying about performance tuning you should worry about the query being incorrect.
             WHERE
                 ROWNUM <= &param
                 AND   ( c_date BETWEEN &date1 AND &date2 )
                 AND c3 in (
                                             select c3
                                             from tab2
                                             where xxx='abc')
             ORDER BY c1, c_date;Presumably you want to limit the number of rows with the ROWNUM predicate AFTER the ORDER BY clause is applied.
    Please read this and learn how queries are actually processed, I can almost guarantee you this query is not doing what you think it is doing at present.
    http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html
    Cheers,

  • HT201269 I have an IPhone 4 that turns off.When I plug the phone into a outlet, it says to connect to iTunes. But my phone doesn't connect. I need to backup info to sync to a new iPhone. Is there another way to get the info from the old one?

    I have an IPhone 4 that turns off on its own. When I plug the phone into an outlet, it says to connect to iTunes. When i connect my phone to itunes, the screen displays the apple icon and doesn't connect to iTunes.  I need to backup info on this phone so I can apply my back up to a new iPhone. Is there any another way i can do this? My older phone will not show it's connected to iTunes. I used iCloud on the phone with problems, but I didn't back up all the info thru iCloud. Is there another way to back up?

    Sounds like your phone is in recovery mode.  In this case, all data on it is gone.  There's nothing to back up.

  • There are sites like Amazon, Facebook and pages where I need to put info on that don't totally show all the points. How can I get them to show up? I usually have to guess

    There are sites like Amazon, Facebook and pages where I need to put info like name, address, etc, that don't show where 'next' or 'skip' or 'continue' are. There is just alot of space. When I move my cursor around I have to guess if it's the right one and click

    For some ways around this see [http://kb.mozillazine.org/User_name_and_password_not_remembered User name and password not remembered - MozillaZine Knowledge Base]
    Another option is the [https://addons.mozilla.org/en-US/firefox/addon/60265/ Saved Password Editor] add-oin which allows you to add passwords for sites that disable password saving.

  • Need query to find out whether exactly 2 columns are used in any index ?

    Suppose i have two columns ID and Status (or any number of columns ) belongs to table customer...
    Now I want to create below index
    Ex. create index test1 on customer (ID , Status )
    But before creating this index i want to check that whether there is already index on these 2 columns ? May be by other name ?
    Need query for this.
    Plz help.

    Hi Shubhangi,
    Your requirement is very difficult to fulfill , i have made an attempt to replicate your reqrmnt & write a query wherein you need to compromise on few things , let us see if it works for you
    Supply table_name/owner & Number of column on which you want to find indexes
    e.g.
    select distinct INDEX_NAME,column_name
    from dba_ind_columns
    where index_name in (select distinct index_name
    from dba_ind_columns
    where table_name='&table_name'
    and table_owner='&owner'
    having count(column_name)=&column_count group by index_name);
    Enter value for table_name: ADDRESS
    Enter value for owner: ASAP
    Enter value for column_count: 2
    INDEX_NAME COLUMN_NAME
    FKIDX_AD__SF_ST_FO SF_STRUC_FORMAT_NM
    FKIDX_AD__SF_ST_FO SF_TYPE_NM
    SQL> /
    Enter value for table_name: ADDRESS
    Enter value for owner: ASAP
    Enter value for column_count: 3
    INDEX_NAME COLUMN_NAME
    FKIDX_AD__SF_ST_FO_1 POSTAL_CD
    FKIDX_AD__SF_ST_FO_1 SF_STRUC_FORMAT_NM
    FKIDX_AD__SF_ST_FO_1 SF_TYPE_NM
    Thanks,
    Ajay More
    http://moreajays.blogspot.com

  • What is query optimization and how to do it.

    Hi
    What is query optimization?
    Any link can any one provide me so that i can read and learn the techniques.
    Thanks
    Elias Maliackal

    THis is an excellent place to start: When your query takes too long ...

  • Reg Query Optimization - doubts..

    Hi Experts,
    This is related to Blog by Mr Prakash Darji regarding "Query Optimization" posted on Jan 26 2006.In this to optimize query Generation of Report is suggested.
    I tried this, but I am not sure I am analyzing this correctly.
    I collected Stats data before and after Generation of Report.But how to be sure that this is helping me? Did any one has tried this?
    What to look for in Stats Data - duration?
    But duration would not be absolute parameter as there is factor of "Wait Time, User", so duration may depend on this.
    Please help me in this.
    Thanks
    Gaurav
    Message was edited by: Gaurav

    Any ideas Experts?

  • Every time I right-click an image in Firefox 3.6.12 to view image size info it says "Unknown (not cached)". Any ideas on why this could be happening and how I can stop it? My OS is Ubuntu 10.10. If you need any more info let me know.

    Every time I right-click an image in Firefox 3.6.12 to view image size info it says "Unknown (not cached)". Any ideas on why this could be happening and how I can stop it? My OS is Ubuntu 10.10. If you need any more info let me know.

    Is the disk cache and the memory cache enabled?
    You can check these prefs on the about:config page.
    * http://kb.mozillazine.org/browser.cache.disk.enable
    * http://kb.mozillazine.org/browser.cache.memory.enable
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    Your More system details list shows two outdated Flash plugins that you should remove and update to Flash 10.1 r102 or at least remove 10.0 r45 and wait until your distribution offers a 10.1 r102 update.
    # Shockwave Flash 10.0 r45
    # Shockwave Flash 10.1 r85
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/

Maybe you are looking for

  • BOFC Unable to start the data source

    Hi there, i've done a standalone install using SQL 2008 R2 express. But i'm unable to start the data source and get this error: Failed to start data source Failed to start server instances on machine DELL1. Failed to initialize server configured on m

  • Best way to handle any knid of exception

    Hi Experts, What is the best way to handle any kind of Exceptions across the layer and show a user friendly error message, for eg the JBO 2900, which is an unexpected error. There is no clue as to this error happens at which layer so how an we handle

  • File Permissions in windows XP

    ok im alittle stumped on this i need to give my application read\write access to %USERPROFILE%\\savedir now if i put it fully qualified i.e. permission java.io.FilePermission "C:\\Documents andSettings\\zaelld\\.saveDir", "read, write"; it works fine

  • Debugging Personalization Issues

    Hi, While trying to hide some columns in an advanced table, I set their rendered property to FALSE at the responsibility level. At that time, it gave me an error message Setting rendered to false may hide this item and its children. The application m

  • Equium M40X silver top marks too easily

    My new M40X has a silver coloured lid/screen top that marks if you so much as look at it. It had a plastic transparent cover but that was ugly and peeled off. It is daft to make something so easily scratched when it is a portable device. Otherwise it