Performance problem using distributed query

Hi,
Can anyone provide an explanation/solution to the following problem encountered on an 8.1.7 database:
SELECT /*+ DRIVING_SITE(vs) */
vs.col2
,user_defined_function
FROM v_remote_table_1 vs
,v_remote_table_2 vc
,local_table_1 s
WHERE vp.col1 = vs.col1
AND s.col1 = vs.col2
AND vs.col2 = &some_val
This generalised query joins two tables in a remote database schema to a table in the local database schema and returns a single row. Without the call to the local user defined function, my specific query returns the row in less than a second. As soon as I include any local user defined function call, even a call to a dummy function which simply returns a string, my query takes several minutes to return its row. Explain plan gives exactly the same plan for both versions of the query, but the statistics are different:
Version without call to function
================================
8 recursive calls
0 db block gets
7 consistent gets
0 physical reads
0 redo size
235 bytes sent via SQL*Net to client
311 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
Version with call to function
=============================
93 recursive calls
4 db block gets
109 consistent gets
1998 physical reads
0 redo size
288 bytes sent via SQL*Net to client
312 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
2 sorts (memory)
2 sorts (disk)
1 rows processed
I'm assuming that, when calling a local function, the DRIVING_SITE hint is ignored, but I don't know why. It's quite important that we are able to include the results of function calls in the query. Any ideas as to the cause of the degraded performance and possible solutions to it would be most welcome!
Thanks.....

I would try something like:
SELECT r.col2,user_defined_function
FROM (SELECT vs.col2
      FROM v_remote_table_1 vs, v_remote_table_2 vp
      WHERE vp.col1 = vs.col1 AND
            vs.col2 = &some_val) r,
     local_table_1 s
WHERE s.col1 = r.col2Thismay allow Oracle to better seperate the calls to the two databases.
HTH
John

