Wednesday, March 02, 2011

test Smart Scan with CELL_OFFLOAD_PROCESSING parameter

Read Exadata Part I: Smart Scan (by UWE HESSE), hope to see more about Smart Scan Performance and then test... this idea use CELL_OFFLOAD_PROCESSING parameter.
CELL_OFFLOAD_PROCESSING initialization parameter enables SQL processing offload to Exadata Cell (default value is TRUE).
*** "sales" table has 20000000 rows ***
Test count(*) data:
SQL> alter session set cell_offload_processing=FALSE;

Session altered.

SQL> select count(*) from sales;

COUNT(*)
----------
20000000

Elapsed: 00:00:08.01

SQL> alter session set cell_offload_processing=TRUE;

Session altered.

SQL> select count(*) from sales;

COUNT(*)
----------
20000000

Elapsed: 00:00:00.46
Test to query data (no index):
SQL> alter session set cell_offload_processing=FALSE;

Session altered.

SQL> select * from sales where id=4731;

ID FLAG PRODUCT CHANNEL_ID CUST_ID AMOUNT_SOLD ORDER_DAT SHIP_DATE
---------- ---------- ------------------------- ---------- ---------- ----------- --------- ---------
4731 4732 Oracle Enterprise Edition 1 731 5000 27-SEP-96 28-SEP-96

Elapsed: 00:00:08.15

SQL> explain plan for select * from sales where id=4732;

Explained.

SQL> SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 781590677
-----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 2090 | 224K| 51614 (1)| 00:10:20 |
|* 1 | TABLE ACCESS STORAGE FULL| SALES | 2090 | 224K| 51614 (1)| 00:10:20 |
-----------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("ID"=4732)
Note
-----
- dynamic sampling used for this statement (level=2)
Spent time 08.15 seconds.
SQL> alter session set cell_offload_processing=TRUE;

Session altered.

SQL> select * from sales where id=4730;

ID FLAG PRODUCT CHANNEL_ID CUST_ID AMOUNT_SOLD ORDER_DAT SHIP_DATE
---------- ---------- ------------------------- ---------- ---------- ----------- --------- ---------
4730 4731 Oracle Enterprise Edition 0 730 5000 26-SEP-96 27-SEP-96

Elapsed: 00:00:00.29

SQL> explain plan for select * from sales where id=4733;

Explained.

SQL> SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 781590677
-----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 2090 | 224K| 51614 (1)| 00:10:20 |
|* 1 | TABLE ACCESS STORAGE FULL| SALES | 2090 | 224K| 51614 (1)| 00:10:20 |
-----------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - storage("ID"=4733)
filter("ID"=4733)
Note
-----
- dynamic sampling used for this statement (level=2)
Spent time 00.29 seconds.

How do we know Oracle use SQL processing offload to Exadata Cell ?
- On Explain plan: we will see storage("ID"=...) but can not tell that query used SMART SCAN... have to trace event 10046 !!!
However, if "cell_offload_plan_display"=NEVER.
SQL Processing offload to Exadata Cell does not display on explain plan.

What operations benefit from Smart Scan?
- Full scan of a heap table
- Fast full scan of a B-Tree or bitmap index

Which function can we be offload to the Exadata?
- Check from query
select * from v$sqlfn_metadata where offloadable='YES';

No comments: