Distributed Query in-parallel?

I tried to execute distributed query on three database machines. I hope it would be executed in-parallel. Unfortunately, I found I used 3 times of execution time with distirbuted query compare to search in only one node. Obviously, the query statement was processed one by one. (Data was distributed in three nodes averagely)
Here is the example.
select * from nemo.seven_dis_table
union
select * from [email protected] where rownum<=1000
union
select * from [email protected] where rownum<=1000
With the docuemnt http://www.dba-oracle.com/t_opq_parallel_query.htm, this sql would be executed on two remote site in-parallel. My question is, why can not be executed in-parallel in my case? Is it really parallelism query?

I'm by no means an expert in distributed queries, but having read through the document you linked and looking at your query, I think you're misunderstanding either distributed processing or the union statement.
At the moment, all you're doing is getting data from three sources and then mashing it together with a costly union statement.
If you put in UNION ALL instead, it would give you a better idea of how fast it retrieves data because it won't bother sorting and removing duplicated records.
The idea behind distributed processing is that you can query a very large table on ONE database using multiple processors, not multiple databases on different servers....

Similar Messages

  • Avoid Distributed query in PL/SQL cursor code

    Hi,
    I have to avoid a distributed qry in my cursor code in PL/SQL.
    The query follows like this,
    cursor c1
    is
    select a.test,b.test1,a.test2
    from apple a,
    [email protected] b,
    bat c
    where a.listid = b.listid
    and a.list_name = c.list_name;
    Now i need to split the above cursor into two .
    (1)I need to query appl and bat which is from local database into one and
    (2)Have to do something for the value from [email protected] is stored in a temp. table or PL/SQL table.So that ,i can use the PL/SQL table or temp table in my join in cursor ,instead of having a distributed query.
    By doing so,will the performance hit badly ?
    [Note: Imagine this scenario is taking place in Oracle 11i Apps]
    Regards,
    Prasanna Natarajan,
    Oracle ERP Tech Team.

    [url http://groups.google.de/group/comp.databases.oracle.server/browse_frm/thread/df893cf9be9b2451/54f9cf0e937d7158?hl=de&tvc=1&q=%22Beautified%22+code+runs+slower#54f9cf0e937d7158]Recently somebody complained about slow performance after code was beatified in PL SQL Developer, after recompilation without flag "Add Debug Information" it run faster...
    (just a guess)
    Best regards
    Maxim

  • 9i Query Execution (Parallel vs Serial)

    I have a table (test) containing 1000000 (10 lac) records.
    1) I issued the Query with parallel option "SELECT /*+ parallel (test,4) */count(*) FROM test". The query will use 4 parallel servers to execute.
    2) After this i executed the Query without parallel option "SELECT /*+ parallel count(*) FROM test".
    The execution time of both the queries is same. Why the parallel option is not executing the query will shorter time as compared to serial execution?
    Thanks in Advance,
    Shafiq

    Hi,
    To optimize parrallel query, the number of CPUs is very important. How have you CPU ? If not least 4 CPUs, it's not very recommend.
    Have you make explain plan ?
    explain plan for ....
    and
    @$ORACLE_HOME/rdbms/admin/utlxplp (for parallel query)
    @$ORACLE_HOME/rdbms/admin/utlxpls (for serial quey)
    Is your table partionned ?
    Please post explain.
    Btw, I don't think that for a count(*) parallel query improve performance...
    Nicolas.

  • Distributed Query Overhead

    Hi All,
    I have a distributed deployment of two oracle instances where database A keeps a replication of a schema from database B.
    I have A and B linked together, B sees A as a remote database, and my application sends queries to database B.
    Let's say I have the following two queries:
    The following is issued to B:
    select * from magic.accountejb@A a where a.profile_userid = ( select userid from magic.accountprofileejb@A ap where ap.userid = 'uid:174')
    and the following issued directly to A (which is basically the same query as above):
    select * from accountejb a where a.profile_userid = ( select userid from accountprofileejb ap where ap.userid = 'uid:174')
    when I measure the time through my Java application, the second query executes more than 3 times faster than the first query (23ms on A compared to 80ms on B). However, when I use the sqlplus client on B to issue the exact same query, the execution time reported by sqlplus is almost identical to the second one(20ms).
    When I monitor the execution plan through *@UTLXPLAN*, it seems like the query sent to B is also fully executed remotely and on A. with a network latency of 11ms between A and B, I am not sure why I see such a long delay for the first query. Also playing with DRIVING_SITE did not have any perceived effect on improving performance.
    I wonder if anybody has any explanation for the difference I see? is a distributed query really 3 times slower than a regular query even though both are pretty much handled by the same database engine? or is it so that I need some other sort of tuning?
    Any thoughts or advice on how I can achieve comparable performance is highly appreciated.
    thanks!
    Edited by: 944957 on 16-Nov-2012 20:25
    Edited by: 944957 on 16-Nov-2012 20:29

    Thanks a lot for the quick response:
    rp0428 wrote:
    1. the 4 digit Oracle version (or other DB version)
    2. the JDK version
    3. the JDBC jar name and versionI am using ojdbc14 with Oracle 11g XE and JDK 7.
    4. the code you are using that shows an issue or problem.The queries I am using is basically the two queries I provided earlier, and here is the exact Java code. I loop over the code below 20 times and discard the first two retrieved results for each query and calculate an average on the remaining 18 results collected.
    static Connection c1 = null, c2 = null;
    static Statement _session;
    public void getStats(){
    long start;
    for (int i = 0; i < 20; i++) {
    c1 = (c1 != null) ? c1 :
         DriverManager.getConnection("jdbc:oracle:thin:@//" + System.getProperty("host.1")+"/XE", "magic", "magic");
    _session = c1.createStatement();
    session.executeUpdate("ALTER SESSION SET CURRENTSCHEMA=magic");          
    start = System.currentTimeMillis();
    _session.executeUpdate(query);
    values[0] = System.currentTimeMillis() - start;     
    _session.close();
    c2 = (c2 != null) ? c2 :
         DriverManager.getConnection("jdbc:oracle:thin:@//" + System.getProperty("host.2")+"/XE", "magic", "magic");
    _session = c2.createStatement();
    _session.executeUpdate("ALTER SESSION SET CURRENT_SCHEMA=magic");          
    start = System.currentTimeMillis();
    _session.executeUpdate(distQuery);          
    values[1] = System.currentTimeMillis() - start;     
    _session.close();
    } // end for loop     
    } // end method
    5. for performance related issues - the data volume being queried or processedThe data volume is rather small. I measure the data and it is roughly about 10K of data transfer.
    >
    Without seeing the code to see how you are measuring the timing it is hard to comment on what you posted.
    3. How was the timing computed in sql*plus?for sqlplus, I issue *set timing on* prior to executing the queries.
    4. Were the connections already created before the timing started? Or is the creation of the connection part of the timing result?As you see in the code, the connection is only created the first time I issue a query, and I discard the results of the first two queries using the connection as the timing is far off specially for the first query. I think the first query also download some metadata information that I don't consider in calculating the performance.
    5. Do the timings include the retrieval of ALL result set data? Or just the first set of results?the time only consists of executing the first set.
    Can you post the explain plans for the java and the sql*plus executions?Here is the results of the explain plan
    PLAN_TABLE_OUTPUT
    Plan hash value: 3819315806
    | Id | Operation          | Name          | Rows | Bytes | Cos
    t (%CPU)| Time     | Inst |
    PLAN_TABLE_OUTPUT
    | 0 | SELECT STATEMENT REMOTE |               |     1 |     43 |
    2 (0)| 00:00:01 |     |
    | 1 | TABLE ACCESS BY INDEX ROWID| ACCOUNTEJB     |     1 |     43 |
    2 (0)| 00:00:01 | CORONA |
    |* 2 | INDEX RANGE SCAN     | ACCOUNT_USERID     |     1 |     |
    1 (0)| 00:00:01 | CORONA |
    |* 3 | INDEX UNIQUE SCAN     | PK_ACCOUNTPROFILEEJB |     1 |     9 |
    0 (0)| 00:00:01 | CORONA |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
    2 - access("A1"."PROFILE_USERID"= (SELECT "A2"."USERID" FROM "MAGIC"."A
    CCOUNTPROFILEEJB"
    PLAN_TABLE_OUTPUT
         "A2" WHERE "A2"."USERID"='uid:174'))
    3 - access("A2"."USERID"='uid:174')
    Note
    - fully remote statement
    Edited by: 944957 on 16-Nov-2012 20:51
    Edited by: 944957 on 16-Nov-2012 20:53
    Edited by: 944957 on 16-Nov-2012 20:55
    Edited by: 944957 on 16-Nov-2012 20:56
    Edited by: 944957 on 16-Nov-2012 20:57
    Edited by: 944957 on 16-Nov-2012 20:59

  • Distributed query using local BackingMap

    I'm trying to create a distributed query (deriving a task from AbstractInvocable). I want each cluster node to query only it's local storage, aggregate a result and then return that single result to the invoker of the Task.
         To do this I'm using the BackingMap for a NamedCache and running the query on this. My question is, since this is a Map, how can I run the query using Filter objects?
         On the NamedCache (i.e. the entire cache) I can query with a Filter, but to achieve the same thing with a local BackingMap I have to iterate through the entire Map. What am I missing?!
         Many Thanks,
         Jools

    Thanks Cameron.
         We can query the NamedCache using Filters - that's fine.
         What I'm trying to achieve though, is to use distributed tasks running on each node. The reason is that we're planning on using a widely-Distributed cache with nodes in both the US and the UK, and as such we're trying to minimise bandwidth usage by having the distributed task perform some aggregation on the local node and return only the result.
         However, if we can only get a Map interface on the local node, and therefore cannot use Filters (or indexes for that matter) and can only iterate through the contents of the Map looking for properties that match our criteria, then it may end up being too inefficient to do it this way.
         Are there no config settings than govern what type of object gets returned as the backing map on the local node?
         Thanks,
         Jools

  • Distributed query for license key

    Hello,
    I have a distributed query that I'm hoping is retrieving the license key information below:
    USE master
    GO
    create table #version
    version_desc varchar(2000)
    insert #version
    select @@version
    if exists
    select 1
    from #version
    where version_desc like '%2005%'
    Begin
    DECLARE @Registry_Value_2005 VARCHAR(1000)
    EXEC xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup','ProductCode',@Registry_Value_2005 OUTPUT --2005
    SELECT @@version as 'version',@Registry_Value_2005 as 'license_key'
    End
    else if exists
    select 1
    from #version
    where version_desc like '%express%'
    Begin
    DECLARE @Registry_Value_2008_express VARCHAR(1000)
    EXEC xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\Setup','ProductCode',@Registry_Value_2008_express OUTPUT -- 2008 express
    SELECT @@version as 'version',@Registry_Value_2008_express as 'license_key'
    End
    else if exists
    select 1
    from #version
    where version_desc like '%R2%'
    Begin
    DECLARE @Registry_Value_2008_R2 VARCHAR(1000)
    EXEC xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\Setup','ProductCode',@Registry_Value_2008_R2 OUTPUT -- 2008 R2
    SELECT @@version as 'version',@Registry_Value_2008_R2 as 'license_key'
    End
    else if exists
    select 1
    from #version
    where version_desc like '%2008%'
    Begin
    DECLARE @Registry_Value_2008 VARCHAR(1000)
    EXEC xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.MSSQLSERVER\Setup','ProductCode',@Registry_Value_2008 OUTPUT -- 2008
    SELECT @@version as 'version',@Registry_Value_2008 as 'license_key'
    End
    else if exists
    select 1
    from #version
    where version_desc like '%2012%'
    Begin
    DECLARE @Registry_Value_2012 VARCHAR(1000)
    EXEC xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\Setup','ProductCode',@Registry_Value_2012 OUTPUT -- 2012
    SELECT @@version as 'version',@Registry_Value_2012 as 'license_key'
    End
    else
    Begin
    select 'version not recognized'
    End
    drop table #version
    I'm noticing the 'key' is coming back the same across our 2012 instances and I'm pretty sure this isn't right. Am I retrieving the right value from the registry? I want to get the actual key that is installed when SQL is installed. Please help also feel
    free to borrow this code if you like.
    Thanks!
    phil

    Hi phil,
    The following query will return the serial number in binary format, you can convert this binary value to product key as other post. For more details, please review this similar
    blog.
    use master
    GO
    exec xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Microsoft SQL Server\110\Tools\Setup','DigitalProductID'
    GO
    Regarding to the product code, SQL Server consists of different products registered in the Registry. Each product has a product code (a GUID) as well as an installation package code (also a GUID). For more details, please review this similar
    thread.
    Additionally, for license issues, please call
    1-800-426-9400,
    Monday through Friday, 6:00 A.M. to 6:00 P.M. (Pacific Time) to speak directly to a Microsoft licensing specialist. For international customers, please use the Guide to Worldwide Microsoft Licensing Sites to find contact information in your locations.
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • SQL query with parallel hint  running very slow

    I have a SQL query which joins three huge tables. (given below)
         insert /*+ append */ into final_table (oid, rmeth, id, expdt, crddt, coupon, bitfields, processed_count)
         select /*+ full(t2) parallel(t2,31) full(t3) parallel(t3,31)*/
         seq_final_table.nextval, '200', t2.id, t3.end_date, '1/jul/2009',123,t2.bitfield, 0
         from table1 t1, table2 t2, table3 t3 where
         t1.id=t2.id and
         t2.pid=t3.pid and
         t2.vid=t3.vid and
         t3.end_date is not null and
         (trunc(t1.expiry_date) != trunc(t3.end_date) or trim(t1.expiry_date) is null);
         Below are some statistics of the three tables.
         Table_Name          RowCount    Size(MB)
         table1 36469938 532
         table2 242172205     39184
         table3 231756758     29814
         The above query ran for 30+ hours, and returned with no rows inserted into final_table. I didn't get any error message also.
         But when I ran the query with table1 containing just 10000 records, the query completed succesfully within 20 minutes.
         Can any one please optimize the above query?
    Edited by: jaysara on Aug 18, 2009 11:51 PM

    As a side note: You probably don't want to insert a string into a date field, won't you?
    Under the assumption that crddt is of datatype date:
    crddt='1/jul/2009' needs to be changed into
    crddt= to_date('01/07/2009','dd/mm/yyyy') This is data type correct and nls independent.

  • Distribute Query.

    is there any query to distribute a name in three column like below
    select emp_name from employee;
    EMP_NAME
    Alistair Cook Steve
    select first_name,second_name,last_name from new_employee;
    FIRST_NAME SECOND_NAME LAST_NAME
    ALISTAIR COOK STEEVE
    anyone help me how can i do this ?

    Something as
    with data as
    select '1 AVENUE OF THE AMERICAS' as ADDRESS from dual union all
    select '2 NORTH CAROLINE STREET EAST' as ADDRESS from dual union all
    select '236 TURPENTINE ROAD COOPER CREEK' as ADDRESS from dual
    select
      substr( address, 1, instr( address, ' ' ) - 1 ) as p_1 ,
      substr( address, instr( address, ' ', - 1 ) + 1 ) as p_2 ,
      substr
      ( address,
        instr( address, ' ', + 1 ) + 1,
        instr( address, ' ', - 1 ) - instr( address, ' ' ) - 1
      ) as p_3
    from
      data
    P_1 P_2        P_3
    1   AMERICAS   AVENUE OF THE
    2   EAST       NORTH CAROLINE STREET
    236 CREEK      TURPENTINE ROAD COOPER

  • How to run query in parallel  to improve performance

    I am using ALDSP2.5, My data tables are split to 12 ways, based on hash of a particular column name. I have a query to get a piece of data I am looking for. However, this data is split across the 12 tables. So, even though my query is the same, I need to run it on 12 tables instead of 1. I want to run all 12 queries in parallel instead of one by one, collapse the datasets returned and return it back to the caller. How can I do this in ALDSP ?
    To be specific, I will call below operation to get data:
    declare function ds:SOA_1MIN_POOL_METRIC() as element(tgt:SOA_1MIN_POOL_METRIC_00)*
    src0:SOA_1MIN_POOL_METRIC(),
    src1:SOA_1MIN_POOL_METRIC(),
    src2:SOA_1MIN_POOL_METRIC(),
    src3:SOA_1MIN_POOL_METRIC(),
    src4:SOA_1MIN_POOL_METRIC(),
    src5:SOA_1MIN_POOL_METRIC(),
    src6:SOA_1MIN_POOL_METRIC(),
    src7:SOA_1MIN_POOL_METRIC(),
    src8:SOA_1MIN_POOL_METRIC(),
    src9:SOA_1MIN_POOL_METRIC(),
    src10:SOA_1MIN_POOL_METRIC(),
    src11:SOA_1MIN_POOL_METRIC()
    This method acts as a proxy, it aggregates data from 12 data tables
    src0:SOA_1MIN_POOL_METRIC() get data from SOA_1MIN_POOL_METRIC_00 table
    src1:SOA_1MIN_POOL_METRIC() get data from SOA_1MIN_POOL_METRIC_01 table and so on.
    The data source of each table is different (src0, src1 etc), how can I run these queries in parallel to improve performance?

    Thanks Mike.
    The async function works, from the log, I could see the queries are executed in parallel.
    but the behavior is confused, with same input, sometimes it gives me right result, some times(especially when there are few other applications running in the machine) it throws below exception:
    java.lang.IllegalStateException
         at weblogic.xml.query.iterators.BasicMaterializedTokenStream.deRegister(BasicMaterializedTokenStream.java:256)
         at weblogic.xml.query.iterators.BasicMaterializedTokenStream$MatStreamIterator.close(BasicMaterializedTokenStream.java:436)
         at weblogic.xml.query.runtime.core.RTVariable.close(RTVariable.java:54)
         at weblogic.xml.query.runtime.core.RTVariableSync.close(RTVariableSync.java:74)
         at weblogic.xml.query.iterators.FirstOrderIterator.close(FirstOrderIterator.java:173)
         at weblogic.xml.query.iterators.FirstOrderIterator.close(FirstOrderIterator.java:173)
         at weblogic.xml.query.iterators.FirstOrderIterator.close(FirstOrderIterator.java:173)
         at weblogic.xml.query.iterators.FirstOrderIterator.close(FirstOrderIterator.java:173)
         at weblogic.xml.query.runtime.core.IfThenElse.close(IfThenElse.java:99)
         at weblogic.xml.query.runtime.core.CountMapIterator.close(CountMapIterator.java:222)
         at weblogic.xml.query.runtime.core.LetIterator.close(LetIterator.java:140)
         at weblogic.xml.query.runtime.constructor.SuperElementConstructor.prepClose(SuperElementConstructor.java:183)
         at weblogic.xml.query.runtime.constructor.PartMatElemConstructor.close(PartMatElemConstructor.java:251)
         at weblogic.xml.query.runtime.querycide.QueryAssassin.close(QueryAssassin.java:65)
         at weblogic.xml.query.iterators.FirstOrderIterator.close(FirstOrderIterator.java:173)
         at weblogic.xml.query.runtime.core.QueryIterator.close(QueryIterator.java:146)
         at com.bea.ld.server.QueryInvocation.getResult(QueryInvocation.java:462)
         at com.bea.ld.EJBRequestHandler.executeFunction(EJBRequestHandler.java:346)
         at com.bea.ld.ServerBean.executeFunction(ServerBean.java:108)
         at com.bea.ld.Server_ydm4ie_EOImpl.executeFunction(Server_ydm4ie_EOImpl.java:262)
         at com.bea.dsp.dsmediator.client.XmlDataServiceBase.invokeFunction(XmlDataServiceBase.java:312)
         at com.bea.dsp.dsmediator.client.XmlDataServiceBase.invoke(XmlDataServiceBase.java:231)
         at com.ebay.rds.dao.SOAMetricDAO.getMetricAggNumber(SOAMetricDAO.java:502)
         at com.ebay.rds.impl.NexusImpl.getMetricAggNumber(NexusImpl.java:199)
         at com.ebay.rds.impl.NexusImpl.getMetricAggNumber(NexusImpl.java:174)
         at RDSWS.getMetricAggNumber(RDSWS.jws:240)
         at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
         at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
         at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:371)
    below is my code example, first I get data from all the 12 queries, each query is enclosed with fn-bea:async function, finally, I do a group by aggregation based on the whole data set, is it possible that the exception is due to some threads are not returned data yet, but the aggregation has started?
    the metircName, serviceName, opname, and $soaDbRequest are simply passed from operation parameters.
    let $METRIC_RESULT :=
            fn-bea:async(
                for $SOA_METRIC in ns20:getMetrics($metricName,$serviceName,$opName,"")
                for $SOA_POOL_METRIC in src0:SOA_1MIN_POOL_METRIC()
                where
                $SOA_POOL_METRIC/SOA_METRIC_ID eq fn-bea:fence($SOA_METRIC/SOA_METRIC_ID)
                and $SOA_POOL_METRIC/CAL_CUBE_ID  ge fn-bea:fence($soaDbRequest/ns16:StartTime)  
                and $SOA_POOL_METRIC/CAL_CUBE_ID lt fn-bea:fence($soaDbRequest/ns16:EndTime )
                and ( $SOA_POOL_METRIC/SOA_SERVICE_ID eq fn-bea:fence($soaDbRequest/ns16:ServiceID)
                   or (0 eq fn-bea:fence($soaDbRequest/ns16:ServiceID)))
                and ( $SOA_POOL_METRIC/POOL_ID eq fn-bea:fence($soaDbRequest/ns16:PoolID)
                   or (0 eq fn-bea:fence($soaDbRequest/ns16:PoolID)))
                and ( $SOA_POOL_METRIC/SOA_USE_CASE_ID eq fn-bea:fence($soaDbRequest/ns16:UseCaseID)
                   or (0 eq fn-bea:fence($soaDbRequest/ns16:UseCaseID)))
                and ( $SOA_POOL_METRIC/ROLE_TYPE eq fn-bea:fence($soaDbRequest/ns16:RoleID)
                   or (-1 eq fn-bea:fence($soaDbRequest/ns16:RoleID)))
                return
                $SOA_POOL_METRIC
               fn-bea:async(for $SOA_METRIC in ns20:getMetrics($metricName,$serviceName,$opName,"")
                for $SOA_POOL_METRIC in src1:SOA_1MIN_POOL_METRIC()
                where
                $SOA_POOL_METRIC/SOA_METRIC_ID eq fn-bea:fence($SOA_METRIC/SOA_METRIC_ID)
                and $SOA_POOL_METRIC/CAL_CUBE_ID  ge fn-bea:fence($soaDbRequest/ns16:StartTime)  
                and $SOA_POOL_METRIC/CAL_CUBE_ID lt fn-bea:fence($soaDbRequest/ns16:EndTime )
                and ( $SOA_POOL_METRIC/SOA_SERVICE_ID eq fn-bea:fence($soaDbRequest/ns16:ServiceID)
                   or (0 eq fn-bea:fence($soaDbRequest/ns16:ServiceID)))
                and ( $SOA_POOL_METRIC/POOL_ID eq fn-bea:fence($soaDbRequest/ns16:PoolID)
                   or (0 eq fn-bea:fence($soaDbRequest/ns16:PoolID)))
                and ( $SOA_POOL_METRIC/SOA_USE_CASE_ID eq fn-bea:fence($soaDbRequest/ns16:UseCaseID)
                   or (0 eq fn-bea:fence($soaDbRequest/ns16:UseCaseID)))
                and ( $SOA_POOL_METRIC/ROLE_TYPE eq fn-bea:fence($soaDbRequest/ns16:RoleID)
                   or (-1 eq fn-bea:fence($soaDbRequest/ns16:RoleID)))
                return
                $SOA_POOL_METRIC
             ... //12 similar queries
            for $Metric_data in $METRIC_RESULT    
            group $Metric_data as $Metric_data_Group        
            by   $Metric_data/ROLE_TYPE as $role_type_id  
            return
            <ns0:RawMetric>
                <ns0:endTime?></ns0:endTime>
                <ns0:target?>{$role_type_id}</ns0:target>
    <ns0:value0>{fn:sum($Metric_data_Group/METRIC_COMPONENT_VALUE0)}</ns0:value0>
    <ns0:value1>{fn:sum($Metric_data_Group/METRIC_COMPONENT_VALUE1)}</ns0:value1>
    <ns0:value2>{fn:sum($Metric_data_Group/METRIC_COMPONENT_VALUE2)}</ns0:value2>
    <ns0:value3>{fn:sum($Metric_data_Group/METRIC_COMPONENT_VALUE3)}</ns0:value3>
    </ns0:RawMetric>
    could you tell me why the result is unstable? thanks!

  • Query regarding parallel

    Hi,
    let's assume 8 CPU machine is there and oracle 10.2.0.4.
    query No. 1-then how many parallel_max_servers we can define at oracle level.
    query No. 2: i defined parallel_max_servers=8 , now if i give in query parallel=10 so how oracle will work?
    thanks in advance.

    To take a stab at ansering your questions:
    1 - Based on the information given there is no way to accurately answer this question because you need to consider more than just the number of cpu are available on the server to determine how many PQO servers you want. Such as how many disks is the database spread across, how is the PQO option going to be invoked: Oracle managed, via SQL hints, defined at the table level, and how many concurrent sessions are going to be on the system. How many of thses sessions will run parallel.?
    Remember that the PQO is a brute force tuning method intended by Oracle to be used in Warehouse environments. A query that runs PQO gets more resouces than a non-PQO run and if you flood your system with PQO queries you can bring it to a halt. You can use it in an OLTP to good effect if you are careful and do not overuse the feature. In a warehouse you would expect the total number of concurrent sessions to be low relative to an OLTP environment but many environments are mixed as to contents and usage so you have to be careful.
    2 - Obviously Oracle cannot assign more resources than it has to the query task. In fact if another session is already using the PQO resources Oracle will run the query normally without PQO.
    HTH -- Mark D Powell --

  • Why cannot query in parallel

    I have a fact table. Monthly range partition on evnt_dtm (date column) and local bitmap on the same column.
    With the bitmap index, oracle would not run in parallel.
    But when i drop the index then only it runs parallel.
    SQL> select /*+ PARALLEL (ccd_fact_partition) */ count(1) from ccd_fact_partition
    2 where evnt_dtm between '10-JAN-2006' and '10-FEB-2006';
    COUNT(1)
    4603456
    Elapsed: 00:00:01.14
    Execution Plan
    Plan hash value: 481612001
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 1 | 9 | 1 (0)| 00:00:01 | | |
    | 1 | SORT AGGREGATE | | 1 | 9 | | | | |
    | 2 | PARTITION RANGE ITERATOR | | 2500 | 22500 | 1 (0)| 00:00:01 | 1 | 2 |
    | 3 | BITMAP CONVERSION COUNT | | 2500 | 22500 | 1 (0)| 00:00:01 | | |
    |* 4 | BITMAP INDEX RANGE SCAN| CCD_FACT_PARTITION_BM_IDX1 | | | | | 1 | 2 |
    SQL> drop index CCD_FACT_PARTITION_BM_IDX1;
    Index dropped.
    Elapsed: 00:00:01.52
    SQL> select /*+ PARALLEL (ccd_fact_partition) */ count(1) from ccd_fact_partition
    2 where evnt_dtm between '10-JAN-2006' and '10-FEB-2006';
    COUNT(1)
    4603456
    Elapsed: 00:00:31.63
    Execution Plan
    Plan hash value: 2393890688
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | TQ
    | 0 | SELECT STATEMENT | | 1 | 9 | 330K (98)| 01:06:02 | | | | |
    | 1 | SORT AGGREGATE | | 1 | 9 | | | | | | |
    | 2 | PX COORDINATOR | | | | | | | | | |
    | 3 | PX SEND QC (RANDOM) | :TQ10000 | 1 | 9 | | | | | Q1,00 | P->S |
    | 4 | SORT AGGREGATE | | 1 | 9 | | | | | Q1,00 | PCWP |
    | 5 | PX BLOCK ITERATOR | | 3718K| 31M| 330K (98)| 01:06:02 | 1 | 2 | Q1,00 | PCW
    |* 6 | TABLE ACCESS FULL| CCD_FACT_PARTITION | 3718K| 31M| 330K (98)| 01:06:02 | 1 | 2
    ----------------------------------------------------------------------------------------------------

    Hi,
    if i do alter session force parallel query then i get the parallel to run together with bitmap index.
    But i rather not use force parallel.
    SQL> select /*+ PARALLEL (ccd_fact_partition) */ count(1) from ccd_fact_partition
    2 where evnt_dtm between '01-JAN-2006' and '26-JUL-2006'
    3 ;
    COUNT(1)
    8487622
    Elapsed: 00:00:00.24
    Execution Plan
    Plan hash value: 3848420160
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop
    | 0 | SELECT STATEMENT | | 1 | 9 | 1 (0)| 00:00:01 | |
    | 1 | SORT AGGREGATE | | 1 | 9 | | | |
    | 2 | PX COORDINATOR | | | | | | |
    | 3 | PX SEND QC (RANDOM) | :TQ10000 | 1 | 9 | | | |
    | 4 | SORT AGGREGATE | | 1 | 9 | | | |
    | 5 | PX PARTITION RANGE ITERATOR| | 3795 | 34155 | 1 (0)| 00:00:01 | 1 | 7
    | 6 | BITMAP CONVERSION COUNT | | 3795 | 34155 | 1 (0)| 00:00:01 | |
    |* 7 | BITMAP INDEX RANGE SCAN | CCD_FACT_PARTITION_BM_IDX1 | | | | | 1
    Regards,

  • Distributed Query

    Hi
    Can anyone let me know whether oracle supports distributed queries.
    I want to write a single query which fetched data from different - different data sources and give me a consolidated output.
    something like
    select m.a, i.b, d.c, o.e from mssql m, informix i, db2 d, oracle o
    where m.a = i.b and i.b = d.c and d.c = o.e
    I heard that MSSQL Server is providing such functionality.

    Yes, oracle has supported distributed queries from non-oracle databases since oracle 7 using Transparent Gateways (licensed seperately). In oracle 8.1.6, they introduced Generic Connectivity, which allows us to connect to ODBC and Ole DB sources. This feature is provided at no additional cost.
    Takmeister

  • 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

  • Error In Distributed Query moving LOB

    The following error has occurred:
    ORA-22992: cannot use LOB locators selected from remote tables
    ORA-02063: preceding line from BMB5_ADM
    ORA-02063: preceding 2 lines from BMB18CU3
    Query:
    INSERT INTO IMAGE@BB18C3
    SELECT B.*
    FROM IMAGE@BB17CS B,INV@BB17CS I
    WHERE B.ref_no = I.ref_no AND B.ref_resets = I.ref_resets AND I.a_no = 70
    Is there a way around moving a LOB from one database to the next. I can not use Import/Export it has to be done as part of a query.
    Thanks,
    Gavin

    Gavin,
    Had same problem... see thread entitled "ORA 22992 -- silly" in the PL/SQL and SQL forum.
    Barbara lists a link that spells out two workarounds (only one that would work for BLOBs though).
    Thanks,
    Adam

  • Query for parallel process

    Hi,
    I want to find that on which table paralle process is enable .
    By which dictionary view I can find it?

    See if this helps
    SQL> create table t parallel
      2  as
      3  select level no
      4    from dual
      5  connect by level <= 10
      6  /
    Table created.
    SQL> create table t1
      2  as
      3  select level no
      4    from dual
      5  connect by level <= 10
      6  /
    Table created.
    SQL> select table_name, degree from user_tables where table_name in ('T','T1')
      2  /
    TABLE_NAME                     DEGREE
    T                                 DEFAULT
    T1                                      1
    SQL>Thanks,
    Karthick.

Maybe you are looking for