Similar Messages

  • Performance problem using OBJECT tag

    I have a performance problem using the java plugin and was wondering if anyone else was has seen the same thing. I have a rather complex applet that interacts with java script in a web page using the LiveConnect API. The applet both calls javascript in the page and is called by java script.
    Im using IE6 with the java plugin that ships with the 1.4.2_06 JVM. I have noticed that if I deploy the applet using the OBJECT tags, the application seems the trash everytime I call a java method on the applet from javascript. When I deplot the same applet using the APPLET tag the perfomance is much better. I would like to use the OBJECT tag because it applet bahaves better and I have more control over the caching.
    This problem seems to be on the boundaries of IE6, JScript, the JVM and my Applet (and I suppose any could be the real culprit). My application is IE5+ specific so I can not test the applet in isolation from the surround HTML/JavaScript (for example in another browser).
    Does anyone have any idea?
    thanks in advance.
    dennis.

    I have a performance problem using the java plugin and was wondering if anyone else was has seen the same thing. I have a rather complex applet that interacts with java script in a web page using the LiveConnect API. The applet both calls javascript in the page and is called by java script.
    Im using IE6 with the java plugin that ships with the 1.4.2_06 JVM. I have noticed that if I deploy the applet using the OBJECT tags, the application seems the trash everytime I call a java method on the applet from javascript. When I deplot the same applet using the APPLET tag the perfomance is much better. I would like to use the OBJECT tag because it applet bahaves better and I have more control over the caching.
    This problem seems to be on the boundaries of IE6, JScript, the JVM and my Applet (and I suppose any could be the real culprit). My application is IE5+ specific so I can not test the applet in isolation from the surround HTML/JavaScript (for example in another browser).
    Does anyone have any idea?
    thanks in advance.
    dennis.

  • (new?) performance problem using jDriver after a Sql Server 6.5 to 2000 conversion

    Hi,
    This is similar - yet different - to a few of the old postings about performance
    problems with using jdbc drivers against Sql Server 7 & 2000.
    Here's the situation:
    I am running a standalone java application on a Solaris box using BEA's jdbc driver
    to connect to a Sql Server database on another network. The application retrieves
    data from the database through joins on several tables for approximately 40,000
    unique ids. It then processes all of this data and produces a file. We tuned
    the app so that the execution time for a single run through the application was
    24 minutes running against Sql Server 6.5 with BEA's jdbc driver. After performing
    a DBMS conversion to upgrade it to Sql Server 2000 I switched the jDriver to the
    Sql Server 2000 version. I ran the app and got an alarming execution time of
    5hrs 32 min. After some research, I found the problem with unicode and nvarchar/varchar
    and set the "useVarChars" property to "true" on the driver. The execution time
    for a single run through the application is now 56 minutes.
    56 minutes compared to 5 1/2 hrs is an amazing improvement. However, it is still
    over twice the execution time that I was seeing against the 6.5 database. Theoretically,
    I should be able to switch out my jdbc driver and the DBMS conversion should be
    invisible to my application. That would also mean that I should be seeing the
    same execution times with both versions of the DBMS. Has anybody else seen a
    simlar situation? Are there any other settings or fixes that I can put into place
    to get my performance back down to what I was seeing with 6.5? I would rather
    not have to go through and perform another round of performance tuning after having
    already done this when the app was originally built.
    thanks,
    mike

    Mike wrote:
    Joe,
    This was actually my next step. I replaced the BEA driver with
    the MS driver and let it run through with out making any
    configuration changes, just to see what happened. I got an
    execution time of about 7 1/2 hrs (which was shocking). So,
    (comparing apples to apples) while leaving the default unicode
    property on, BEA ran faster than MS, 5 1/2 hrs to 7 1/2 hrs.
    I then set the 'SendStringParametersAsUnicode' to 'false' on the
    MS driver and ran another test. This time the application
    executed in just over 24 minutes. The actual runtime was 24 min
    16 sec, which is still ever so slightly above the actual runtime
    against SS 6.5 which was 23 min 35 sec, but is twice as fast as the
    56 minutes that BEA's driver was giving me.
    I think that this is very interesting. I checked to make sure that
    there were no outside factors that may have been influencing the
    runtimes in either case, and there were none. Just to make sure,
    I ran each driver again and got the same results. It sounds like
    there are no known issues regarding this?
    We have people looking into things on the DBMS side and I'm still
    looking into things on my end, but so far none of us have found
    anything. We'd like to continue using BEA's driver for the
    support and the fact that we use Weblogic Server for all of our
    online applications, but this new data might mean that I have to
    switch drivers for this particular application.Thanks. No, there is no known issue, and if you put a packet sniffer
    between the client and DBMS, you will probably not see any appreciable
    difference in the content of the SQL sent be either driver. My suspicion is
    that it involves the historical backward compatibility built in to the DBMS.
    It must still handle several iterations of older applications, speaking obsolete
    versions of the DBMS protocol, and expecting different DBMS behavior!
    Our driver presents itself as a SQL7-level application, and may well be treated
    differently than a newer one. This may include different query processing.
    Because our driver is deprecated, it is unlikely that it will be changed in
    future. We will certainly support you using the MS driver, and if you look
    in the MS JDBC newsgroup, you'll see more answers from BEA folks than
    from MS people!
    Joe
    >
    >
    Mike
    The next test you should do, to isolate the issue, is to try another
    JDBC driver.
    MS provides a type-4 driver now, for free. If it is significantly faster,
    it would be
    interesting. However, it would still not isolate the problem, because
    we still would
    need to know what query plan is created by the DBMS, and why.
    Joe Weinstein at BEA
    PS: I can only tell you that our driver has not changed in it's semantic
    function.
    It essentially send SQL to the DBMS. It doesn't alter it.

  • Performance Problem in Select query

    Hi,
    I have performance Problem in following Select Query :
    SELECT VBELN POSNR LFIMG VRKME VGBEL VGPOS
      FROM LIPS INTO CORRESPONDING FIELDS OF TABLE GT_LIPS
       FOR ALL ENTRIES IN GT_EKPO1
       WHERE VGBEL = GT_EKPO1-EBELN
         AND VGPOS = GT_EKPO1-EBELP.
    as per trace i have analysed that it is fetch the complete table scan from the LIPS table and table contants almost 3 lakh records.
    Kindly Suggest what we can do to optimize this query.
    Regards,
    Harsh

    types: begin of line,
              vbeln type lips-vbeln
              posnr type lips-posnr
              lfimg type lips-lfimg
             vrkme type lips-vrkme
             vgbel type lips- vgbel
             vgpos type lips-vgpos
             end of line.
    data: itab type standard table of line,
             wa type line.
    IF GT_EKPO1[] IS NOT INITIAL.
    SELECT VBELN POSNR LFIMG VRKME VGBEL VGPOS
    FROM LIPS INTO  TABLE ITAB
    FOR ALL ENTRIES IN GT_EKPO1
    WHERE VGBEL = GT_EKPO1-EBELN
    AND VGPOS = GT_EKPO1-EBELP.
    ENDIF.

  • Problem using distribute form - A recipient is ambiguous

    Hello all,
    We prepared a form and use distribute form option to send to our coworkers and collect results. They received the email, complete the form and when they try to send back they receive "A recipient is ambiguous" message.
    We try to prepare the form in diferent versions with similar results. They are using the Acrobat 8.0, Windows XP and MS Outlook 2003 and 2007.
    We tested only using Acrobat Reader and WORKS!!!. My questions is we are planing to send this form to a lot of people and we need some ideas how can people can handled that, because if they have a Acrobat (full version) will be have the same problem.
    Now other option or idea is: It if possible to use some URL and add in paremeter to open only with Acrobat Reader???
    Thanks in advance for your information, ideas or solution.
    Oscar Calagua

    It is not possible to restrict to Reader users. More importantly, since users are not supposed to have Reader and Acrobat on the same computer, you may prevent people who need to fill out the form that need to.

  • Problem use SQL query in coding report with SBO

    Hi everyone!
    I have problem in execute query to delete and create a report with SQL 2000 in SAP.
    Try
            oForm.DataSources.DataTables.Item(0).ExecuteQuery("DELETE FROM rptReport")
    Catch ex As Exception
    End Try
             oForm.DataSources.DataTables.Add("TestReport")
             oForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT     Number, RefDate, Memo        into  rptReport   FROM         dbo.OJDT")
             oTable = oForm.DataSources.DataTables.Item("TestReport")
    This code is error. I don't know how to execute 2 this sql command. Hope everyone help me hix hix!  .

    /Invalid query tree  [300-33]. The SQL error is 8180/
    But search in SQL book hasn't got that err. Some person spoke ExecuteQuery property wasn't support Table Delete and Create, it only support simple Select... I tried to use Recordset but don't success. Can I use "Delete" and "Select ... Into..."   query another style??? Help me, please...!!!

  • Problems using distributed JMS topic

              I'm having problems using a distributed topic. I'm running WebLogic 8.1 (SP1)
              with two managed servers in a cluster. I created a new distributed topic using
              the console, and used auto deploy to target the distributed topic to the cluster
              and create members on both servers. I deployed three message-driven EJBs (listening
              on the distributed topic) to both servers.
              After initial deployment, the topic works as expected - I post a message to the
              distributed topic, and it is received by all six EJBs. When I re-start the system
              (both managed servers and the admin server), however, the results are different.
              When I post a message to the distributed topic, it is only received by the three
              EJBs on the first server (the log shows that all EJBs have deployed successfully).
              Under Deployments/EJB Modules/Monitoring, the EJBs on the second server show "JMSConnection
              Alive" as false, while the others are true.
              Under Monitoring/"Monitor all Active JMS Destinations..." for the member topics,
              there are three consumers listed when there should be six.
              If remove and re-create the member topics, or the distributed topic, exceptions
              appear in the log saying that one or both of the member topics are "suspended".
              Is there additional configuration that needs to be done for this scenario? Are
              there any known problems related to distributed topics?
              Thanks,
              Richard
              

    Hi Richard,
              There are no 8.1SP1 problems that I know of.
              Check your logs for Warnings and Errors - distributed topics
              members often log an explanatory message
              when they fail to contact their fellow members.
              Also make sure that you have configured so that
              the following are true:
              All WL servers are named differently.
              All JMS servers are named differently.
              All JMS stores are named differently.
              All distributed topic members within a distributed topic are named
              differently.
              Also make sure that your cluster is coming up
              properly in the first place. If you have
              trouble doing so, you can post
              to the clustering newsgroups for info.
              Tom
              Richard Killen wrote:
              > I'm having problems using a distributed topic. I'm running WebLogic 8.1 (SP1)
              > with two managed servers in a cluster. I created a new distributed topic using
              > the console, and used auto deploy to target the distributed topic to the cluster
              > and create members on both servers. I deployed three message-driven EJBs (listening
              > on the distributed topic) to both servers.
              >
              > After initial deployment, the topic works as expected - I post a message to the
              > distributed topic, and it is received by all six EJBs. When I re-start the system
              > (both managed servers and the admin server), however, the results are different.
              > When I post a message to the distributed topic, it is only received by the three
              > EJBs on the first server (the log shows that all EJBs have deployed successfully).
              >
              > Under Deployments/EJB Modules/Monitoring, the EJBs on the second server show "JMSConnection
              > Alive" as false, while the others are true.
              >
              > Under Monitoring/"Monitor all Active JMS Destinations..." for the member topics,
              > there are three consumers listed when there should be six.
              >
              > If remove and re-create the member topics, or the distributed topic, exceptions
              > appear in the log saying that one or both of the member topics are "suspended".
              >
              > Is there additional configuration that needs to be done for this scenario? Are
              > there any known problems related to distributed topics?
              >
              > Thanks,
              > Richard
              >
              

  • Performance problem in delete query

    Hi,
    I have to delete nearly 900 records from a table having 10 million records.
    Each time I am deleting 100 of these records and calling this query from my
    application many times. If I increase the rownum to 1000 then I get rollback
    segment error due to limitation of user buffer.
    Delete query is as follows
    DELETE FROM try
    WHERE DATEY2K<:b1
    AND DATEY2K>0
    AND ROWNUM<=100
    where DATEY2K is a number field storin date information.
    The TKPROF are as following
    call count cpu elapsed disk query current rows
    Parse 0 0.00 0.00 0 0 0 0
    Execute 9 765.22 5705.34 1340105 1580307 27501 759
    Fetch 0 0.00 0.00 0 0 0 0
    total 9 765.22 5705.34 1340105 1580307 27501 759
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Optimizer goal: FIRST_ROWS
    Parsing user id: 14
    Rows Execution Plan
    0 DELETE STATEMENT GOAL: FIRST_ROWS
    0 COUNT (STOPKEY)
    0 TABLE ACCESS (BY ROWID) OF 'TRY'
    0 INDEX (RANGE SCAN) OF 'ASH' (NON-UNIQUE)
    The index ASH is on 2 columns of which first is DATEY2K.
    Please advice/suggest to improve the performance of the above query.
    Regards,
    Ashish

    What is the exact error message you are getting. It strikes me that if you cannot delete 900 records from any table, then your rollback is way too small.
    Can you issue the query as a SELECT without the rownum?
    John

  • Performance problem using multi-thread

    I am using berkeley db to store a int/double pair, and i randomly get 100,0000 results to check the performance . Using 1 thread, it cost about 1 Mins. But using 4 threads, it costs 4 Mins. More threads, lower performance. Is there Anyone know the reason?
    Env flags:
    envFlags=DB_CREATE | DB_INIT_MPOOL | DB_THREAD | DB_PRIVATE|DB_INIT_CDB;
    DB open flags: DB_THREAD
    and i use db->get method to get results.

    Berkeley DB 4.8 will be released soon and has features that address CMP/SMP scalability. We would appreciate your feedback on your experiences with it. Once available, please test it and post your results here, I'm sure you'll be pleasently surprised.
    regards,
    -greg

  • Performance problem with report query

    Hi,
    I am encountering a performance issue with a page returning a report.
    I have a page that has a region which joins 2 tables. One table has about 220,00 rows, while the other contains roughly 60,000 rows. In the region source of the report region, the query includes join condition with local variables. For example, the page is page 70, and some join conditions are:
    and a.id=:P70_ID
    and a.name like :P70_NAME
    I run the query that returns a large number of rows from sqlplus, and it takes less than 30 sec to complete.
    When I run the page, the report took about 3 minutes to return.
    In this case, :P70_NAME is initialized to '%' on the page.
    I then tried to substitute variable value directly in the query:
    and a.id=1000
    and a.name like '%'
    this time the report returned in about 30 sec.
    I then tried another thing which specified the region as "PL/SQL Function returning sql query", and modified the region as follows:
    l_sql := '.......';
    l_sql := l_sql || 'and a.id=' || v('P70_ID')
    and similar substituting :P70_NAME to v('P70_NAME') and append its value to the l_sql string.
    The report query page also returned in 30 sec.
    Is there any known performance issue with using the bind variable (:PXX_XXX) in the report region?

    If you are able.. flush the shared_pool, run your
    report then query the v$sql_area or v$sql_text tables.
    Or do a google query and look up Cary Milsap's piece on enabling extended trace .. there is your sure fire way of finding the problem sql. I am still learning htmldb but is there a way to alter session enable trace in some pre-query block?

  • Mapviewer performance problem using image format FORMAT_RAW_COMPRESSED

    I am using the MapViewer.FORMAT_RAW_COMPRESSED map image in my (java) map application because some features must be clickable and as far as I can work out, this is the only way to achieve this in a Java client. On my local system, running the map server in an oc4j container, this works about as fast as using FORMAT_GIF_URL and loading the image from this url. There also doesn't seem to be much difference in memory and cpu usage.
    When I direct the request to a map server running on a remote Application Server the rendering time grows exponentially. The same maprequest using FORMAT_GIF_URL runs as fast as it does in my local OC4J container. The problem seems to be in "packing time" in RealWorker:
    Remote AS:
    Thu Jun 30 13:59:34 CEST 2005 DEBUG [oracle.lbs.mapserver.core.MapperPool] freeMapper() begins...
    Thu Jun 30 13:59:34 CEST 2005 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] preparation time: 99ms
    Thu Jun 30 13:59:34 CEST 2005 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] querying/rendering time: 5560ms
    Thu Jun 30 13:59:34 CEST 2005 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] packing time: 142605ms
    Thu Jun 30 13:59:34 CEST 2005 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] --------------- total time: 148264ms
    Local OC4J:
    Thu Jun 30 15:34:42 CEST 2005 DEBUG [oracle.lbs.mapserver.core.MapperPool] freeMapper() begins...
    Thu Jun 30 15:34:42 CEST 2005 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] preparation time: 540ms
    Thu Jun 30 15:34:42 CEST 2005 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] querying/rendering time: 2490ms
    Thu Jun 30 15:34:42 CEST 2005 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] packing time: 120ms
    Thu Jun 30 15:34:42 CEST 2005 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] --------------- total time: 3150
    The test server is smaller than my local system and more applications are running on the AS, generating the map takes all the available memory and cpu, but the difference between the time it takes generating a GIF image and generating a Java image of almost a factor 50 is puzzling.
    What could cause this enormous difference? Any idea's about how we can analyze or solve this? What could RealWorker be doing in this packing time? Any hints would be greatly appreciated.
    Many thanks,
    Ida

    Thanks for the replies!
    1. Which AS version are you using? -> 10.1.2
    2. Just as a test, if you restart AS (if possible) do you still get the same values? -> yes, we restarted the AS and the results are the same.
    The server is indeed running low in memory. It is a 512MB machine, just big enough to run the AS. The production server will have some more, but not very much. Could I estimate how much extra memory it will need to keep a good performance when generating maps with live features? And maybe I'm wrong, but shouldn't the extra load for the java image only be on the client, since that's where the image is made? On the server it's just the image data, isn't it?
    I tried removing the basemap, but that reduces the loading time just with a few seconds. The live themes are jdbc themes and result in only some 20 to 30 geofeatures. Removing them from the request so only an empty image with a title is retrieved still takes about 117 seconds. Reducing the device size does reduce the loading time, so it does seem to have something to do with the amount of pixels in the image space, not with the data. Could it be that in the "packing" of the image something happens that takes a lot of memory, related to the amount of pixels?
    In my situation it would be handy if the live features were also returned when the image format is not set to FORMAT_RAW_COMPRESSED, it is also possible to draw shapes onto an existing image and this would bypass the memory problems.
    Thanks for any further help.
    Ida

  • Performance problems using BPM

    Hello all,
    We have Request/Reply interface using the JMS adapter towards the SAP R/3 system.
    So the interface has 3 steps :
    1. Request from JMS adapter - Asynchronous
    2. Request/Reply using RFC adapter towards the R/3 - sync
    3. Reply to JMS adapter - Asynchronous
    we are using the BPM to merge all those steps, but between step 1 to 2 it waits about 4 seconds (we can monitor the message at SM58 for 2-3 seconds).
    Its a problem for us because we exceed the time for the Request/reply at the MQ (which is connected to the JMS adapter).
    Does someone has any idea ?
    Regards,
    Yaki

    Hello again Michelle, Kjetil,
    We looked into this and given your details provided
    regarding the query executed and the fact that this
    problem shows up over thin network connections, we
    believe you may be hitting one/both of Bug 2658196
    and Bug 1844184.
    To summarise, regardless of whether you use version
    control or not, Designer must check version details
    for each repository object acted on.
    On a local machine or LAN, this does not present a
    problem, but on a WAN, this does, due the amount of
    (albeit individually small) packets of information
    sent backwards and forwards between the client and
    the repository.
    Unfortunately, Oracle Designer was never designed to
    run across a WAN. To attempt to get the performance
    required would involve a re-design and re-write of a
    large part of the Design Editor. I'm afraid this is
    not really a practical option.
    Other customers have also run into this problem. They
    have found that using a third party product, such as,
    Tarantella solves the problem. Products like Tarantella
    enable clients to use central installations of Designer
    with better results than using a locally installed copy.
    Please see Metalink (http://meatlink.oracle.com) for
    full details on the bugs themselves.
    Hope this helps.
    Regards,
    Dominic
    Designer Product Management
    Oracle Cor

  • Many-to-many Performance Problem (Using FAQ Template)

    Having read "HOW TO: Post a SQL statement tuning request - template posting" I have gathered:
    I have included some background information at the bottom of the post
    The following SQL statement has been identified as performing poorly. It takes ~160 seconds to execute, but similar (shown below first statement) SQL statements executes in ~1 second.
    SQL taking 160 seconds:
    SELECT
    a.*
    FROM
    table_a a
    INNER JOIN table_a_b ab ON a.id = ab.media_fk
    WHERE
    ab.channel_fk IN (7, 1);SQL taking ~1 second or less
    ab.channel_fk IN (7);Or even:
    ab.channel_fk IN (6, 9, 170, 89);The purpose of the SQL is to return rows from table_a that are associated with table_b (not in SQL) through the junction table table_a_b.
    The version of the database is 10.2.0.4.0
    These are the parameters relevant to the optimizer:
    show parameter optimizer;
    NAME                                               TYPE        VALUE
    optimizer_dynamic_sampling                         integer     2
    optimizer_features_enable                          string      10.2.0.4
    optimizer_index_caching                            integer     0
    optimizer_index_cost_adj                           integer     100
    optimizer_mode                                     string      ALL_ROWS
    optimizer_secure_view_merging                      boolean     TRUE
    show parameter db_file_multi;
    NAME                                               TYPE        VALUE
    db_file_multiblock_read_count                      integer     16
    show parameter db_block_size;
    NAME                                               TYPE        VALUE
    db_file_multiblock_read_count                      integer     16
    select sname, pname, pval1, pval2 from sys.aux_stats$;
    SNAME                          PNAME                          PVAL1                  PVAL2
    SYSSTATS_INFO                  STATUS                                                COMPLETED
    SYSSTATS_INFO                  DSTART                                                07-18-2006 23:19
    SYSSTATS_INFO                  DSTOP                                                 07-25-2006 23:19
    SYSSTATS_INFO                  FLAGS                          0
    SYSSTATS_MAIN                  SREADTIM                       5.918
    SYSSTATS_MAIN                  MREADTIM                       7.889
    SYSSTATS_MAIN                  CPUSPEED                       1383
    SYSSTATS_MAIN                  MBRC                           8
    SYSSTATS_MAIN                  MAXTHR                         1457152
    SYSSTATS_MAIN                  SLAVETHR                       -1Here is the output of EXPLAIN PLAN:
    PLAN_TABLE_OUTPUT
    Plan hash value: 3781163428
    | Id  | Operation             | Name               | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |                    |  1352K|   771M|       | 60042   (3)| 00:05:56 |
    |*  1 |  HASH JOIN            |                    |  1352K|   771M|    27M| 60042   (3)| 00:05:56 |
    |*  2 |   INDEX FAST FULL SCAN| SYS_IOT_TOP_316310 |  1352K|    11M|       |  1816   (4)| 00:00:11 |
    |   3 |   TABLE ACCESS FULL   | TABLE_A            |  2190K|  1230M|       | 32357   (4)| 00:03:12 |
    Predicate Information (identified by operation id):
       1 - access(""AB"".""MEDIA_FK""=""A"".""ID"")
       2 - filter(""AB"".""CHANNEL_FK""=1 OR ""AB"".""CHANNEL_FK""=7)
    Note
       - 'PLAN_TABLE' is old versionFor reference, the EXPLAIN PLAN when using
    ab.channel_fk IN (6, 9, 170, 89);which executes in ~1 second is:
    PLAN_TABLE_OUTPUT
    Plan hash value: 794334170
    | Id  | Operation          | Name      | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |           |   143K|    81M|       | 58982   (3)| 00:05:50 |
    |*  1 |  HASH JOIN         |           |   143K|    81M|  2952K| 58982   (3)| 00:05:50 |
    |   2 |   INLIST ITERATOR  |           |       |       |       |            |          |
    |*  3 |    INDEX RANGE SCAN| C_M_INDEX |   143K|  1262K|       |  1264   (1)| 00:00:08 |
    |   4 |   TABLE ACCESS FULL| TABLE_A   |  2190K|  1230M|       | 32357   (4)| 00:03:12 |
    Predicate Information (identified by operation id):
       1 - access(""AB"".""MEDIA_FK""=""A"".""ID"")
       3 - access(""AB"".""CHANNEL_FK""=6 OR ""AB"".""CHANNEL_FK""=9 OR
                  ""AB"".""CHANNEL_FK""=89 OR ""AB"".""CHANNEL_FK""=170)
    Note
       - 'PLAN_TABLE' is old versionHere is the output of SQL*Plus AUTOTRACE including the TIMING information:
    SQL> set autotrace traceonly arraysize 100;
    SQL> SELECT
      2  a.*
      3  FROM
      4  table_a a
      5  INNER JOIN table_a_b ab ON a.id = ab.media_fk
      6  WHERE
      7  ab.channel_fk IN (7, 1);
    1336148 rows selected.
    Execution Plan
    Plan hash value: 3781163428
    | Id  | Operation             | Name               | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |                    |  1352K|   771M|       | 60042   (3)| 00:05:56 |
    |*  1 |  HASH JOIN            |                    |  1352K|   771M|    27M| 60042   (3)| 00:05:56 |
    |*  2 |   INDEX FAST FULL SCAN| SYS_IOT_TOP_316310 |  1352K|    11M|       |  1816   (4)| 00:00:11 |
    |   3 |   TABLE ACCESS FULL   | TABLE_A            |  2190K|  1230M|       | 32357   (4)| 00:03:12 |
    Predicate Information (identified by operation id):
       1 - access("AB"."MEDIA_FK"="A"."ID")
       2 - filter("AB"."CHANNEL_FK"=1 OR "AB"."CHANNEL_FK"=7)
    Note
       - 'PLAN_TABLE' is old version
    Statistics
          10586  recursive calls
              0  db block gets
         200457  consistent gets
         408343  physical reads
              0  redo size
      498740848  bytes sent via SQL*Net to client
         147371  bytes received via SQL*Net from client
          13363  SQL*Net roundtrips to/from client
             49  sorts (memory)
              0  sorts (disk)
        1336148  rows processedThe TKPROF output for this statement looks like the following:
    TKPROF: Release 10.2.0.4.0 - Production on Mon Oct 1 12:23:21 2012
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: ..._ora_4896.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    ALTER SYSTEM SET TIMED_STATISTICS = TRUE
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.03          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.03          0          0          0           0
    Misses in library cache during parse: 0
    Parsing user id: 21
    SELECT
    a.*
    FROM
    table_a a
    INNER JOIN table_a_b ab ON a.id = ab.media_fk
    WHERE
    ab.channel_fk IN (7, 1)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        2     27.23     163.57     179906     198394          0          16
    total        4     27.25     163.58     179906     198394          0          16
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 21
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        2      0.01       0.00          0          0          0           0
    Execute      2      0.00       0.03          0          0          0           0
    Fetch        2     27.23     163.57     179906     198394          0          16
    total        6     27.25     163.62     179906     198394          0          16
    Misses in library cache during parse: 1
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        0      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
        2  user  SQL statements in session.
        0  internal SQL statements in session.
        2  SQL statements in session.
    Trace file: ..._ora_4896.trc
    Trace file compatibility: 10.01.00
    Sort options: default
           1  session in tracefile.
           2  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           2  SQL statements in trace file.
           2  unique SQL statements in trace file.
          46  lines in trace file.
         187  elapsed seconds in trace file.The DBMS_XPLAN.DISPLAY_CURSOR output:
    select * from table(dbms_xplan.display_cursor('474frsqbc1n4d', null, 'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  474frsqbc1n4d, child number 0
    SELECT /*+ gather_plan_statistics */ c.* FROM table_a c INNER JOIN table_a_b ab ON c.id = ab.media_fk WHERE ab.channel_fk IN (7, 1)
    Plan hash value: 3781163428
    | Id  | Operation             | Name               | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  | Writes |  OMem |  1Mem | Used-Mem |
    |*  1 |  HASH JOIN            |                    |      1 |   1352K|   1050 |00:00:40.93 |     198K|    182K|    209K|    29M|  5266K| 3320K (1)|
    |*  2 |   INDEX FAST FULL SCAN| SYS_IOT_TOP_316310 |      1 |   1352K|   1336K|00:00:01.34 |   10874 |      0 |      0 |       |       |          |
    |   3 |   TABLE ACCESS FULL   | TABLE_A            |      1 |   2190K|   2267K|00:02:45.56 |     187K|    182K|      0 |       |       |          |
    Predicate Information (identified by operation id):
       1 - access(""AB"".""MEDIA_FK""=""C"".""ID"")
       2 - filter((""AB"".""CHANNEL_FK""=1 OR ""AB"".""CHANNEL_FK""=7))Thank you for reading I'm looking forward for suggestions how to improve the performance of this statement.
    h3. Backgroud
    Many years ago my company made the decision to store many-to-many relationships in our database using pipe delimited fields. An example field value:
    '|ABC|XYZ|VTR|DVD|'Each delimited value refers to a unique 'short code' in TABLE_B (There is also a true numeric foreign key in TABLE_B which is what I'm using in the junction table). We regularly search using these column with the following style SQL:
    WHERE
    INSTR(pipedcolumn, '|ABC|') > 0
    OR INSTR(pipedcolumn, '|XYZ|' > 0
    ...Appropriate indexes have been created over the years to make this process as fast a possible.
    We now have an opportunity to fix some of these design mistakes and implement junction tables to replace the piped field. Before this we decided to take a copy of a database from a customer with the largest record set and test. I created a new junction table:
    TABLE_A_B DDL:
        CREATE TABLE TABLE_A_B (
            media_fk NUMBER,
            channel_fk NUMBER,
            PRIMARY KEY (media_fk, channel_fk),
            FOREIGN KEY (media_fk) REFERENCES TABLE_A (ID),
            FOREIGN KEY (channel_fk) REFERENCES TABLE_B (ID)
        ) ORGANIZATION INDEX COMPRESS;
        CREATE INDEX C_M_INDEX ON TABLE_A_B (channel_fk, media_fk) COMPRESS;And parsing out a pipe delimited field, populated this new table.
    I then compared the performance of the following SQL:
    SELECT
    a.*
    FROM
    table_a a
    INNER JOIN table_a_b ab ON a.id = ab.media_fk
    WHERE
    ab.channel_fk IN (x, y, n); -- Can be Many Minutes
    --vs.
    SELECT
    a.*
    FROM
    table_a a
    WHERE
    INSTR(OWNERS,'|x|')    >0
    OR INSTR(OWNERS,'|y|')    >0
    OR INSTR(OWNERS,'|n|')    >0; -- About 1 second seemingly regardlessWhen x, y, n are values that occur less frequently in TABLE_A_B.CHANNEL_FK the performance is comparable. However once the frequency of x, y, n increases the performance suffers. Here is a summary of the CHANNEL_FK data in TABLE_A_B:
    --SQL For Summary Data
    SELECT channel_fk, count(channel_fk) FROM table_a_b GROUP BY channel_fk ORDER BY COUNT(channel_fk) DESC;
    CHANNEL_FK             COUNT(CHANNEL_FK)
    7                      780741
    1                      555407
    2                      422493
    3                      189493
    169                    144663
    9                      79457
    6                      53051
    171                    28401
    170                    19857
    49                     12603
    ...I've noticed that once I use any combination of values which occur more than about 800,000 times (i.e. IN (7, 1) = 780741 + 555407 = 1336148) then I get performance issues.
    I'm finding it very difficult to accept that the old pipe delimited fields are a better solution (ignoring everything other than this search criteria!).
    Thank you for reading this far. I truly look forward to suggestions on how to improve the performance of this statement.
    Edited by: user1950227 on Oct 1, 2012 12:06 PM
    Renamed link table in DDL.

    Possibly not, I followed the instructions as best as I could but may have missed things.
    h5. 1. DDL for all tables and indexes?
    h6. - TABLE_A_B is described above and has a total of 2,304,642 rows. TABLE_A and TABLE_B are described below.
    h5. 2. row counts for all tables?
    h6. - See below
    h5. 3. row counts for the predicates involved?
    h6. - Not sure what your asking for, I have a summary of data in TABLE_A_B above. Could you clarify please?
    h5. 4. Method and command used to collect stats on the tables and indexes?
    h6. - For the stats I collected above I have included the command used to collect the data. If you are asking for further data I am happy to provide it but need more information. Thanks.
    TABLE_A has 2,267,980 rows. The DLL that follows has been abbriviated, only the column involved is described.
    --  DDL for Table TABLE_A
      CREATE TABLE "NS"."TABLE_A"
       (     "ID" NUMBER
         --Lots more columns
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CUSTOMNAMESPACE" ;
    --  DDL for Index ID_PK
      CREATE UNIQUE INDEX "NS"."MI_PK" ON "NS"."TABLE_A" ("ID")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 16384 NEXT 29458432 MINEXTENTS 1 MAXEXTENTS 505
      PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "SYSTEM" ;
    --  Constraints for Table TABLE_A
      ALTER TABLE "NS"."TABLE_A" ADD CONSTRAINT "MI_PK" PRIMARY KEY ("ID")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 16384 NEXT 29458432 MINEXTENTS 1 MAXEXTENTS 505
      PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "SYSTEM"  ENABLE;
      ALTER TABLE "NS"."TABLE_A" MODIFY ("ID" NOT NULL ENABLE);TABLE_B has 22 rows. The DLL that follows has been abbriviated, only the column involved is described.
    --  DDL for Table TABLE_B
      CREATE TABLE "NS"."TABLE_B"
         "ID" NUMBER
      --Lots more columns
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CUSTOMNAMESPACE" ;
    --  DDL for Index CID_PK
      CREATE UNIQUE INDEX "NS"."CID_PK" ON "NS"."TABLE_B" ("ID")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505
      PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "SYSTEM" ;
    --  Constraints for Table TABLE_B
      ALTER TABLE "NS"."TABLE_B" ADD CONSTRAINT "CID_PK" PRIMARY KEY ("ID")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505
      PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "SYSTEM"  ENABLE;
      ALTER TABLE "NS"."TABLE_B" MODIFY ("ID" NOT NULL ENABLE);Edited by: davebcast on Oct 1, 2012 8:51 PM
    Index name incorrect
    Edited by: davebcast on Oct 1, 2012 8:52 PM

  • 0ORGUNIT hierarchy version assignment problem using BI7 Query Designer

    Dear All,
    I have a problem with Hierarchy Version for 0orgunit using BI7.0 Query Designer.
    for activating heirarchy i have selected the hierarchy in  the query designer but version it is not showing , instead of 01 it is showing as #.
    what may be the problem with BI7.0 Query designer.
    If I use BW3.5 query desingner there version in showing and I can able to show the heirarchy.
    We are using BI7.0 and SP level is 13.
    Best Regards,
    SGK

    Dear SGK,
    did you get this problem solved ?
    I have the same problem.
    Regards,
    Gerhard

  • Create table problem using Dynamic Query

    Hi all,
    I want to create a temporary table within a stored procedure so I decided to do it using a dynamic query:
    create or replace procedure p1
    as
    begin
    execute immediate 'CREATE GLOBAL TEMPORARY TABLE tt(id number(2))';
    end;
    / It created successfuly but when I execute that procedure I got:SQL> exec p1;
    BEGIN p1; END;
    ERROR at line 1:
    ORA-01031: insufficient privileges
    ORA-06512: at "SCOTT.P1", line 4
    ORA-06512: at line 1 While I can create that table using the same user without any problem!
    My question is:What privilege should I grant to user(minimum of privileges please! ) to execute that procedure successfuly?
    -Thanks

    Hi,
    To say a little bit more about Nicolas' answer:
    SQL> grant create table to scott;
    This is the right answer, but you might wonder why you have to do so if you usually can create tables with this user..
    11:59:19 TEST.SQL>CREATE USER UTEST
    11:59:28   2  IDENTIFIED BY UTEST;
    User created.
    11:59:35 TEST.SQL>CREATE ROLE RTEST;
    Role created.
    11:59:40 TEST.SQL>GRANT RTEST TO UTEST;
    Grant succeeded.
    11:59:45 TEST.SQL>GRANT CREATE SESSION TO RTEST;
    Grant succeeded.
    11:59:54 TEST.SQL>GRANT CREATE TABLE TO RTEST;
    Grant succeeded.
    12:00:03 TEST.SQL>GRANT UNLIMITED TABLESPACE TO UTEST;
    Grant succeeded.
    12:00:17 TEST.SQL>CREATE PROCEDURE UTEST.CT_TEST
    12:00:32   2  IS
    12:00:33   3  BEGIN
    12:00:35   4  EXECUTE IMMEDIATE 'CREATE TABLE UTEST.TTEST (A NUMBER)';
    12:00:56   5  END;
    12:00:58   6  /
    Procedure created.
    12:00:59 TEST.SQL>EXEC UTEST.CT_TEST;
    BEGIN UTEST.CT_TEST; END;
    ERROR at line 1:
    ORA-01031: insufficient privileges
    ORA-06512: at "UTEST.CT_TEST", line 4
    ORA-06512: at line 1
    12:01:06 TEST.SQL>GRANT CREATE TABLE TO UTEST;
    Grant succeeded.
    12:01:15 TEST.SQL>EXEC UTEST.CT_TEST;
    PL/SQL procedure successfully completed.Don't forget that when you're using PL/SQL, privileges granted via roles are ignored!
    Regards,
    Yoann.

Maybe you are looking for

  • Anyone have trouble w/ iTunes 6.0.3 not seeing music in library?

    Just got a new computer. Have an external hard drive with all my music. Copied all of the music to the iTunes folder in MyMusic onto new computer, and still have a copy on the same external hard drive. Edit-Preferences-Advanced-General lets you point

  • How to Split the Page in Numbers

    I took a quick test drive on Numbers and stopped when I could not find the the little tab in the upper right corner of an Excel worksheet that lets you spilt the page for ease of working a page. Help..... how do you split the page for ease of working

  • Error while importing samples

    Hi, I'm new to oracle bpel process manager 10.1.3.1.0 I have problem in importing a sample demos. Steps I followed: -Start JDeveloper -(with or without first creating a BPEL process project) File > Import > BPEL Process (browse to the .bpel file, cli

  • Vendormaster data changes not updated in MM scheduling agreement

    Hi, Can anbody tell me how to update the vendor master data changes for the exsting purchasing documents.

  • Apple 24" HD Display - Doesn't display smooth gradations

    i have just noticed a very serious issue with my display. i use photoshop for retouching. i have been using shadows and gradations for the past 3 days and there is a serious problem with banding. serious banding when creating gradations. more serious