XMLTable join causes parallel query not to work

We have a large table, a column stores xml data as binary xmltype storage, and XMLTABLE query is used to extract the data.
If we just need to extract data into a column, and the data has no relation with other data columns, XMLTABLE query is super fast.
Once the data has parent -> children relationship with other columns, the query becomes extremely slow. From the query plan, we could observe that the parallel execution is gone.
I can reproduce the problem with the following scripts:
1. Test scripts to setup
=============================
-- Test table
drop table test_xml;
CREATE table test_xml
( period date,
xml_content xmltype)
XMLTYPE COLUMN xml_content STORE AS SECUREFILE BINARY XML (
STORAGE ( INITIAL 64K )
enable storage in row
nocache
nologging
chunk 8K
parallel
compress;
-- Populate test_xml table with some records for testing
insert into test_xml (period, xml_content)
select sysdate, xmltype('<?xml version = "1.0" encoding = "UTF-8"?>
<searchresult>
<hotels>
<hotel>
<hotel.id>10</hotel.id>
<roomtypes>
<roomtype>
<roomtype.ID>20</roomtype.ID>
<rooms>
<room>
<id>30</id>
<meals>
<meal>
<id>Breakfast</id>
<price>300</price>
</meal>
<meal>
<id>Dinner</id>
<price>600</price>
</meal>
</meals>
</room>
</rooms>
</roomtype>
</roomtypes>
</hotel>
</hotels>
</searchresult>') from dual;
commit;
begin
for i in 1 .. 10
loop
insert into test_xml select * from test_xml;
end loop;
commit;
end;
select count(*) from test_xml;
-- 1024
2. Fast query. Only extract room_id info, the plan shows parallel execution. The performance is very good.
=================================================================
explain plan for
select *
from test_xml,
XMLTABLE ('/searchresult/hotels/hotel/roomtypes/roomtype/rooms/room'
passing xml_content
COLUMNS
room_id varchar2(4000) PATH './id/text()'
) a;
select * from table(dbms_xplan.display());
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib |
| 0 | SELECT STATEMENT | | 8364K| 15G| 548 (1)| 00:00:07 | | | |
| 1 | PX COORDINATOR | | | | | | | | |
| 2 | PX SEND QC (RANDOM) | :TQ10000 | 8364K| 15G| 548 (1)| 00:00:07 | Q1,00 | P->S | QC (RAND) |
| 3 | NESTED LOOPS | | 8364K| 15G| 548 (1)| 00:00:07 | Q1,00 | PCWP | |
| 4 | PX BLOCK ITERATOR | | | | | | Q1,00 | PCWC | |
| 5 | TABLE ACCESS FULL| TEST_XML | 1024 | 2011K| 2 (0)| 00:00:01 | Q1,00 | PCWP | |
| 6 | XPATH EVALUATION | | | | | | Q1,00 | PCWP | |
3. The slow query. To extract room_id plus meal ids, no parallel execution. Performance is vert bad.
==============================================================
-- One room can have multiple meal ids
explain plan for
select *
from test_xml,
XMLTABLE ('/searchresult/hotels/hotel/roomtypes/roomtype/rooms/room'
passing xml_content
COLUMNS
room_id varchar2(4000) PATH './id/text()'
, meals_node xmltype path './meals'
) a,
XMLTABLE ('./meals/meal'
passing meals_node
COLUMNS
meals_ids varchar2(4000) PATH './id/text()'
) b;
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 68G| 125T| 33M (1)|112:33:52 |
| 1 | NESTED LOOPS | | 68G| 125T| 33M (1)|112:33:52 |
| 2 | NESTED LOOPS | | 8364K| 15G| 676 (1)| 00:00:09 |
| 3 | TABLE ACCESS FULL| TEST_XML | 1024 | 2011K| 2 (0)| 00:00:01 |
| 4 | XPATH EVALUATION | | | | | |
| 5 | XPATH EVALUATION | | | | | |
Is the xml binary storage designed to only solve non-parent-children relationships data?
I would hightly appreciate if someone could help.

This problem has been confirmed as an oracle bug, currently the bug is not fixed yet.
Bug 16752984 : PARALLEL EXECUTION NOT WORKING WITH XMLTYPE COLUMN

Similar Messages

  • SUM on XMLTable Column Causes Parallel Query to Not Work

    I have the following query that creates an XMLTable out of an xml document and is then used to aggregate data from the document.
    My problem is that when I try to SUM the XMLTable return column I am unable to use Parallel processing, yet when I remove the SUM from the return column Parallel processing works as expected. Can anyone shed some light on what the problem may be?
    One note: I am applying a larger query than the following to hundreds of millions of records so parallel processing is definitely desired/needed.
    The Query:
    SELECT     /*+ full(n) parallel(n,8) */
         x451s30 as "XYZ"
         --SUM(x451s30) as "XYZ"
    FROM NADS n,
         metas met,
         XMLTable(XMLNAMESPACES('http://fbi.gov/cjis/N-DEx' as "p1"),
              '/*' PASSING n.DATA_INTERNAL
              COLUMNS
                   x451s30 NUMBER PATH 'count(/p1:DataItem/Person[Role = "Arrest Subject"]/Name/LastName)') T7
    WHERE STATUS_ID=1
    AND NAT_SOURCE_ID=0
    AND OWNING_ORI like 'ABC123'
    and n.id=met.nads_id and met.type_id=1 and met.val='Arrest Report';
    Explain Plan without SUM
    PLAN_TABLE_OUTPUT
    Plan hash value: 2296199318
    | Id | Operation               | Name               | Rows | Bytes | Cost (%CPU)| Time     | Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT          |               | 1 | 130 | 3713 (0)| 00:00:45 |     |     |     |     |     |
    | 1 | SORT AGGREGATE           |               | 1 | 2 |     |      |     |     |     |     |     |
    | 2 | XPATH EVALUATION          |               |     |     |     |      |     |     |     |     |     |
    | 3 | PX COORDINATOR           |               |     |     |     |      |     |     |     |     |     |
    | 4 | PX SEND QC (RANDOM)          | :TQ10000          | 1 | 130 | 3713 (0)| 00:00:45 |     |     | Q1,00 | P->S | QC (RAND) |
    | 5 | NESTED LOOPS           |               | 1 | 130 | 3713 (0)| 00:00:45 |     |     | Q1,00 | PCWP |     |
    | 6 | NESTED LOOPS          |               | 1 | 128 | 3683 (0)| 00:00:45 |     |     | Q1,00 | PCWP |     |
    | 7 | PX BLOCK ITERATOR          |               | 1 | 108 | 3683 (0)| 00:00:45 | 1 | 63 | Q1,00 | PCWC |     |
    |* 8 | TABLE ACCESS FULL      | NADS               | 1 | 108 | 3683 (0)| 00:00:45 | 1 | 63 | Q1,00 | PCWP |     |
    |* 9 | TABLE ACCESS BY INDEX ROWID| METAS           | 1 | 20 | 2 (0)| 00:00:01 |     |     | Q1,00 | PCWP |     |
    |* 10 | INDEX UNIQUE SCAN      | MET_NADS_ID_TYPE_ID_UK | 1 |     | 1 (0)| 00:00:01 |     |     | Q1,00 | PCWP |     |
    | 11 | XPATH EVALUATION          |               |     |     |     |      |     |     | Q1,00 | PCWP |     |
    Predicate Information (identified by operation id):
    8 - filter("OWNING_ORI"='ABC123' AND "NAT_SOURCE_ID"=0 AND "STATUS_ID"=1)
    9 - filter("MET"."VAL"='Arrest Report')
    10 - access("N"."ID"="MET"."NADS_ID" AND "MET"."TYPE_ID"=1)
    Note
    - dynamic sampling used for this statement (level=4)
    29 rows selected.
    Expalin Plan with SUM
    PLAN_TABLE_OUTPUT
    Plan hash value: 1527372262
    | Id | Operation               | Name               | Rows | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    | 0 | SELECT STATEMENT          |               | 1 | 130 | 3713 (0)| 00:00:45 |     |     |
    | 1 | SORT AGGREGATE           |               | 1 | 2 |     |      |     |     |
    | 2 | XPATH EVALUATION          |               |     |     |     |      |     |     |
    | 3 | SORT AGGREGATE           |               | 1 | 130 |     |      |     |     |
    | 4 | SORT AGGREGATE          |               | 1 | 130 |     |      |     |     |
    | 5 | NESTED LOOPS           |               | 1 | 130 | 3713 (0)| 00:00:45 |     |     |
    | 6 | NESTED LOOPS          |               | 1 | 128 | 3683 (0)| 00:00:45 |     |     |
    | 7 | PARTITION LIST ALL      |               | 1 | 108 | 3683 (0)| 00:00:45 | 1 | 63 |
    |* 8 | TABLE ACCESS FULL      | NADS               | 1 | 108 | 3683 (0)| 00:00:45 | 1 | 63 |
    |* 9 | TABLE ACCESS BY INDEX ROWID| METAS           | 1 | 20 | 2 (0)| 00:00:01 |     |     |
    |* 10 | INDEX UNIQUE SCAN      | MET_NADS_ID_TYPE_ID_UK | 1 |     | 1 (0)| 00:00:01 |     |     |
    | 11 | XPATH EVALUATION          |               |     |     |     |      |     |     |
    Predicate Information (identified by operation id):
    8 - filter("OWNING_ORI"='ABC123' AND "NAT_SOURCE_ID"=0 AND "STATUS_ID"=1)
    9 - filter("MET"."VAL"='Arrest Report')
    10 - access("N"."ID"="MET"."NADS_ID" AND "MET"."TYPE_ID"=1)
    Note
    - dynamic sampling used for this statement (level=4)
    29 rows selected.
    Edited by: drad on May 9, 2012 3:31 AM

    After adding the no_xml_query_rewrite hint I get the PX Coordinator back and parallel processing is enabled; however, this comes at a significant performance impact (query takes 2-3 times longer). It currently appears that Parallel is not worth the cost of loosing the xml query rewrite unless a different indexing scheme can make up the difference.
    Apparently the issue was the optimizer rewriting the xml query in the XMLTable which was causing Parallel processing to not be used.
    For those interested, the full query is now as follows:
    SELECT /*+ full(n) parallel(n,8) no_xml_query_rewrite */
         COUNT(*) as TOTAL_RECORDS,
         SUM(T7.x422s1) AS ArrestsDateEX,
         SUM(T7.x423s2) AS ArrNarAccDesEX,
         SUM(T7.x424s3) AS WitNarAccDesEX,
         SUM(T7.x425s4) AS WitFirstNameEX,
         SUM(T7.x426s5) AS WitFullNameEX,
         SUM(T7.x427s6) AS WitLastNameEX,
         SUM(T7.x428s7) AS WitMiddleNameEX,
         SUM(T7.x429s8) AS WitSexCodeEX,
         SUM(T7.x430s9) AS OfficerORIEX,
         SUM(T7.x431s10) AS OfficerFirstNameEX,
         SUM(T7.x432s11) AS OfficerFullNameEX,
         SUM(T7.x433s12) AS OfficerLastNameEX,
         SUM(T7.x434s13) AS OfficerMiddleNameEX,
         SUM(T7.x435s14) AS AreJuvDisCodeEX,
         SUM(T7.x436s15) AS AreUCRArrOffCodeEX,
         SUM(T7.x437s16) AS ArrAdtIndicatorEX,
         SUM(T7.x438s17) AS AreBirthDateEX,
         SUM(T7.x439s18) AS AreEthCodeEX,
         SUM(T7.x440s19) AS AreEyeColorEX,
         SUM(T7.x441s20) AS AreHairColorEX,
         SUM(T7.x442s21) AS ArrHeightEX,
         SUM(T7.x443s22) AS AreDvrLicNumEX,
         SUM(T7.x444s23) AS AreFBINumEX,
         SUM(T7.x445s24) AS ArePassportIDEX,
         SUM(T7.x446s25) AS AreSSNEX,
         SUM(T7.x447s26) AS AreStateIDEX,
         SUM(T7.x448s27) AS AreUSMSIDEX,
         SUM(T7.x449s28) AS AreFirstNameEX,
         SUM(T7.x450s29) AS AreFullNameEX,
         SUM(T7.x451s30) AS AreLastNameEX,
         SUM(T7.x452s31) AS AreMiddleNameEX,
         SUM(T7.x453s32) AS AreSexCodeEX,
         SUM(T7.x454s33) AS AreWeightEX,
         SUM(T7.x455s34) AS ArrLocCityEX,
         SUM(T7.x456s35) AS ArrLocCountryEX,
         SUM(T7.x457s36) AS ArrLocFullAddressEX,
         SUM(T7.x458s37) AS ArrLocFullStreetEX,
         SUM(T7.x459s38) AS ArrLocStateEX,
         SUM(T7.x460s39) AS ArrLocStreetNameEX,
         SUM(T7.x461s40) AS ArrLocStreetNumberEX,
         SUM(T7.x462s41) AS ArrLocStreetPostdirectionEX,
         SUM(T7.x463s42) AS ArrLocSteetPredirectionEX,
         SUM(T7.x464s43) AS ArrLocZipEX,
         SUM(T7.x465s44) AS OffCmpIndicatorEX,
         SUM(T7.x466s45) AS OffDesTextEX,
         SUM(T7.x467s46) AS OffDomVioIndicatorEX,
         SUM(T7.x468s47) AS OffFrcUseCodeEX,
         SUM(T7.x469s48) AS OffGangInvCodeEX,
         SUM(T7.x470s49) AS OffHmeInvIndicatorEX,
         SUM(T7.x471s50) AS OffIdtTftIndicatorEX,
         SUM(T7.x472s51) AS OffMOCCodeEX,
         SUM(T7.x473s52) AS OffOffCodeEX,
         SUM(T7.x474s53) AS OffTrrIndicatorEX,
         SUM(T7.x475s54) AS WrrAgencyEX,
         SUM(T7.x476s55) AS WrrAgencyORIEX,
         SUM(T7.x477s56) AS WrrCplOrgEX,
         SUM(T7.x478s57) AS WrrCplOrgORIEX,
         SUM(T7.x479s58) AS WrrCplPersonEX,
         SUM(T7.x480s59) AS WrrDesEX,
         SUM(T7.x481s60) AS WrrIssAuthorityEX,
         SUM(T7.x482s61) AS WrrIssAuthorityORIEX,
         SUM(T7.x483s62) AS WrrWrrDateEX
    FROM NADS n, metas met, meta_types mtt,
         XMLTable(XMLNAMESPACES('http://fbi.gov/cjis/N-DEx' as "p1"),
         '/p1:DataItem' PASSING n.DATA_INTERNAL
         COLUMNS
              x451s30 NUMBER PATH 'count(Person[Role="Arrest Subject"]/Name/LastName)',
              x452s31 NUMBER PATH 'count(Person[Role="Arrest Subject"]/Name/MiddleName)',
              x453s32 NUMBER PATH 'count(Person[Role="Arrest Subject"]/Sex)',
              x454s33 NUMBER PATH 'count(Person[Role="Arrest Subject"]/Weight[PointValue or MaximumValue or MinimumValue])',
              x455s34 NUMBER PATH 'count(Location[AssociationReference/AssociationType=Arrest/AssociationReference/AssociationType and AssociationReference/AssociationGUID=Arrest/AssociationReference/AssociationGUID]/City)',
              x456s35 NUMBER PATH 'count(Location[Country])',
              x457s36 NUMBER PATH 'count(Location/FullAddress)',
              x458s37 NUMBER PATH 'count(Location/FullStreetAddress)',
              x459s38 NUMBER PATH 'count(Location/State)',
              x460s39 NUMBER PATH 'count(Location/StreetName)',
              x461s40 NUMBER PATH 'count(Location/StreetNumber)',
              x462s41 NUMBER PATH 'count(Location/StreetPostdirection)',
              x463s42 NUMBER PATH 'count(Location/StreetPredirection)',
              x464s43 NUMBER PATH 'count(Location/PostalCode)',
              x465s44 NUMBER PATH 'count(Offense/OtherContent[Info="offense was completed" or Info="offense was attempted"])',
              x466s45 NUMBER PATH 'count(Offense/OffenseDescriptionText)',
              x467s46 NUMBER PATH 'count(Offense/DomesticViolenceIndicator)',
              x468s47 NUMBER PATH 'count(Offense/ForceCategory)',
              x469s48 NUMBER PATH 'count(Offense/OtherContent[Info="gang"])',
              x470s49 NUMBER PATH 'count(Offense/OtherContent[Info="home invasion"])',
              x471s50 NUMBER PATH 'count(Offense/OtherContent[Info="identity theft"])',
              x472s51 NUMBER PATH 'count(Offense/MOCrimeAndMotive)',
              x473s52 NUMBER PATH 'count(Offense/Offense)',
              x474s53 NUMBER PATH 'count(Offense/OffenseTerrorismIndicator)',
              x475s54 NUMBER PATH 'count(Organization[AssociationReference/AssociationType="ActivityResponsibleOrganizationAssociation" and AssociationReference/AssociationGUID=Activity[OtherContent/Info="Warrant"]/AssociationReference/AssociationGUID]/Name)',
              x476s55 NUMBER PATH 'count(Organization[AssociationReference/AssociationType="ActivityResponsibleOrganizationAssociation" and AssociationReference/AssociationGUID=Activity[OtherContent/Info="Warrant"]/AssociationReference/AssociationGUID]/OrganizationID)',
              x477s56 NUMBER PATH 'count(Organization[AssociationReference/AssociationType="ActivityInvolvedOrganizationAssociation" and AssociationReference/AssociationGUID=Activity[OtherContent/Info="Warrant"]/AssociationReference/AssociationGUID]/Name)',
              x478s57 NUMBER PATH 'count(Organization[AssociationReference/AssociationType="ActivityInvolvedOrganizationAssociation" and AssociationReference/AssociationGUID=Activity[OtherContent/Info="Warrant"]/AssociationReference/AssociationGUID]/OrganizationID)',
              x424s3 NUMBER PATH 'count(Person[Role="Witness"]/WitnessNarrative)',
              x425s4 NUMBER PATH 'count(Person[Role="Witness" and string-length(Name/FirstName)>0])',
              x426s5 NUMBER PATH 'count(Person[Role="Witness" and string-length(Name/FullName)>0])',
              x427s6 NUMBER PATH 'count(Person[Role="Witness" and string-length(Name/LastName)>0])',
              x428s7 NUMBER PATH 'count(Person[Role="Witness" and string-length(Name/MiddleName)>0])',
              x429s8 NUMBER PATH 'count(Person[Role="Witness" and string-length(Sex)>0])',
              x422s1 NUMBER PATH 'count(Arrest/Date)',
              x423s2 NUMBER PATH 'count(Arrest/Narrative)',
              x430s9 NUMBER PATH 'count(Person[AssociationReference/AssociationType="PersonAssignedUnitAssociation" and AssociationReference/AssociationGUID=Organization[string-length(OrganizationID)>0]/AssociationReference[AssociationType="PersonAssignedUnitAssociation"]/AssociationGUID])',
              x431s10 NUMBER PATH 'count(Person[Role="Enforcement Official" and string-length(Name/FirstName)>0])',
              x432s11 NUMBER PATH 'count(Person[Role="Enforcement Official" and string-length(Name/FullName)>0])',
              x433s12 NUMBER PATH 'count(Person[Role="Enforcement Official" and string-length(Name/LastName)>0])',
              x434s13 NUMBER PATH 'count(Person[Role="Enforcement Official" and string-length(Name/MiddleName)>0])',
              x435s14 NUMBER PATH 'count(Person[Role="Arrest Subject"]/SubjectJuvenileSubmissionIndicator)',
              x436s15 NUMBER PATH 'count(Person[Role="Arrest Subject" and  ArrestSubjectUCROffenseCharge])',
              x437s16 NUMBER PATH 'count(Person[Role="Arrest Subject"]/TreatAsAdultIndicator)',
              x438s17 NUMBER PATH 'count(Person[Role="Arrest Subject"]/BirthDate)',
              x439s18 NUMBER PATH 'count(Person[Role="Arrest Subject"]/Ethnicity)',
              x440s19 NUMBER PATH 'count(Person[((Role="Arrest Subject") and (EyeColor or EyeColorText))])',
              x441s20 NUMBER PATH 'count(Person[((Role="Arrest Subject") and (HairColor or HairColorText))])',
              x442s21 NUMBER PATH 'count(Person[Role="Arrest Subject"]/Height[PointValue or MaximumValue or MinimumValue])',
              x443s22 NUMBER PATH 'count(Person[Role="Arrest Subject"]/DriverLicenseID/ID)',
              x444s23 NUMBER PATH 'count(Person[Role="Arrest Subject"]/FBINumber)',
              x445s24 NUMBER PATH 'count(Person[Role="Arrest Subject"]/PassportID/ID)',
              x446s25 NUMBER PATH 'count(Person[Role="Arrest Subject"]/SSN)',
              x447s26 NUMBER PATH 'count(Person[Role="Arrest Subject"]/StateFingerprintID)',
              x448s27 NUMBER PATH 'count(Person[Role="Arrest Subject"]/USMSFugitiveNumber)',
              x449s28 NUMBER PATH 'count(Person[Role="Arrest Subject"]/Name/FirstName)',
              x450s29 NUMBER PATH 'count(Person[Role="Arrest Subject"]/Name/FullName)',
              x479s58 NUMBER PATH 'count(Person[AssociationReference/AssociationType="ActivityInvolvedPersonAssociation" and AssociationReference/AssociationGUID=Activity[OtherContent/Info="Warrant"]/AssociationReference/AssociationGUID])',
              x480s59 NUMBER PATH 'count(Warrant/Description)',
              x481s60 NUMBER PATH 'count(Organization[AssociationReference/AssociationType="ActivityInformationClearerOrganizationAssociation" and AssociationReference/AssociationGUID=Activity[OtherContent/Info="Warrant"]/AssociationReference/AssociationGUID]/Name)',
              x482s61 NUMBER PATH 'count(Organization[AssociationReference/AssociationType="ActivityInformationClearerOrganizationAssociation" and AssociationReference/AssociationGUID=Activity[OtherContent/Info="Warrant"]/AssociationReference/AssociationGUID]/OrganizationID)',
              x483s62 NUMBER PATH 'count(Warrant/WarrantDate)') T7
          WHERE STATUS_ID=1
            AND NAT_SOURCE_ID=0
            AND OWNING_ORI like 'ABC123'
            and n.id=met.nads_id and met.type_id=mtt.id and mtt.name='ReportType' and met.val='Arrest Report';Edited by: drad on May 15, 2012 6:03 AM
    Edited by: drad on May 15, 2012 6:04 AM
    marking as answered as the above solution worked for me

  • Joining with sub query not working

    Hi
    I am new with these complex queries. I am trying to join a sub query to a query as below;
    SELECT Events1.InvoiceBatch AS BatchNo, Events1.InvoiceBatchDate AS BatchDate, tblClients.Company, tblClients.ID AS ClientID, COUNT(Events1.ID) AS Invoices,
    COUNT(*) - COUNT(Events1.InvoicePrintDate) AS E, Events1.InvoiceBatchFromDate AS BatchFrom, Events1.InvoiceBatchToDate AS BatchTo, (SELECT EventID, SUM(Total) FROM tblStaffBookings AS StaffBookings WHERE StaffBookings.EventID = Events1.ID GROUP BY EventID) AS Total
    FROM tblEvents AS Events1 LEFT OUTER JOIN
    tblClients ON Events1.ClientID = tblClients.ID
    WHERE (Events1.FactoringExportDate IS NULL) OR (Events1.AccountsExportDate IS NULL) OR (Events1.InvoiceSentDate IS NULL)
    GROUP BY Events1.InvoiceBatch, Events1.InvoiceBatchDate, tblClients.Company, tblClients.ID, Events1.InvoiceBatchFromDate, Events1.InvoiceBatchToDate
    HAVING (Events1.InvoiceBatch = 5212)
    ORDER BY tblClients.Company
    I am getting these two errors;
    Msg 8120, Level 16, State 1, Line 2
    Column 'tblEvents.ID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
    Msg 116, Level 16, State 1, Line 2
    Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
    What am I missing?
    Thanks
    Regards

    SELECT Events1.InvoiceBatch AS BatchNo, Events1.InvoiceBatchDate AS BatchDate, tblClients.Company, tblClients.ID AS ClientID, COUNT(Events1.ID) AS Invoices,
    COUNT(*) - COUNT(Events1.InvoicePrintDate) AS E, Events1.InvoiceBatchFromDate AS BatchFrom, Events1.InvoiceBatchToDate AS BatchTo,Total
    FROM tblEvents AS Events1 LEFT OUTER JOIN
    tblClients ON Events1.ClientID = tblClients.ID
    LEFT OUTER JOIN (SELECT EventID, SUM(Total) AS Total FROM tblStaffBookings AS StaffBookings WHERE StaffBookings.EventID = Events1.ID GROUP BY EventID) sb
    ON sb.EventID = Events1.ID
    WHERE (Events1.FactoringExportDate IS NULL) OR (Events1.AccountsExportDate IS NULL) OR (Events1.InvoiceSentDate IS NULL)
    GROUP BY Events1.InvoiceBatch, Events1.InvoiceBatchDate, tblClients.Company, tblClients.ID, Events1.InvoiceBatchFromDate, Events1.InvoiceBatchToDate,Total
    HAVING (Events1.InvoiceBatch = 5212)
    ORDER BY tblClients.Company
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page
    Says;
    Msg 4104, Level 16, State 1, Line 5
    The multi-part identifier "Events1.ID" could not be bound.
    on
    LEFT OUTER JOIN (SELECT EventID, SUM(Total) AS Total FROM tblStaffBookings AS StaffBookings WHERE StaffBookings.EventID = Events1.ID GROUP BY EventID) sb
    Regards

  • Parallel query not working

    Hi,
    I wanted to run a select statement in parallel and it has two indexes for that table.I have changed the degree of both table and index to 16 and I have also specified parallel hint.But even then its not running in parallel.Whats the issue?
    this is the query:
    select /*+ parallel (a,16) */ * from xxxxx a where date_sys between '20101001' and '20101031' and table_name='telm' and substr(table_key,1,19)='0030000000002048809';
    select * from v$px_process;
    no rows

    Sekar_BLUE4EVER wrote:
    >
    select /*+ parallel (a,16) */ * from archsbi.AUDT_16022011 a where date_sys between
    '20101001' and '20101031' and table_name='telm' and
    substr(table_key,1,19)='0030000000002048809'
    Plan hash value: 581631348
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    PLAN_TABLE_OUTPUT
    | 0 | SELECT STATEMENT | | | | 873 (100)| |
    |* 1 | TABLE ACCESS BY INDEX ROWID| xxxxxxx | 770 | 273K| 873 (56)| 00:00:11 |
    |* 2 | INDEX SKIP SCAN | IND1 | 250 | | 832 (58)| 00:00:10 |
    Predicate Information (identified by operation id):
    1 - filter(SUBSTR("TABLE_KEY",1,19)='0030000000002048809')
    2 - access("DATE_SYS">='20101001' AND "TABLE_NAME"='telm' AND
    "DATE_SYS"<='20101031')
    PLAN_TABLE_OUTPUT
    filter("TABLE_NAME"='telm')
    >parallel is overkill for less than 1000 rows.
    The optimizer is smarter than you!

  • Could PRAM reset and other reset cause optical drive not to work?

    My Superdrive on my Powerbook G4 12-inch was working normally, reading and burning CDs and DVDs, until the very first time I attempted to use it following a P-RAM reset and one other reset (I forget the name) done with Applecare tech support, over the phone. Now when I insert a CD or DVD, it sounds like the computer tries to read it, but discs are ejected after about 30 seconds, never having shown up on desktop.
    To summarize, could the above-described resets have caused the problem with my optical drive?
    Thank you!

    Womanhattan:
    The article Resetting your Mac's PRAM and NVRAM explains what the PRAM is and what resetting can do. There is no mention of the optical drive in it.
    I don't know what caused your optical drive to start rejecting media, but I suspect it is not related to PRAM.
    Good luck.
    cornelius

  • Frequent updates causing other programs not to work correctly

    I have a fitness computer called Body Bugg. After one of the frequent updates by Firefox, portions of the program stopped working.
    I tried downloading the newest update for Java but the program continues to give me a black screen and displays "done" rather than the normal form that should be displayed.
    I have to completely back out of the internet and go back in for the program to work correctly.
    It doesn't happen in IE. I prefer not to use IE, can you assist with this?
    Thanks,
    Eve E Greditzer

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    * Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    * Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • Swf file causing rollover images not to work

    I've inserted a Flash file into my webpage in Dreamweaver and it broke all my rollover images.  Even deleting the swf file and reinserting the rollover images doesn't work.  I've read a few threads on this but can't quite find exactly what I'm looking for.  I think it's something in the <head> code but I'm not sure.  Any help would be much appreciated!
    <head>
    <title>Matt  Relstab | Still Photography | Moving Pictures | Sound  Design</title>
    <meta http-equiv="Content-Type"  content="text/html; charset=ISO-8859-1">
    <script type="text/javascript">
    <!--
    function  MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr;  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)  x.src=x.oSrc;
    function MM_preloadImages() { //v3.0
      var  d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
         var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;  i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image;  d.MM_p[j++].src=a[i];}}
    function  MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document;  if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document;  n=n.substring(0,p);}
      if(!(x=d[n])&&d.all)  x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)  x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++)  x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return  x;
    function MM_swapImage() { //v3.0
      var  i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array;  for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;  if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    //-->
    <meta  name="keywords" content="natural light photography, media producer  boston, online media, photographs, sound design, audio for film, web  video, video production,
    boston production, portable recorder, digital photography, digital  media production">
    </script>
    <style  type="text/css">
    <!--
    body {
    background-color: #3f4450;
    -->
    </style>
    <script  src="Scripts/AC_RunActiveContent.js"  type="text/javascript"></script>
    </head>

    For starters, look at the first line on your errant page, it starts out:
    <meta name="keywords" content="audio reel, foley artist, sound effects mixer, audio mixer
    boston, sound engineer, post production">
    <html>
    Thats not good.  If you look at your other pages, the <html> tag is first, the way it should be.
    Switch them around, then try this, remove your <html> tag (the very first tag is where is should be) and replace it with this
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    See what that does for you.
    Gary
    On Edit:  I just noticed that you have
    <meta name="keywords" content="natural light photography, media producer boston,
    online media, photographs, sound design, audio for film, web video, video production,
    boston production, portable recorder, digital photography, digital media production">
    inside your js for the rollovers...Move them out of the script.
    GAry

  • Safari 7.1 causing website buttons not to work?

    I am running Safari 7.1 on OSX 10.9.5 on my Macbook.  I've recently been having trouble with buttons on certain websites, specifically US Airways, and read that it may be due to my safari version of 7.1.  For example, I can no longer login to my dividend miles account because the login button doesn't work.  I cannot 'manage travel' and look at my reservations because the calendar button and manage reservations buttons do not work.  How do I fix this?  I have restarted safari and my computer.  I have updated java and flash, I have reset safari and cleared cookies.  I'm at a loss and this is very frustrating. 

    It's a known issue. Use another browser, such as Firefox, until the site is fixed.

  • External Hard Drive Causing Force quit not to work

    I have 2 Lacie 500 gig FW 800 external drives daisy chained to my imac. I use one for Time Machine and one for weekly backups. After upgrading to 10.5.3 I noticed applications were freezing and I could not force quit. Today Microsoft Word froze and I noticed when I went to force quit, (holding the mouse button down on the icon to get menu) that one of my drives spun up. I disconnected the FW800 cable from my Mac and the application unfroze. Help are my drive incompatible now in 10.5.3? Is something wrong with one of my drives?

    Try running repair permissions in Disk Utility on your hard drives.

  • Software update causing apple TV not to work

    I've just downloaded the new software update and I'm stuck on a screen that shows a USB cable below the itunes icon. What am I supposed to hook up? The apple TV light is blinking steady.
    Any suggestions?
    Thanks

    Hello all,
    I would like to find out some more information about this specific issue. If you got this issue (black screen and blinking LED while Ethernet is connected, WiFi networks not found) after updating to Apple TV 5.1, can you please email me <[email protected]> with the answers to these questions:
    1. What does your network look like? For example, what is your router and how is it connected to the Internet? Is your Apple TV getting a DHCP-assigned IP address or is it statically assigned? Do you have any other custom network settings that might be a factor?
    2. What is your Apple TV's device diagnostic ID? Get this by highlighting "Send Data to Apple" in Settings > General and pressing the Right button.
    Thanks,
    Roy

  • Parallel processing  not all work items are completed

    Hi experts,
      I have a strange problem with some Wi's wich does not get the status completed when the main WF is completed.
    I have a WF with a fork , one branch is waiting for an event and the other branch is looping  on a decision task and actions. when the event is received, the WF ends correctly and the main WF is completed. but the last active WI in the other branch is not completed  and remain in the inbox of the agents.
    I'm a bit confused,do you find this behaviour normal ?
    SAP_APPL   500 : level  11
    SAP_BASIS  640 : level 15
    SAP_ABA     640 : level 15
    regards,
    Abdellatif

    Hi Abdellatif,
    normally the workitem should be put to logically deleted, so this is indeed strange behaviour.
    The only thing I can think about is, that your workflowdefinition is a bit corrupt, if you check the workflow definition, no warnings occur?
    Kind regards, Rob Dielemans

  • Level0 Parallel export not working for BSO

    Hi,
    We have a BSO cube with 15 dimensions, 2 dense and remaining spare. Total number of members are around 9000.
    we have added 400 new members to one of the sparse dimension after which parallel export is not happening. I started checking by deleting one by one and exporting it. when I deleted 8 members, export happened fine. If I add one extra member after that, parallel export is not hapenning.
    Strange thing is If I add member as child at any generation, export is hapenning fine. If I add a member as sibbling starting from gen 3, export is not working.
    Ex: A is dimension, B is child of A. If I add a new member C as sibling to B, parallel export is working.
    Now add D as child of C and E as sibling of D. D here is third generation and adding a sibbling hereafter is making parallel export not to work
    I'm using simple command - export database 'APP'.'DB' level0 data in columns to data_file "'D:\exp.1.txt'",D:\exp.2.txt'";
    If I use single file, export is happening fine.
    Does anybody has idea if BSO has member limit at generating levels. Please let me know your thoughts on this.
    Thanks,
    Swetha
    Edited by: Swetha on Dec 16, 2010 3:16 AM

    Dave,
    I'm facing the same issue which you faced earlier. Export files are created only with header. Issue here is I'm not getting data in any of those files. All the files has just header. I changed the order of sparse dimensions, my last sparse dimension is the largest sparse with 2250 members. Still export is creating 1kb files with only headers.
    The reason to change sparse to dense is we have scenario dimension which has Actual, operating and replan members and data is loaded for all years and all periods for all scenarios. So we thought it can be made dense and we didn't observe much difference in behaviour. Export is also happening fine. One has to analyze their outline structure and data before going for this option.
    I would still prefer old outline and appreciate your help on this..
    Swetha
    Edited by: Swetha on Dec 23, 2010 12:51 AM

  • Data Driven Subscriptions Error - the query processor could not start the necessary thread resources for parallel query execution

    Hi,
    We are getting the following error when certain data driven subscriptions are fired off: "the query processor could not start the necessary thread resources for parallel query execution".  I've read other posts that have the same error, and
    the solution usually involves adjusting MaxDOP to limit the number of queries that are fired off in parallel.  
    Unfortunately, we cannot change this setting on our server for performance reasons (outside of data driven subscriptions, it negatively impacts our ETL processing times).  We tried putting query hints like "OPTION (MAXDOP 2);" in the reports
    that are causing the error, but it did not resolve the problem.
    Are there any settings within Reporting Services that can be adjusted to limit the number of subscriptions that get fired off in parallel?
    Any help is appreciated - thanks!

    Yes, that is correct.  It's a painful problem, because you don't know which specific subscription failed. For example, we have a data driven subscription that sends out about 800 emails. Lately, we've been having a handful of them fail. You don't know
    which ones out of the 800 failed though, even from the RS log files - all it tells you is that "the
    query processor could not start the necessary thread resources for parallel query execution".
    Thanks, I'll try changing <MaxQueueThreads> and will let you know if it works.
    On a side note: I've noticed that it is only reports with cascading parameters (ex. where parameter 2 is dependent on the selection from parameter 1) that get this error message...

  • Parallel hint causes a query to run slower?

    I have an insert...select query where the select is a join between a table with one billion rows (although there is a where clause on an indexed column that restricts it to "only" 300 million), a table with 30 million rows, and a table with about 100,000 rows, where the result is about 20 rows. When I first ran it, it took about 2 hours. I added a Parallel hint, and explain plan showed that it was being used (and v$session showed that I had about 30 additional connections while it ran). but not it takes four hours.
    Is there a reason parallel processing would cause a query to run slower?
    insert /*+ append */ into employees_by_age_group
      pay_plan
    , age_range
    , pay_level
    , fy
    , employee_count
    select /*+ parallel */
           emp.pay_plan
         , to_char(d.min_age) || '-' || to_char(d.max_age) as age_range
         , emp.pay_level
         , pay.fy
         , count(pay.employee_id) as employee_count
    from
      select /*+ index(pay_info pay_info_index_on_site) */
             employee_id
           , extract(year from (dte_ppe_end + 92)) as fy
           , count(employee_id) as num_recs
      from pay_info
      where extract(month from dte_ppe_end) = 10
      and   extract(day from dte_ppe_end) between 14 and 27
      and   substr(pay_type, 1, 1) IN ('A', 'B', 'C')
      and   site like 'Z%'
      group by employee_id, extract(year from (dte_ppe_end + 92))
    ) pay
    join
      select employee_id
           , pay_plan
           , pay_grade
           , pay_step
           , file_date
      from
        select /*+ index(employee_info employee_info_index_on_site) */
               employee_id
             , pay_level
             , file_date
             , max(file_date)
               over (partition by extract(year from (file_date + 61)))
               as last_file_date
        from employee_info
        where site like 'Z%'
      where file_date = last_file_date
    ) emp
    on (
         emp.employee_id = pay.employee_id
         and extract(year from emp.file_date) = pay.fy - 1
    join (
           select employee_id
                , dob
           from (
                  select employee_id
                       , date_birth
                       , row_number() over (partition by employee_id order by date_file desc) as r
                  from employee_birthdates
                  where site like 'Z%'
           where r = 1
         ) dob
    on dob.employee_id = pay.employee_id
    join
                select 20 as min_age, 24 as max_age from dual
      union all select 25 as min_age, 29 as max_age from dual
      union all select 30 as min_age, 34 as max_age from dual
      union all select 35 as min_age, 39 as max_age from dual
      union all select 40 as min_age, 44 as max_age from dual
      union all select 45 as min_age, 49 as max_age from dual
      union all select 50 as min_age, 54 as max_age from dual
      union all select 55 as min_age, 59 as max_age from dual
      union all select 60 as min_age, 64 as max_age from dual
      union all select 65 as min_age, 69 as max_age from dual
      union all select 70 as min_age, 74 as max_age from dual
      union all select 75 as min_age, 79 as max_age from dual
      union all select 80 as min_age, 84 as max_age from dual
      union all select 85 as min_age, 89 as max_age from dual
      union all select 90 as min_age, 94 as max_age from dual
      union all select 95 as min_age, 99 as max_age from dual
    ) d
    group by emp.pay_plan, d.min_age, d.max_age, emp.pay_level, pay.fy;

    Paul - here are three different explain plans
    First, the original one (without the parallel hint):
    INSERT STATEMENT  ALL_ROWS                                              Cost: 26,684,255  Bytes: 114  Cardinality: 1                     
      35 LOAD AS SELECT EMPLOYEES_BY_AGE_GROUP                  
        34 HASH GROUP BY                                                    Cost: 26,684,255  Bytes: 114  Cardinality: 1                 
          33 NESTED LOOPS                                                   Cost: 26,684,254  Bytes: 114  Cardinality: 1               
            14 HASH JOIN                                                    Cost: 26,684,222  Bytes: 108  Cardinality: 1             
              9 MERGE JOIN                                                  Cost: 4,408,803  Bytes: 8,322  Cardinality: 146           
                3 VIEW DONBOT_DBA.                                          Cost: 114,863  Bytes: 29,625,180  Cardinality: 987,506         
                  2 WINDOW SORT PUSHED RANK                                 Cost: 114,863  Bytes: 35,550,216  Cardinality: 987,506       
                    1 TABLE ACCESS FULL TABLE EMPLOYEE_BIRTHDATES           Cost: 108,983  Bytes: 35,550,216  Cardinality: 987,506     
                8 SORT JOIN                                                 Cost: 4,293,940  Bytes: 3,645  Cardinality: 135         
                  7 VIEW DONBOT_DBA.                                        Cost: 4,293,939  Bytes: 3,645  Cardinality: 135       
                    6 SORT GROUP BY                                         Cost: 4,293,939  Bytes: 4,185  Cardinality: 135     
                      5 TABLE ACCESS BY INDEX ROWID TABLE PAY_INFO          Cost: 4,293,938  Bytes: 4,185  Cardinality: 135   
                        4 INDEX RANGE SCAN INDEX PAY_INFO_INDEX_ON_SITE     Cost: 487,124  Cardinality: 402,683,034 
              13 VIEW DONBOT_DBA                                            Cost: 22,275,300  Bytes: 1,160,143,257  Cardinality: 22,747,907           
                12 WINDOW SORT                                              Cost: 22,275,300  Bytes: 841,672,559  Cardinality: 22,747,907         
                  11 TABLE ACCESS BY INDEX ROWID TABLE EMPLOYEE_INFO        Cost: 22,137,046  Bytes: 841,672,559  Cardinality: 22,747,907       
                    10 INDEX RANGE SCAN INDEX EMPLOYEE_INFO_INDEX_ON_SITE   Cost: 50,419  Cardinality: 38,019,281     
            32 VIEW DONBOT_DBA
              31 UNION-ALL           
                15 FAST DUAL  Cost: 2  Cardinality: 1         
                16 FAST DUAL  Cost: 2  Cardinality: 1         
                17 FAST DUAL  Cost: 2  Cardinality: 1         
                18 FAST DUAL  Cost: 2  Cardinality: 1         
                19 FAST DUAL  Cost: 2  Cardinality: 1         
                20 FAST DUAL  Cost: 2  Cardinality: 1         
                21 FAST DUAL  Cost: 2  Cardinality: 1         
                22 FAST DUAL  Cost: 2  Cardinality: 1         
                23 FAST DUAL  Cost: 2  Cardinality: 1         
                24 FAST DUAL  Cost: 2  Cardinality: 1         
                25 FAST DUAL  Cost: 2  Cardinality: 1         
                26 FAST DUAL  Cost: 2  Cardinality: 1         
                27 FAST DUAL  Cost: 2  Cardinality: 1         
                28 FAST DUAL  Cost: 2  Cardinality: 1         
                29 FAST DUAL  Cost: 2  Cardinality: 1         
                30 FAST DUAL  Cost: 2  Cardinality: 1          Next, one with the parallel hint:
    INSERT STATEMENT  ALL_ROWS                                                                              Cost: 26,507,111  Bytes: 114  Cardinality: 1                                       
      51 LOAD AS SELECT EMPLOYEES_BY_AGE_GROUP
        50 PX COORDINATOR                                          
          49 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10005 :Q1005                                     Cost: 26,507,111  Bytes: 114  Cardinality: 1                                 
            48 HASH GROUP BY PARALLEL_COMBINED_WITH_PARENT :Q1005                                           Cost: 26,507,111  Bytes: 114  Cardinality: 1                               
              47 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1005                                            Cost: 26,507,111  Bytes: 114  Cardinality: 1                             
                46 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10004 :Q1004                                    Cost: 26,507,111  Bytes: 114  Cardinality: 1                           
                  45 HASH GROUP BY PARALLEL_COMBINED_WITH_PARENT :Q1004                                     Cost: 26,507,111  Bytes: 114  Cardinality: 1                         
                    44 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1004                                    Cost: 26,507,111  Bytes: 114  Cardinality: 1                       
                      25 HASH JOIN PARALLEL_COMBINED_WITH_PARENT :Q1004                                     Cost: 26,507,109  Bytes: 108  Cardinality: 1                     
                        17 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004                                  Cost: 4,301,500  Bytes: 4,104  Cardinality: 72                   
                          16 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10003 :Q1003                          Cost: 4,301,500  Bytes: 4,104  Cardinality: 72                 
                            15 HASH JOIN PARALLEL_COMBINED_WITH_PARENT :Q1003                               Cost: 4,301,500  Bytes: 4,104  Cardinality: 72               
                              7 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1003           
                                6 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1003                           Cost: 4,293,939  Bytes: 1,809  Cardinality: 67           
                                  5 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10000                     Cost: 4,293,939  Bytes: 1,809  Cardinality: 67         
                                    4 VIEW DONBOT_DBA.                                                      Cost: 4,293,939  Bytes: 1,809  Cardinality: 67       
                                      3 SORT GROUP BY                                                       Cost: 4,293,939  Bytes: 2,077  Cardinality: 67     
                                        2 TABLE ACCESS BY INDEX ROWID TABLE PAY_INFO                        Cost: 4,293,938  Bytes: 2,077  Cardinality: 67   
                                          1 INDEX RANGE SCAN INDEX PAY_INFO_INDEX_ON_SITE                   Cost: 487,124  Cardinality: 199,756,151 
                              14 VIEW PARALLEL_COMBINED_WITH_PARENT DONBOT_DBA. :Q1003                      Cost: 7,561  Bytes: 29,625,180  Cardinality: 987,506             
                                13 WINDOW SORT PUSHED RANK PARALLEL_COMBINED_WITH_PARENT :Q1003             Cost: 7,561  Bytes: 35,550,216  Cardinality: 987,506           
                                  12 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1003                        Cost: 7,561  Bytes: 35,550,216  Cardinality: 987,506         
                                    11 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10002 :Q1002                Cost: 7,561  Bytes: 35,550,216  Cardinality: 987,506       
                                      10 WINDOW CHILD PUSHED RANK PARALLEL_COMBINED_WITH_PARENT :Q1002      Cost: 7,561  Bytes: 35,550,216  Cardinality: 987,506     
                                        9 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002             Cost: 7,557  Bytes: 35,550,216  Cardinality: 987,506   
                                          8 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT EMPLOYEE_BIRTHDATES :Q1002     Cost: 7,557  Bytes: 35,550,216  Cardinality: 987,506 
                        24 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1004                 
                          23 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004                                Cost: 22,205,605  Bytes: 575,504,145  Cardinality: 11,284,395                 
                            22 PX SEND HASH PARALLEL_FROM_SERIAL SYS.:TQ10001                               Cost: 22,205,605  Bytes: 575,504,145  Cardinality: 11,284,395               
                              21 VIEW DONBOT_DBA.                                                           Cost: 22,205,605  Bytes: 575,504,145  Cardinality: 11,284,395             
                                20 WINDOW SORT                                                              Cost: 22,205,605  Bytes: 417,522,615  Cardinality: 11,284,395           
                                  19 TABLE ACCESS BY INDEX ROWID TABLE EMPLOYEE_INFO                        Cost: 22,137,046  Bytes: 417,522,615  Cardinality: 11,284,395         
                                    18 INDEX RANGE SCAN INDEX EMPLOYEE_INFO_INDEX_ON_SITE                   Cost: 50,419  Cardinality: 18,859,958       
                      43 VIEW PARALLEL_COMBINED_WITH_PARENT DONBOT_DBA. :Q1004                              Cost: 32  Bytes: 6  Cardinality: 1                     
                        42 UNION-ALL PARALLEL_COMBINED_WITH_PARENT :Q1004                 
                          26 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          27 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          28 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          29 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          30 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          31 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          32 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          33 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          34 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          35 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          36 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          37 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          38 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          39 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          40 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          41 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                  Finally, one without the parallel hint, and without the index hint on PAY_TABLE:
    INSERT STATEMENT  ALL_ROWS                                              Cost: 23,348,654  Bytes: 114  Cardinality: 1                   
      34 LOAD AS SELECT ARMYMP.EMPLOYEES_BY_AGE                
        33 HASH GROUP BY                                                    Cost: 23,348,654  Bytes: 114  Cardinality: 1               
          32 NESTED LOOPS                                                   Cost: 23,348,653  Bytes: 114  Cardinality: 1             
            13 HASH JOIN                                                    Cost: 23,348,621  Bytes: 108  Cardinality: 1           
              8 MERGE JOIN                                                  Cost: 1,073,202  Bytes: 8,322  Cardinality: 146         
                3 VIEW DONBOT_DBA.                                          Cost: 114,863  Bytes: 29,625,180  Cardinality: 987,506       
                  2 WINDOW SORT PUSHED RANK                                 Cost: 114,863  Bytes: 35,550,216  Cardinality: 987,506     
                    1 TABLE ACCESS FULL TABLE EMPLOYEE_BIRTHDATES           Cost: 108,983  Bytes: 35,550,216  Cardinality: 987,506   
                7 SORT JOIN                                                 Cost: 958,339  Bytes: 3,645  Cardinality: 135       
                  6 VIEW DONBOT_DBA.                                        Cost: 958,338  Bytes: 3,645  Cardinality: 135     
                    5 SORT GROUP BY                                         Cost: 958,338  Bytes: 4,185  Cardinality: 135   
                      4 TABLE ACCESS FULL TABLE PAY_INFO                    Cost: 958,337  Bytes: 4,185  Cardinality: 135 
              12 VIEW DONBOT_DBA.                                           Cost: 22,275,300  Bytes: 1,160,143,257  Cardinality: 22,747,907         
                11 WINDOW SORT                                              Cost: 22,275,300  Bytes: 841,672,559  Cardinality: 22,747,907       
                  10 TABLE ACCESS BY INDEX ROWID TABLE EMPLOYEE_INFO        Cost: 22,137,046  Bytes: 841,672,559  Cardinality: 22,747,907     
                    9 INDEX RANGE SCAN INDEX EMPLOYEE_INFO_UIC              Cost: 50,419  Cardinality: 38,019,281   
            31 VIEW DONBOT_DBA.                                             Cost: 32  Bytes: 6  Cardinality: 1           
              30 UNION-ALL         
                14 FAST DUAL  Cost: 2  Cardinality: 1       
                15 FAST DUAL  Cost: 2  Cardinality: 1       
                16 FAST DUAL  Cost: 2  Cardinality: 1       
                17 FAST DUAL  Cost: 2  Cardinality: 1       
                18 FAST DUAL  Cost: 2  Cardinality: 1       
                19 FAST DUAL  Cost: 2  Cardinality: 1       
                20 FAST DUAL  Cost: 2  Cardinality: 1       
                21 FAST DUAL  Cost: 2  Cardinality: 1       
                22 FAST DUAL  Cost: 2  Cardinality: 1       
                23 FAST DUAL  Cost: 2  Cardinality: 1       
                24 FAST DUAL  Cost: 2  Cardinality: 1       
                25 FAST DUAL  Cost: 2  Cardinality: 1       
                26 FAST DUAL  Cost: 2  Cardinality: 1       
                27 FAST DUAL  Cost: 2  Cardinality: 1       
                28 FAST DUAL  Cost: 2  Cardinality: 1       
                29 FAST DUAL  Cost: 2  Cardinality: 1        I am surprised the cost without the index is less than the cost with it, considering that it is replacing a Table Access By Index Rowid with a Table Access Full on a table with 1 billion (1000 million) records.
    Igor - two questions:
    One - I cannot find "Materialize" in the hints in the SQL Reference anywhere. What does it do?
    Two - does replacing subqueries with With clauses make that much of a difference?

  • Mismatch query not working. Not sure what I did wrong.

    In my query, I have created two CTE's. One pulls in the records of all people who are assigned to an audience. The other pulls in all people who are assigned to the same audience AND completed a certain course.
    What I wanted to do from there, was to do a mismatch query, not to find the PEOPLE, but just the departments that were represented in the audience, but had no people in the list of those who completed the course. (In other words, say the HR Department had
    three people in the audience... two completed the course, one did not. The HR Department should NOT show up in my mismatch query because some of their people completed the course. Then, say the IT Department had five people in the audience, and none of them
    have completed the course. The IT Department SHOULD show up in my mismatch query. For this case, I don't care about the people who didn't complete it, just the departments where nobody did yet.)
    I thought I was doing the mismatch query correctly, but I guess I must not. I will share the relevant parts of my query below (there is more to my query, but I don't think you necessarily need to see it to assist with this particular problem). (Side note:
    Yes, I know the way I am doing the fiscal calendar is not ideal, but I've looked up other ways to do it, and do not understand it. Given time, I can break it down and understand it, but I am in a rush to finish this report.)
    gm101certtbl
    AS
    select
    dimUser.EmpFK MeasureEmpFK,
    RIGHT(OrgCode2, LEN(OrgCode2) - 2) MeasurePC,
    audusersName MeasureAudName,
    dimActivity.ActivityName MeasureActName,
    dimActivity.Code MeasureActCode,
    CASE
    WHEN OrgCode2 LIKE 'US%' then 'US'
    WHEN OrgCode2 LIKE 'CA%' then 'CA' END
    CountryCode,
    'ACTUALS_GM101' SOURCESYSTEMID,
    Null CURRENCYCODE,
    'GM101CERT' MEASUREID,
    Null MEASUREDOLLARS,
    CASE
    WHEN GETDATE() Between '20131001 00:00:00' AND '20140930 11:59:59' THEN '2014'
    WHEN GETDATE() Between '20141001 00:00:00' AND '20150930 11:59:59' THEN '2015'
    WHEN GETDATE() Between '20151001 00:00:00' AND '20160930 11:59:59' THEN '2016'
    WHEN GETDATE() Between '20161001 00:00:00' AND '20170930 11:59:59' THEN '2017' END
    FiscalYear,
    CASE
    WHEN MONTH(GETDATE()) = '10' THEN '1'
    WHEN MONTH(GETDATE()) = '11' THEN '2'
    WHEN MONTH(GETDATE()) = '12' THEN '3'
    WHEN MONTH(GETDATE()) = '1' THEN '4'
    WHEN MONTH(GETDATE()) = '2' THEN '5'
    WHEN MONTH(GETDATE()) = '3' THEN '6'
    WHEN MONTH(GETDATE()) = '4' THEN '7'
    WHEN MONTH(GETDATE()) = '5' THEN '8'
    WHEN MONTH(GETDATE()) = '6' THEN '9'
    WHEN MONTH(GETDATE()) = '7' THEN '10'
    WHEN MONTH(GETDATE()) = '8' THEN '11'
    WHEN MONTH(GETDATE()) = '9' THEN '12' END
    FiscalMonthNbr
    from
    dimUser INNER JOIN
    audusers ON audusers.DataSetUsers_EmpFK = dimUser.EmpFK INNER JOIN
    Org ON dimUser.PrimaryDomFK = Org.Org_PK INNER JOIN
    factUserRequiredActivity ON factUserRequiredActivity.UserID = dimUser.ID INNER JOIN
    dimActivity ON dimActivity.ID = factUserRequiredActivity.ActivityID INNER JOIN
    dimRequirementStatus ON factUserRequiredActivity.ReqStatusID = dimRequirementStatus.ID LEFT OUTER JOIN
    UsrOrgs ON dimUser.ID = UsrOrgs.UserID LEFT OUTER JOIN
    UsrDoms ON dimUser.ID = UsrDoms.UserID
    WHERE
    dimActivity.ActivityName = 'GM101 Program Completion'
    AND
    dimRequirementStatus.name = 'Satisfied'
    AND
    (audusersName = @audparam)
    gm101availtbl
    AS
    select
    dimUser.EmpFK MeasureEmpFK,
    RIGHT(OrgCode2, LEN(OrgCode2) - 2) MeasurePC,
    audusersName MeasureAudName,
    Null MeasureActName,
    Null MeasureActCode,
    CASE
    WHEN OrgCode2 LIKE 'US%' then 'US'
    WHEN OrgCode2 LIKE 'CA%' then 'CA' END
    CountryCode,
    'ACTUALS_GM101' SOURCESYSTEMID,
    Null CURRENCYCODE,
    'GM101AVAIL' MEASUREID,
    Null MEASUREDOLLARS,
    CASE
    WHEN GETDATE() Between '20131001 00:00:00' AND '20140930 11:59:59' THEN '2014'
    WHEN GETDATE() Between '20141001 00:00:00' AND '20150930 11:59:59' THEN '2015'
    WHEN GETDATE() Between '20151001 00:00:00' AND '20160930 11:59:59' THEN '2016'
    WHEN GETDATE() Between '20161001 00:00:00' AND '20170930 11:59:59' THEN '2017' END
    FiscalYear,
    CASE
    WHEN MONTH(GETDATE()) = '10' THEN '1'
    WHEN MONTH(GETDATE()) = '11' THEN '2'
    WHEN MONTH(GETDATE()) = '12' THEN '3'
    WHEN MONTH(GETDATE()) = '1' THEN '4'
    WHEN MONTH(GETDATE()) = '2' THEN '5'
    WHEN MONTH(GETDATE()) = '3' THEN '6'
    WHEN MONTH(GETDATE()) = '4' THEN '7'
    WHEN MONTH(GETDATE()) = '5' THEN '8'
    WHEN MONTH(GETDATE()) = '6' THEN '9'
    WHEN MONTH(GETDATE()) = '7' THEN '10'
    WHEN MONTH(GETDATE()) = '8' THEN '11'
    WHEN MONTH(GETDATE()) = '9' THEN '12' END
    FiscalMonthNbr
    from
    dimUser INNER JOIN
    audusers ON audusers.DataSetUsers_EmpFK = dimUser.EmpFK INNER JOIN
    Org ON dimUser.PrimaryDomFK = Org.Org_PK LEFT OUTER JOIN
    UsrOrgs ON dimUser.ID = UsrOrgs.UserID LEFT OUTER JOIN
    UsrDoms ON dimUser.ID = UsrDoms.UserID
    WHERE
    audusersName = @audparam
    missingPC
    AS
    select distinct
    NULL MeasureEmpFK,
    gm101availtbl.MeasurePC,
    gm101availtbl.MeasureAudName,
    gm101availtbl.MeasureActName,
    gm101availtbl.MeasureActCode,
    gm101availtbl.CountryCode,
    gm101availtbl.SOURCESYSTEMID,
    gm101availtbl.CURRENCYCODE,
    'GM101CERT' MEASUREID,
    gm101availtbl.MEASUREDOLLARS,
    gm101availtbl.FiscalYear,
    gm101availtbl.FiscalMonthNbr
    from
    gm101availtbl LEFT OUTER JOIN
    gm101certtbl on gm101certtbl.MeasurePC = gm101availtbl.MeasurePC
    WHERE gm101certtbl.MeasurePC IS NULL
    If anybody can help, I would greatly appreciate it. I'm trying to do this so I can pull these records into a final table to count the records from the other two, but then include these as a 0 count where these departments have nobody certified.
    To test if this was working, I created a query using this Mismatch query instead as the main query. Instead, it seemed to give me the exact opposite. It seemed to be giving me all of the Departments (MeasurePC) where the records were represented.

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. We have no sample data, so we cannot even guess. 
    >> In my query, I have created two CTE's. One pulls in the records [sic] of all people who are assigned to an audience. The other pulls in all people who are assigned to the same audience AND completed a certain course. <<
    Please, please learn the basic terms. Rows are not records. And THEN learn what “redundancy” means so you will not write two CTEs in the future. 
    >> What I wanted to do from there, was to do a mismatch query, not to find the PEOPLE, but just the departments that were represented in the audience, but had no people in the list of those who completed the course. (In other words, say the HR Department
    had three people in the audience... two completed the course, one did not. The HR Department should NOT show up in my mismatch query because some of their people completed the course. THEN, say the IT Department had five people in the audience, and none of
    them have completed the course. The IT Department SHOULD show up in my mismatch query. For this case, I don't care about the people who didn't complete it, just the departments where nobody did yet.) <<
    This is a Relational Division. It is one of Dr. Codd's original 8 operations. 
    We do not use the Sybase CURRENT_TIMESTAMP any more. We have DATE data types tody, rtoo. We never tibble in good code; it is a design flaw that used meta-data affixes like “tbl” in schema object _names, PK in column _names, etc. We do not have repeated groups
    like “org_code_2”; we do not use arrays in RDBMS. Why is your data so screwed up you have use 
    CASE 
    WHEN org_code2 LIKE 'US%' THEN 'US'
    WHEN org_code2 LIKE 'CA%' THEN 'CA' END 
    to clean it up in a query; the DDL should have prevented this problem. 
    Why are you doing calendar computing in your query? Where is the Calendar table? 
    “Users.id = UsrOrgs.user_id” says that you have magic, generic “id” that can change its name from table to table. Likewise, a generic, magic “code”, etc. What might be even worse is that totally different data elements have the same name! “Automobiles, squids
    and Lady Gaga” programming is not RDBMS. 
    You have never heard of ISO-11179 and data modeling? 
    Here is a skeleton for fiscal calendar table to replace your current row by row temporal math: 
    CREATE TABLE Calendar 
    (cal_date DATE NOT NULL PRIMARY KEY, 
     fiscal_month CHAR(10) NOT NULL,
    INSERT INTO  Calendar
    VALUES 
    ('2014-10-01', '2015-01-00', ..), 
    ('2014-09-30', '2015-12-00', ..), 
    You can use a spread sheet and a text edit to fill in the table for 50 or 100 years. 
    I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601 data format required by Standard SQL and it is
    language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

Maybe you are looking for

  • Calling Business Rules in Biztalk Mapper Extension

    Hi, We have BizTalk map which uses Custom XSLT & Custom extension xml. From the mapper extension class file we are executing policy like below. public string GetQRDAInfo_MeasureGuid(string pMeasureId) {        return CallQRDA_GUID(pMeasureId).CnefMea

  • Connecting MacBook Pro to Projector

    First - I am new to mac, so I think the answer to my question is probably a simple one, but I am just not sure where I can fix this. I want to connect my MBP to a projector, but when I do this, the only information displayed/sent to the projector is

  • Clementine cannot open MTP device

    Hey guys, I am trying to sync dynamic playlists of my favourite music to my Android device so I decided to try Clementine. When I connect my Android (GT-I9300) it does show up under 'devices' but will not 'connect' and browse the device. kaipee@zoost

  • Why do I have to change my plan when I switch my device?

    My IPhone 4s isn't working at all and I was told I could temporarily switch to another device. I am switching to a basic phone. When I proceed online to switch the device, it tells me I have to switch plans as well. I don't need more data, but I do n

  • ITunes not recognising iPad on Windows 7

    I am fed up with windows asking me what to do when I attach a device. So this morning I went into control panel and changed things to "take no action". But when I attached my iPad afterwards it was not showing up in iTunes. So I tried all the usual..