10.07.2015 Views

Expert Oracle Exadata - Parent Directory

Expert Oracle Exadata - Parent Directory

Expert Oracle Exadata - Parent Directory

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 13 MIGRATING TO EXADATAIssue 1—Making Sure the Data Load Is Performed in ParallelThe problem here is that while parallel Query and DDL are enabled by default for any session, theparallel DML is not. Therefore, parallel CTAS statements will run in parallel from end to end, but theloading part of parallel IAS statements will be done in serial! The query part (SELECT) will be performed inparallel, as the slaves pass the data to the single Query Coordinator and the QC is the single process,which is doing the data loading (including the CPU-intensive compression).This problem is simple to fix, though; you’ll just need to enable parallel DML in your session. Let’scheck the parallel execution flags in our session first:SQL> SELECT pq_status, pdml_status, pddl_status, pdml_enabled2> FROM v$session WHERE sid = SYS_CONTEXT('userenv','sid');PQ_STATUS PDML_STATUS PDDL_STATUS PDML_ENABLED--------- ----------- ----------- ---------------ENABLED DISABLED ENABLED NOThe parallel DML is disabled in the current session. The PDML_ENABLED column is there for backwardcompatibility. Let’s enable PDML:SQL> ALTER SESSION ENABLE PARALLEL DML;Session altered.SQL> SELECT pq_status, pdml_status, pddl_status, pdml_enabled2> FROM v$session WHERE sid = SYS_CONTEXT('userenv','sid');PQ_STATUS PDML_STATUS PDDL_STATUS PDML_ENABLED--------- ----------- ----------- ---------------ENABLED ENABLED ENABLED YESAfter enabling parallel DML, the INSERT AS SELECTs are able to use parallel slaves for the loadingpart of the IAS statements.Here’s one important thing to watch out for, regarding parallel inserts. In the next example we havestarted a new session (thus the PDML is disabled in it), and we’re issuing a parallel insert statement. Wehave added a “statement-level” PARALLEL hint into both insert and query blocks, and the explainedexecution plan output (the DBMS_XPLAN package) shows us that parallelism is used. However, thisexecution plan would be very slow loading into a compressed table, as the parallelism is enabled only forthe query (SELECT) part, not the data loading part!Pay attention to where the actual data loading happens—in the LOAD AS SELECT operator in theexecution plan tree. This LOAD AS SELECT, however, resides above the PX COORDINATOR row source (this isthe row source that can pull rows and other information from slaves into QC). Also, in line 3 you see theP->S operator, which means that any rows passed up the execution plan tree from line 3 are received bya serial process (QC).436

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!