Intra-query parallelism

  • Hi masters,

    I have a query, when i execute it, it gives me the folowing message:

    "Intra-query parallelism caused your server command (process ID #58) to deadlock. Rerun the query without intra-query parallelism by using the query hint option (maxdop 1)."

    the query is this one:

    select a.rgt from bulk_1 as a, todos2 as b

    where a.rgt <> b.rgt and a.bictb=b.bictb

    Note:

    Bulk_1 is a table and todos 2 is the folowing view:

    create view TODOS2

    as

    select

    a.rgt,a.codctt,b.Cif,b.morada,b.dta_alteracao,b.bictb as bictb from allt as a ,contribuintesest as b

    where a.codctb=b.codctb

    union all

    select

    a.rgt,a.codctt,b.CIF,b.morada,b.dta_alteracao,null as bictb from allt as a ,contribuintee as b

    where a.codctb=b.codctb

    union all

    select

    a.rgt,a.codctt,b.CIF,b.morada,b.dta_alteracao,null as bictb from allt as a ,contribuinteinst as b

    where a.codctb=b.codctb

    Can someone help me understanding what is the problem?

    tks,

    Pedro

  • hi,'

    try this one

    select a.rgt from bulk_1 as a, todos2 as b

    where a.rgt <> b.rgt and a.bictb=b.bictb

    OPTION (MAXDOP 1)

    or

    EXEC sp_configure 'show advanced option', '1'

    RECONFIGURE

    GO

    sp_configure 'max degree of parallelism', 0

    RECONFIGURE

    GO

    thanks

    Mithun

  • Just a small (but significant :-P) correction to the above post:

    sp_configure 'max degree of parallelism', 1

    This issue appears in certain conditions (I've only seen it happening with certain statements using UNION ALLs) in which more than one processor (or processor core) is utilised for a query ("intra-query parallelism"). I understand it to be caused by the processes running over both processors deadlocking each other.

    If you know the statements that are causing it, add the MaxDOP hint. That query will then be forced to operate on only one processor.

    If you cannot locate it, then you can use the sp_configure 'max degree of parallelism' option but be warned that it means your whole SQL Server instance will be confined to only 1 processor (I think that is the scope of it - check BOL to be sure).

  • Or you could re-write the view to avoid the problem:

    CREATE VIEW TODOS2

    AS

    SELECT A.rgt, A.codctt, D.CIF, D.morada, D.dta_alteracao, D.bictb

    FROM allt AS A

    JOIN

    (

    SELECT B1.codctb, B1.CIF, B1.morada, B1.dta_alteracao, B1.bictb

    FROM contribuintesest AS B1

    UNION ALL

    SELECT B2.codctb, B2.CIF, B2.morada, B2.dta_alteracao, NULL

    FROM contribuintee AS B2

    UNION ALL

    SELECT B3.codctb, B3.CIF, B3.morada, B3.dta_alteracao, NULL

    FROM contribuinteinst B3

    ) D

    ON A.codctb = D.codctb

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply