On Parallel Execution of SQL Queries

Hi All,
We have forced Parallel hint in a query and if its without any where clause it uses parallel hint but where as if we add few where clauses it goes through few indexes and does not show parallel hint in the explain plan. Is it because we need to make those indexes also parallel and run the query once more or am i missing something here.
But even i had tried making the index parallel enabled and checked it. Database Version 10.2.0.1.0 Enterprise Edition 64 Bit mounted on Linux.
PRO's Please help

ramarun wrote:
Hi All,
We have forced Parallel hint in a query and if its without any where clause it uses parallel hint but where as if we add few where clauses it goes through few indexes and does not show parallel hint in the explain plan. Is it because we need to make those indexes also parallel and run the query once more or am i missing something here.
But even i had tried making the index parallel enabled and checked it. Database Version 10.2.0.1.0 Enterprise Edition 64 Bit mounted on Linux.
PRO's Please helpPARALLEL can make some SQL slower.
if PARALLEL was always better, why does not Oracle enable it by default?

Similar Messages

  • Parallel Execution in SQL Job

    Hi Team,
    I am facing the below mentioned issue while running a job, and this is issue is not daily instead it occurs only some times, please suggest what could be done to solve this.
    "the query processor could not start the necessary thread resources for parallel query execution"
    Regards
    Naveen

    hi naveen
    you know thread resources has limitation, sql take these requests in queues
    and then handle it one by one
    so ,you have max  640  worker threads is enough to handle  654  requests for sql
    but ,when in a parallel plan ,Data are cut into multiple parts  then flow into multiple threads
    the  max thread number at this monment is 64 if you have enough processors and thread resources
    the threads your server has may be consumed by other queries at that monment led to out of thead resources
    in that parallel plan
    what i suggest is setting up the max dop option , it can minimize the situation of out of thead resources
    here is the additional blog on sqlserver CSS TEAM about the maxdop
    SQL Server MAX DOP Beyond 64 – Is That Possible?
    if you have any problem ,pls let me know
    thanks

  • Parallel Execution of  Sub Queries using WITH clause ?

    Hi ,
    For the below query is it that Oracle Optimizer executes "sum_data" and "avg_data" queries parallely ?
    WITH sum_data AS
    SELECT deptno, sum(sal) AS S FROM emp GROUP BY deptno ),
    avg_data AS
    SELECT deptno, avg(sal) AS A FROM emp GROUP BY deptno )
    SELECT sum_data.deptno, s, a, s / a FROM sum_data , avg_data
    WHERE sum_data.deptno = avg_data.deptno
    ORDER BY sum_data.deptno
    THANKS

    No, it doesn't.
    You can add the parallel hint to each query itsel to speed up the exuction of a given query. But the WITH clause has nothing to do with parallel, it only uses temp or memory to keep the data being processed and thus speeds up the performance.
    Edited by: DimaK on Feb 25, 2011 10:42 AM

  • Parallel execution of multiple scripts

    Hi All,
    I understand that by using parallel hint we can achieve parallel execution of the queries(insert/update/delete).
    For my today's question I would like know if Parallelism can be achieved for the following scenario.
    I have a script with an insert-select statement and multiple merge statements and few update statements all on the same table.
    I have to run this script 12 times on the same table, once for each month of the year.
    Currently we run for Jan (where record_date = '201001') commit it, and then run for Feb, and so on.
    Can all the 12 month be run in parallel. One way I can think of is create 12 different scripts and kick them of by opening 12 different SQL Plus sessions (all on the same table).
    Is there a better way of doing this ?
    Note: each month data will not effect the other other month data.
    Regards,
    Aj

    Creating 12 different scripts would be a sub-optimal solution, and a maintenance nightmare. Creating 1 parametrized script and call that 12 times with different parameters would be slightly better.
    Creating 1 stored procedure with parameters, and run that procedure in the scheduler 12 times would still be better, as everything runs at the server side only.
    Your description is deliberately vague, so the possibility of deadlock can not be excluded.
    Sybrand Bakker
    Senior Oracle DBA

  • Can DBA force queries to run in parallel without modifying sql's queries

    Hi,
    We have a latest SUN SPARC server and storage available with Oracle database 11.2.0.3.While running our application on this database we found that only 1 cpu is being utilized out of 16 physical CPU's.
    Even in our End of day / month process total time taken is same as it takes on old server. We are not getting any benefits of latest more efficient server.
    Can't we force sql queries to run in parallel and make a most of available resources,without changing sql scripts.
    We want to do something from DBA side,can not bear sql scripting.
    Please suggest.
    Rgds,
    Praveen

    Praveen Saxena wrote:
    Hi,
    We have a latest SUN SPARC server and storage available with Oracle database 11.2.0.3.While running our application on this database we found that only 1 cpu is being utilized out of 16 physical CPU's.
    Even in our End of day / month process total time taken is same as it takes on old server. We are not getting any benefits of latest more efficient server.
    Can't we force sql queries to run in parallel and make a most of available resources,without changing sql scripts.
    We want to do something from DBA side,can not bear sql scripting.
    Please suggest.
    Rgds,
    PraveenWhat is the subject of this forum?
    What does this question have to do with ASM?

  • Can we capture SQL Queries before execution?

    Hi Everyone,
    I would like to know that is there any way to capture SQL queries before execution?
    please advise.
    thanks
    kv

    Hi!
    You could capture the querys and use them as a payload for the "Database Engine Tuning Advisor".
    Maybe it gives you some indexes which raise the performance.
    But:
    I only would add indexes to user tables.
    Cheers,
    Roland
    PS.:
    Indexes which are created directly through SQL could be lost after a B1 Upgrade. So saving the creation-statements in a warm and secure place is recommended
    PPS.:
    ...and maybe such indexes are not supported by SAP...
    Edited by: Roland Toschek on Dec 1, 2008 6:23 PM

  • MAXDOP (parallelism on MS SQL)

    Hello guys,
    Colleagues from SQL Server team suggested we look into parallel processing for heavy SQL Server queries, using more than one CPU/worker thread to retrieve large amounts of data quickly.
    By default, and on SAPu2019s recommendation, parallelism is turned off on all systems, due to the overhead it causes on queries that would not benefit from it anyway.
    The parameter that controls this behavior in the SQL Server engine is called u2018maximum degree of parallelismu2019, or MAXDOP.
    Since SAP supports u201C%_HINTSu201D in their Open SQL implementation in ABAP, we can activate parallelism per query as needed. So I tried this hint on approximately 10-15 SQL statements in the system with a lot of data, but no significant change.
    Of course I know that DB-specific things like hints are not recommended by SAP, but stillu2026
    Just wanted to know if anyone had good experience of applying this MAXDOP hint and if yes u2013 on what kind of SELECTs it was? (like SELECT JOIN, SELECT GROUP BY, SELECT SUM( DISTINCT col ) etc)
    Thanks a lot,
    Vlad

    Hi Vlad,
    i tried it on ORACLE and it worked quite well. Usually
    for SELCTS that do multiblock I/O (or work with partitioned segments).
    Once you "specified" parallel execution with a hint in MSSQL
    (how) did you check that it is actually executed in parallel?
    I don't know such details about MSSQL but maybe you have
    activate parall processes on system level as well.
    Kind regards,
    Hermann

  • 11gR2 query parallel execution

    I need to retrieve info from a very big table many times with different where conditions and compared execution plan for the queries using composite index on (group_id, start,end).
    SELECT /*+ index(a idx_loc) */ a.id , a.group_id
    from location a
    where a.group_id=10
    and a.start>=30000
    and a.end<=60000;
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 578 | 25432 | 191K (1)| 00:38:14 | | |
    | 1 | PARTITION LIST SINGLE | | 578 | 25432 | 191K (1)| 00:38:14 | KEY | KEY |
    | 2 | PARTITION LIST SINGLE | | 578 | 25432 | 191K (1)| 00:38:14 | 6 | 6 |
    | 3 | TABLE ACCESS BY LOCAL INDEX ROWID| LOCATION | 578 | 25432 | 191K (1)| 00:38:14 | 6 | 6 |
    |* 4 | INDEX SKIP SCAN | IDX_LOC | 592 | | 190K (1)| 00:38:07 | 6 | 6 |
    SELECT /*+ parallel */ a.id , a.group_id
    from location a
    where a.group_id=10
    and a.start>=30000
    and a.end<=60000;
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT | | 578 | 25432 | 16333 (1)| 00:00:33 | | | | | |
    | 1 | PX COORDINATOR | | | | | | | | | | |
    | 2 | PX SEND QC (RANDOM)| :TQ10000 | 578 | 25432 | 16333 (1)| 00:00:33 | | | Q1,00 | P->S | QC (RAND) |
    | 3 | PX BLOCK ITERATOR | | 578 | 25432 | 16333 (1)| 00:00:33 | 6 | 6 | Q1,00 | PCWC | |
    |* 4 | TABLE ACCESS FULL| LOCATION | 578 | 25432 | 16333 (1)| 00:00:33 | 6 | 6 | Q1,00 | PCWP | |
    My questions are:
    1) The execution plan shows the query using parallel hint has much less cpu cost and time compared with the one with index hint. So it seems it is better to use the parallel execution. is there any downside to use parallel hint that I should consider?
    2) I can also modify the application to submit multiple queries (using index hint) in parallel (which opens multiple sessions). Is the parallel hint in the query superior to parallel queries in application?

    user7435395 wrote:
    I need to retrieve info from a very big table many times with different where conditions and compared execution plan for the queries using composite index on (group_id, start,end). BIG is a very qualitative term. So you need to be more specific. And when ever you ask for a SQL Tuning request please provide the following details mentioned in {thread:id=863295}
    SELECT /*+ index(a idx_loc) */ a.id , a.group_id
    from  location a
    where  a.group_id=10
    and a.start>;=30000
    and a.end;=60000;
    | Id  | Operation                           | Name                      | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                    |                           |   578 | 25432 |   191K  (1)| 00:38:14 |       |       |
    |   1 |  PARTITION LIST SINGLE              |                           |   578 | 25432 |   191K  (1)| 00:38:14 |   KEY |   KEY |
    |   2 |   PARTITION LIST SINGLE             |                           |   578 | 25432 |   191K  (1)| 00:38:14 |     6 |     6 |
    |   3 |    TABLE ACCESS BY LOCAL INDEX ROWID| LOCATION |   578 | 25432 |   191K  (1)| 00:38:14 |     6 |     6 |
    |*  4 |     INDEX SKIP SCAN                 | IDX_LOC           |   592 |       |   190K  (1)| 00:38:07 |     6 |     6 |
    --------------------------------------------------------------------------------------------------------------------------------- As you have forced oracle to use IDX_LOC. it is going for a [url http://docs.oracle.com/cd/B19306_01/server.102/b14211/optimops.htm#PFGRF10105]INDEX SKIP SCAN. And if the cardinality of the subindex column is low then oracle may be doing more work here. I think that is what exactly happening in your case. A simple full table scan could be more efficient.
    SELECT /*+ parallel */ a.id , a.group_id
    from  location a
    where  a.group_id=10
    and a.start>;=30000
    and a.end;=60000;
    | Id  | Operation            | Name                      | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT     |                           |   578 | 25432 | 16333   (1)| 00:00:33 |       |       |        |      |            |
    |   1 |  PX COORDINATOR      |                           |       |       |            |          |       |       |        |      |            |
    |   2 |   PX SEND QC (RANDOM)| :TQ10000                  |   578 | 25432 | 16333   (1)| 00:00:33 |       |       |  Q1,00 | P->S | QC (RAND)  |
    |   3 |    PX BLOCK ITERATOR |                           |   578 | 25432 | 16333   (1)| 00:00:33 |     6 |     6 |  Q1,00 | PCWC |            |
    |*  4 |     TABLE ACCESS FULL| LOCATION |   578 | 25432 | 16333   (1)| 00:00:33 |     6 |     6 |  Q1,00 | PCWP |            |
    ----------------------------------------------------------------------------------------------------------------------------------------------- Again PARALLEL query has its own down side. There is no free lunch. You need to spend more resource. And most of the time in a OLTP system with multi user access its not worthwhile.
    So the first thing i would suggest you is to remove all your hint and get an execution plan and post it. And read the above link provided an post all the necessary details.
    You need to be first clear about your problem.

  • Parallel execution of query

    Hi Everyone,
    I am using following version oracle version
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    "CORE 10.2.0.4.0 Production"
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    Parameter for parallel execution.
    Name        Type Value
    parallel_server      1 FALSE
    parallel_server_instances   3 1
    recovery_parallelism    3 0
    fast_start_parallel_rollback  2 LOW
    parallel_min_percent    3 0
    parallel_min_servers     3 4
    parallel_max_servers    3 10
    parallel_instance_group    2
    parallel_execution_message_size 3 2152
    parallel_adaptive_multi_user  1 TRUE
    parallel_threads_per_cpu   3 2
    parallel_automatic_tuning   1 FALSE
    If i execute two or more SQL with parallel hint, i realised that the SQL which is first executed is using the parallelism functionality and rest are sequentially.
    select /*+ parallel(a) */  max(sal)  from emp a;
    SELECT /*+ parallel(a) parallel(b) */ a.empno, b.deptno FROM emp a,  dept b
    WHERE a.deptno = b.deptno
    I have following queries.
    1. How can i find out how many Degree of parallalism is being used by SQL
    2. What needs to be done so that both SQL can be executed using parallel execution.
    3. How to find out how many 'Query server' are being used by SQL and how many left for another SQL
       to use 'Query server'
    Regards,
    Sandeep

    Did you already consult the documentation? "Rules for Parallelizing Queries":  Types of Parallelism
    And you can find several threads on AskTom, for example: Ask Tom &amp;quot;Number of CPUs and Degree of Parallelism&amp;quot;

  • Enabling parallellism in oracle sql

    Hi All,
    I have a question related to parallilism enabling statements .
    I have seen that before running a sql statement we may use
    alter session enable parallel DDL;
    alter session enable parallel query;
    alter session enable parallel DML;
    What exactly these statement mean ??
    If i mention parallel hints like below statement ..
    select /*+ parallel(a,8) */ count(1) from customer a;
    parallelism won't happen Until session is altered with above statement ??
    Is thr any depedency b/w above 'alter session' statement and parallel hint in query .
    Thanks

    By default parallel execution is enabled for DDL and query statements. Unless you had turn it off somewhere then you need to manually enable it subsequentially.
    Overview of Parallel Execution
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/manproc.htm#sthref688
    for example, I login to my DB without issue enable statement.
    %sqlplus test/test
    SQL*Plus: Release 10.1.0.2.0 - Production on Tue Sep 1 12:15:26 2009
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    TEST@etest> set autotrace on
    TEST@etest> select /*+ parallel(a,8) */ count(1) from test a
      2  /
      COUNT(1)
             4
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=0 Card=1)
       1    0   SORT (AGGREGATE)
       2    1     PX COORDINATOR
       3    2       PX SEND* (QC (RANDOM)) OF ':TQ10000'                   :Q1000
       4    3         SORT* (AGGREGATE)                                    :Q1000
       5    4           PX BLOCK* (ITERATOR) (Cost=0 Card=4)               :Q1000
       6    5             TABLE ACCESS* (FULL) OF 'TEST' (TABLE) (Cost=0 C :Q1000
              ard=4)
       3 PARALLEL_TO_SERIAL
       4 PARALLEL_COMBINED_WITH_PARENT
       5 PARALLEL_COMBINED_WITH_CHILD
       6 PARALLEL_COMBINED_WITH_PARENT

  • Parallel execution in a web template

    We have a web template with several queries. It is possible execute our queries with parallel execution?
    Thanks !!

    Hi Dani,
    currently all DP's are executed sequentially, because in general it would be possible that the dataproviders have influence on each other.
    i heard that sap is building a prototyp to allow parallelization in BEX web 7.0. But currently there is no release date known, May this will come with some enhancement package.
    You should consider the Functional enhancement schedule on http://service.sap.com/bi. If this feature will be released sometime, it will be listed there.
    best regards,
    Kai

  • Datasource for SQL Queries

    Hi,
    SQL Server best practices indicates the use of Windows Authentication instead of Mixed Mode.
    In this case, if you need to create reports that connect to the database,you need to add the users accessing the data source to the sql server security.
    For reports that show error logs and table contents do you create a specific domain account for SQL queries and then specify it on the data source?
    Thank you

    Hi Pedro,
    A report server uses credentials to connect to external data sources that provide content to reports or recipient information to a data-driven subscription. You can specify credentials that use Windows Authentication, database authentication, no authentication,
    or custom authentication. When sending a connection request over the network, the report server will either impersonate a user account or the unattended execution account. For more information about the security context under which a connection request is
    made, see
    Data Source Configuration and Network Connections further on in this topic.
    The network environment determines the kinds of connections you can support. By default, when you create an datasoource the credential is "Windows Authentication(Windows integrated security)", as you know, the user must has permission to the server
    and database.
    Each user must have a Windows account. It can be a local account (i.e., an account on the report server) or a trusted domain account. The account must be added as an allowed user to the report server either individually or as part of a group. Furthermore,
    the client application must support Windows integrated security.
    More details information please reference to below article:
    Understanding SQL Server Reporting Services Authentication
    Specify Credential and Connection Information for Report Data Sources
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Please sugges the link helpful for writing efficient sql queries

    Please suggest any good resource that is weblink which can help me in optimizing sql queries. especially while writing select statements improve the execution time of the sql query.
    Thanx in advance
    prasanth

    in general I found books from O'Reilly very helpful (not only for Oracle, but for Unix too).
    Moreover there is pretty good Oracle Documentation available.
    After all, it's not only about writing good queries, but also about setting up data-models, indexes, primary keys, etc.
    Look for a real slow computer, take a lot of data, then try writing your speedy queries. This is the school of hard knocks, on the long run it's the best training.

  • Parallel Execution  against Normal Execution

    Hi,
    Can someone explain why in this case Serial Execution is faster although enabling parallel dml at session level , What are the possibilities to improve speed of executoin for parallel execution as i need to populate for 139 stores data having around half a million rows for each store , i will have to run a cursor on the distinct value of store to achieve this , just to test i got the following Results , can anyoe guide where i am going Wrong?
    This is the Script
    set timing on
    insert into r8_win_store
    select * from win_store@rms8 where store=99;
    commit;
    alter session enable parallel dml;
    insert /*+ Parallel(t,8) */ into r8_win_store t
    select /*+ parallel(e,8)*/ * from win_store@rms8 e where e.store=99;
    commit;
    alter session disable parallel dml;
    OUtput
    SQL> @test1.sql
    299666 rows created.
    Elapsed: 00:03:48.12
    Commit complete.
    Elapsed: 00:00:00.01
    Session altered.
    Elapsed: 00:00:00.00
    299666 rows created.
    Elapsed: 00:08:02.81
    Commit complete.
    Elapsed: 00:00:01.31
    Session altered.
    Elapsed: 00:00:00.00

    Parallel processing in Oracle is intended to reduce I/O latency. When you tell the kernel to do an I/O, you need to wait for that call to complete - disk platters to spin, disk controller heads to move, etc.
    If you need to make a bunch of I/O calls after one another, you will spend up to 90% of the elapsed time waiting for that I/O to actually put the data into your buffer to process.
    Now imagine doing a million I/Os.. and 90% of the time spend waiting for I/O to complete. A big performance knock and a frustrating one - as you cannot make that actual I/O any faster. It is simply slow. The slowest operation you can do on the computer and you're doing a million of them.
    Parallel processing in Oracle addresses this problem. There can be sufficient I/O bandwidth to make a 100 I/O calls per second. But your process that does an I/O call, wait, process, and does an I/O call, wait, process, can only reach a speed of 10 I/O calls per second.
    Which means 90% of the I/O pipe is free to do I/O in parallel. So instead of a single process doing that million I/Os (using 10% I/O bandwidth/thruput), Oracle spawns 10 process each doing a 100K I/Os each - thus making better use of the I/O thruput.
    So Oracle PQ is useless if you scan small volumes of data - it is intended for large volumes of data. There are overheads in PQ as the parallel processes have to be coordinated in order to work together. When each only needs to do 10 I/Os, the time spend on coordination alone can be more than what the time would have been to simply do a 100 I/Os using a single process.
    It is also a fallacy that number of CPUs determine the just how many parallel processes you can start. The real determining factor is the load you can put on your I/O subsystem.
    Bottom line is that PQ is nothing "special" or "magic". It is simply a method to reduce I/O latency by performing parallel I/O. And it is only sensible to use when the amount of I/O to be done warrants parallel processing.
    Oh yeah - and the CBO is very capable in deciding when to use PQ and not. So rather than force PQ down the CBO's throat using the PARALLEL clause and hardcoding the degrees and instances, it should rather make those decisions (as informed decisions) itself. Which means using the PARALLEL clause on tables and not as SQL hints. The DBA can easily tune that by altering the PARALLEL clause if a table.. The DBA cannot by any means do the same thing when dealing with SQLs that insists on a specific number of PQ processes on a specific number of instances.

  • ORA-12842: Cursor invalidated during parallel execution Database driver err

    Hi gurus,
    I have got an PL/SQL package in DWH environment and sometimes it generates the follwoing error message:
    ORA-12842: Cursor invalidated during parallel execution Database driver error...
    When I restart the process, it runs successfully.
    Any ideas about this behaviour?
    Regards
    Bernd

    More info needed.
    Which Oracle version?
    Are you running up against a known bug? Check metalink.
    Cheers,
    Colin

Maybe you are looking for

  • G5 iSight issue

    Please read this. http://macteens.com/forums/index.php?showtopic=9368&st=0 This is about my mac, to take or not to take in for service? Can I fix this on my own?

  • Default directory when burning

    When we use iDvd to burn a disk, the program creates some scratch information that it puts in the user's Documents folder. However, at the University we have the Documents folder mapped to a server, and burning a DVD often causes the student to go ov

  • RE: (forte-users) Accelerator keys under MS Windows95/98/NT

    This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01BEF001.9C8C0B50 Content-Type: text/plain Unfortunately, ALT key is not recognized as a val

  • OID function in DB

    Hi Experts, i have query in DB, we are using 11g database; i have install oracle 11g in my Aix server,I had excuted DBMS_LDAP package also in my user. I try to create below function but it's thorws error. CREATE OR REPLACE FUNCTION GETGROUP(Username

  • Download error in updating Creative Cloud

    One member of our team cannot update the CC when is trying to download, said that there is an error, but there is no reason Could you please help us?