05.11.2015 Views

Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 14 ■ PARALLEL EXECUTION 619<br />

6,000,000<br />

12,000,000<br />

Figure 14-1. Parallel select count (status) depiction<br />

We can see this in an explain plan. Using a BIG_TABLE with 10 million rows in it, we’ll walk<br />

through enabling a parallel query for that table <strong>and</strong> discover how we can “see” parallel query<br />

in action. This example was performed on a four-CPU machine with default values for all<br />

parallel parameters; that is, this is an out-of-the-box installation where only necessary parameters<br />

were set, including SGA_TARGET (set to 1GB), CONTROL_FILES, DB_BLOCK_SIZE (set to 8KB),<br />

<strong>and</strong> PGA_AGGREGATE_TARGET (set to 512MB). Initially, we would expect to see the following plan:<br />

big_table@ORA10GR1> explain plan for<br />

2 select count(status) from big_table;<br />

Explained.<br />

big_table@ORA10GR1> select * from table(dbms_xplan.display);<br />

PLAN_TABLE_OUTPUT<br />

----------------------------------------<br />

Plan hash value: 1287793122<br />

----------------------------------------------------------------------------<br />

| Id | Operation | Name | Rows|Bytes | Cost (%CPU)|Time |<br />

----------------------------------------------------------------------------<br />

| 0 | SELECT STATEMENT | | 1 | 17 | 32390 (2)|00:06:29 |<br />

| 1 | SORT AGGREGATE | | 1 | 17 | | |<br />

| 2 | TABLE ACCESS FULL| BIG_TABLE | 10M| 162M| 32390 (2)|00:06:29 |<br />

----------------------------------------------------------------------------

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

Saved successfully!

Ooh no, something went wrong!