SlideShare une entreprise Scribd logo
1  sur  7
Exadata - SMART SCAN testing
-------------------------------------------Samrt scan works with cell offloading which relate to offloaded the sql processing from the database layer to the
cell (storage) layer.
Smart scan is the access mechanism to offload data from storage layer. For example passing only required data
blocks after applying predicate filters at the cell layer instead of sending every possible blocks from cell server
to database server.
Flash current buffer cache
====================
alter system flush buffer_cache;
Create a table for testing
=======================
create table sales_SM_SC as
select
mod(rownum,5) as channel_id,
mod(rownum,1000) as cust_id ,
5000 as amount_sold,
to_date
('01.' || lpad(to_char(mod(rownum,12)+1),2,'0') || '.2007' ,'dd.mm.yyyy')
as time_id
from dual connect by level<=2e4;
Check the table size
=================
SQL> select bytes/1024/1024 as SizeMB from user_segments where segment_name='SALES_SM_SC';
SIZEMB
---------.5625
SQL> alter table sales nologging;
Table altered.
Insert data
============
insert /*+ append */ into sales_SM_SC select
channel_id, cust_id,amount_sold, time_id
from sales;
12399984 rows created.
/
12399984 rows created.
SQL> commit;
Commit complete.
SQL> select bytes/1024/1024 as SizeMB from user_segments where segment_name='SALES_SM_SC';
SIZEMB
---------656
Gather Statistics
==============
SQL> exec dbms_stats.gather_table_stats('SH','SALES_SM_SC')
SQL>
PL/SQL procedure successfully completed.

Check the Query Processing speed without Smart Scan:
--------------------------------------------------------------------SQL> alter session set cell_offload_processing=false;
Session altered.
--------------------------------------------------------------------------------------------------------------------------------------NOTE : Inside the SQL statement optimizer hint to disables Smart Scan for the query
select /*+ OPT_PARAM('cell_offload_processing' 'false') */ count(*) from SALES_SM_SC where
channel_id=1
------------------------------------------------------------------------------------------------------ --------------------------------SQL> set timing on
select /* NO_SMART_SCAN */ count(*) from SALES_SM_SC where channel_id=1;
SQL>
COUNT(*)
---------4000
Elapsed: 00:00:16.19
SQL> /
COUNT(*)
---------4000
Elapsed: 00:00:15.68

WIth Smart Scan:
---------------------SQL> set timing off;
SQL> alter session set cell_offload_processing=true;
Session altered.
SQL> set timing on
SQL> select /* WITH_SMART_SCAN */ count(*) from SALES_SM_SC where channel_id=1;
COUNT(*)
---------4000
Elapsed: 00:00:23.75
SQL> /
COUNT(*)
---------4000
Elapsed: 00:00:00.05
Note: Without cell_offload_processing query took 15:68 seconds where with cell_offload_processing
it took 00:05 seconds.
Query to check Predicate offload and smart scan
---------------------------------------------------------------SQL> select a.name, b.value/1024/1024 MB
2 from v$sysstat a, v$mystat b
3 where a.statistic# = b.statistic# and
4 (a.name in ('physical read total bytes',
5
'physical write total bytes',
6
'cell IO uncompressed bytes')
7 or a.name like 'cell phy%');
NAME
MB
---------------------------------------------------------------- ---------physical read total bytes
53.0703125
physical write total bytes
0
cell physical IO interconnect bytes
.188957214
cell physical IO bytes sent directly to DB node to balanceCPU u
0
cell physical IO bytes saved during optimized file creation
0
cell physical IO bytes saved during optimized RMAN file restore
0
cell physical IO bytes eligible for predicate offload
53.0625
cell physical IO bytes saved by storage index
0
cell physical IO interconnect bytes returned by smart scan
.181144714
cell IO uncompressed bytes
53.0625
10 rows selected.
So query is getting almost every blocks from predicate offload. Smart scan is required to get only 0.18MB data.
Explain Plan for Without SMART_SCAN
-----------------------------------SQL> set timing off;
SQL> select sql_id from v$sql where sql_text like '%NO_SMART_SCAN%' and sql_text not like '%like%';
SQL_ID
------------9fmuwnmmrvapv
SQL> select plan_table_output from table (dbms_xplan.display_cursor('9fmuwnmmrvapv'));
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------SQL_ID 9fmuwnmmrvapv, child number 0
------------------------------------select /* NO_SMART_SCAN */ count(*) from SALES_SM_SC where channel_id=1
Plan hash value: 1381054164
-----------------------------------------------------------------------------------------| Id | Operation

| Name

| Rows | Bytes | Cost (%CPU)| Time

-----------------------------------------------------------------------------------------| 0 | SELECT STATEMENT
| 1 | SORT AGGREGATE

|
|

|
|

|
1|

| 22874 (100)|
3|

|

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

|
|

|
|* 2 | TABLE ACCESS STORAGE FULL| SALES_SM_SC | 3545K| 10M| 22874 (2)|00:04:35 |
------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
--------------------------------------------------2 - filter("CHANNEL_ID"=1)

19 rows selected.

Explain Plan for SMART SCAN
----------------------------------------SQL> SQL> select sql_id from v$sql where sql_text like '%WITH_SMART_SCAN%' and sql_text not like
'%like%';
SQL_ID
------------8rb96afm261ry
SQL> select plan_table_output from table (dbms_xplan.display_cursor('&SQLID'));
Enter value for sqlid: 8rb96afm261ry
old 1: select plan_table_output from table (dbms_xplan.display_cursor('&SQLID'))
new 1: select plan_table_output from table (dbms_xplan.display_cursor('8rb96afm261ry'))
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------SQL_ID 8rb96afm261ry, child number 0
------------------------------------select /* WITH_SMART_SCAN */ count(*) from SALES_SM_SC where
channel_id=1
Plan hash value: 1381054164
-----------------------------------------------------------------------------------------| Id | Operation

| Name

| Rows | Bytes | Cost (%CPU)|Time

|

-----------------------------------------------------------------------------------------| 0 | SELECT STATEMENT
| 1 | SORT AGGREGATE

|
|

|
|

|
1|

| 22874 (100)|
3|

|

|
|

PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------|* 2 | TABLE ACCESS STORAGE FULL| SALES_SM_SC | 3545K| 10M| 22874 (2)|00:04:35 |
------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
--------------------------------------------------2 - storage("CHANNEL_ID"=1)
filter("CHANNEL_ID"=1)

21 rows selected.
NOTE: The Storage Layer did filter on the predicate channel_id=1 before transmitting the result to the
Database Layer, which is the reason for the reduced runtime.
---------------------------------------2nd Example SMART SCAN
--------------------------------------SQL> conn sh/sh
Connected.
SQL> set autotrace on
SQL> set timing on
SQL> select count (*) from customers where cust_valid='B';
COUNT(*)
---------0
Elapsed: 00:00:07.08
Execution Plan
---------------------------------------------------------Plan hash value: 296924608
-------------------------------------------------------------------------------| Id | Operation
| Name
| Rows | Bytes | Cost (%CPU)| Time

|

-------------------------------------------------------------------------------| 0 | SELECT STATEMENT
|
| 1 | 2 | 10245 (1)| 00:02:03 |
| 1 | SORT AGGREGATE

|

|

1|

2|

|

|

|* 2 | TABLE ACCESS STORAGE FULL| CUSTOMERS | 65588 | 128K| 10245 (1)| 00:02:03 |
-------------------------------------------------------------------------------Predicate Information (identified by operation id):
--------------------------------------------------2 - storage("CUST_VALID"='B')
filter("CUST_VALID"='B')

Statistics
---------------------------------------------------------1 recursive calls
0 db block gets
36884 consistent gets
36880 physical reads
0 redo size
525 bytes sent via SQL*Net to client
519 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> set autotrace off
SQL> select a.name, b.value/1024/1024 MB
from v$sysstat a, v$mystat b
where a.statistic# = b.statistic# and
(a.name in ('physical read total bytes',
'physical write total bytes',
'cell IO uncompressed bytes')
or a.name like 'cell phy%');
NAME
MB
---------------------------------------------------------------- ---------physical read total bytes
288.25
physical write total bytes
0
cell physical IO interconnect bytes
.222740173
cell physical IO bytes sent directly to DB node to balanceCPU u
0
cell physical IO bytes saved during optimized file creation
0
cell physical IO bytes saved during optimized RMAN file restore
0
cell physical IO bytes eligible for predicate offload
288.070313
cell physical IO bytes saved by storage index
0
cell physical IO interconnect bytes returned by smart scan
.043052673
cell IO uncompressed bytes
288.070313
10 rows selected.
Elapsed: 00:00:00.01
SQL>
select distinct event, total_waits, time_waited/100 wait_secs, average_wait/100 avgwait_secs
from v$session_event e, v$mystat s
where event like 'cell%' and e.sid=s.sid;SQL> 2 3
EVENT
TOTAL_WAITS WAIT_SECS AVGWAIT_SECS
---------- ---------------------------------------------------------------cell single block physical read
52
.59
.0113
cell multiblock physical read
1
.02
.0217
cell smart table scan
191
6.96
.0364
Elapsed: 00:00:00.50
Open another Session, update the query without commit:
+++++++++++++++++++++++++++++++++++++++++++++
SQL> update customers
2 set cust_credit_limit=1.5*cust_credit_limit
3 where cust_id > 500000;
Go to first session
-------------------SQL> select count (*) from customers where cust_valid='B';
COUNT(*)
---------0
Elapsed: 00:01:43.12 ======> Finding1 (more time to get query output)
AME
MB
---------------------------------------------------------------- ---------physical read total bytes
607.484375
physical write total bytes
0
cell physical IO interconnect bytes
186.811409 ---->find2: more data to interconnect
cell physical IO bytes sent directly to DB node to balanceCPU u
0
cell physical IO bytes saved during optimized file creation
0
cell physical IO bytes saved during optimized RMAN file restore
0
cell physical IO bytes eligible for predicate offload
576.140625
cell physical IO bytes saved by storage index
0
cell physical IO interconnect bytes returned by smart scan
155.467659 ---->find3: More data was returned
cell IO uncompressed bytes
576.140625
10 rows selected.
Elapsed: 00:00:00.07

SQL> select distinct event, total_waits, time_waited/100 wait_secs, average_wait/100 avgwait_secs
from v$session_event e, v$mystat s
where event like 'cell%' and e.sid=s.sid; 2 3
EVENT
TOTAL_WAITS WAIT_SECS AVGWAIT_SECS
---------- ---------------------------------------------------------------cell single block physical read
4009 89.91 ---> find4
.0224
[Wait is more than .59sec]
cell multiblock physical read
cell smart table scan

1
375

.02

.0217

14.06

.0375

Elapsed: 00:00:00.14
Note: All because for uncommited transaction ---working as traditional buffer cache

Contenu connexe

Tendances

Oracle Diagnostics : Explain Plans (Simple)
Oracle Diagnostics : Explain Plans (Simple)Oracle Diagnostics : Explain Plans (Simple)
Oracle Diagnostics : Explain Plans (Simple)
Hemant K Chitale
 

Tendances (20)

Performance tuning a quick intoduction
Performance tuning   a quick intoductionPerformance tuning   a quick intoduction
Performance tuning a quick intoduction
 
Same plan different performance
Same plan different performanceSame plan different performance
Same plan different performance
 
Debunking myths about_redo_ppt
Debunking myths about_redo_pptDebunking myths about_redo_ppt
Debunking myths about_redo_ppt
 
Rac 12c optimization
Rac 12c optimizationRac 12c optimization
Rac 12c optimization
 
Dbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineersDbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineers
 
了解IO协议栈
了解IO协议栈了解IO协议栈
了解IO协议栈
 
pstack, truss etc to understand deeper issues in Oracle database
pstack, truss etc to understand deeper issues in Oracle databasepstack, truss etc to understand deeper issues in Oracle database
pstack, truss etc to understand deeper issues in Oracle database
 
Histograms in 12c era
Histograms in 12c eraHistograms in 12c era
Histograms in 12c era
 
Sql2
Sql2Sql2
Sql2
 
SQL Plan Directives explained
SQL Plan Directives explainedSQL Plan Directives explained
SQL Plan Directives explained
 
Checking clustering factor to detect row migration
Checking clustering factor to detect row migrationChecking clustering factor to detect row migration
Checking clustering factor to detect row migration
 
Full Table Scan: friend or foe
Full Table Scan: friend or foeFull Table Scan: friend or foe
Full Table Scan: friend or foe
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11g
 
Rmoug ashmaster
Rmoug ashmasterRmoug ashmaster
Rmoug ashmaster
 
Oracle Diagnostics : Explain Plans (Simple)
Oracle Diagnostics : Explain Plans (Simple)Oracle Diagnostics : Explain Plans (Simple)
Oracle Diagnostics : Explain Plans (Simple)
 
Px execution in rac
Px execution in racPx execution in rac
Px execution in rac
 
The Cost Based Optimiser in 11gR2
The Cost Based Optimiser in 11gR2The Cost Based Optimiser in 11gR2
The Cost Based Optimiser in 11gR2
 
A close encounter_with_real_world_and_odd_perf_issues
A close encounter_with_real_world_and_odd_perf_issuesA close encounter_with_real_world_and_odd_perf_issues
A close encounter_with_real_world_and_odd_perf_issues
 
SQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoSQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tango
 
Exadata Cell metrics
Exadata Cell metricsExadata Cell metrics
Exadata Cell metrics
 

En vedette

Advanced installation 12c rac
Advanced installation 12c racAdvanced installation 12c rac
Advanced installation 12c rac
Monowar Mukul
 
Oracle 12c far sync standby instance
Oracle 12c far sync standby instanceOracle 12c far sync standby instance
Oracle 12c far sync standby instance
Monowar Mukul
 
Copyright Crash Course 1st revised ppt 6340.64 Sonia Aldape
Copyright Crash Course 1st revised ppt 6340.64 Sonia AldapeCopyright Crash Course 1st revised ppt 6340.64 Sonia Aldape
Copyright Crash Course 1st revised ppt 6340.64 Sonia Aldape
soniaaldape
 
Oracle 12c RAC (Advanced installation - Flex ASM)
Oracle 12c RAC (Advanced installation - Flex ASM)Oracle 12c RAC (Advanced installation - Flex ASM)
Oracle 12c RAC (Advanced installation - Flex ASM)
Monowar Mukul
 
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
Monowar Mukul
 
Edtc6341 63 esther_sauceda_practice_test5
Edtc6341 63 esther_sauceda_practice_test5Edtc6341 63 esther_sauceda_practice_test5
Edtc6341 63 esther_sauceda_practice_test5
esauceda12
 

En vedette (20)

TimesTen in memory database Creation
TimesTen in memory database Creation TimesTen in memory database Creation
TimesTen in memory database Creation
 
Advanced installation 12c rac
Advanced installation 12c racAdvanced installation 12c rac
Advanced installation 12c rac
 
12c database migration from ASM storage to NON-ASM storage
12c database migration from ASM storage to NON-ASM storage12c database migration from ASM storage to NON-ASM storage
12c database migration from ASM storage to NON-ASM storage
 
Oracle 12c far sync standby instance
Oracle 12c far sync standby instanceOracle 12c far sync standby instance
Oracle 12c far sync standby instance
 
Copyright Crash Course 1st revised ppt 6340.64 Sonia Aldape
Copyright Crash Course 1st revised ppt 6340.64 Sonia AldapeCopyright Crash Course 1st revised ppt 6340.64 Sonia Aldape
Copyright Crash Course 1st revised ppt 6340.64 Sonia Aldape
 
Oracle 12c RAC (Advanced installation - Flex ASM)
Oracle 12c RAC (Advanced installation - Flex ASM)Oracle 12c RAC (Advanced installation - Flex ASM)
Oracle 12c RAC (Advanced installation - Flex ASM)
 
Exadata I/O Resource Manager (Exadata IORM)
Exadata I/O Resource Manager (Exadata IORM)Exadata I/O Resource Manager (Exadata IORM)
Exadata I/O Resource Manager (Exadata IORM)
 
SOA Fusion Middleware installation
SOA Fusion Middleware installationSOA Fusion Middleware installation
SOA Fusion Middleware installation
 
Moving 12c database from NON-ASM to ASM
Moving 12c database from NON-ASM to ASMMoving 12c database from NON-ASM to ASM
Moving 12c database from NON-ASM to ASM
 
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
 
Upgrade database using cloud_control Provisioning
Upgrade database using cloud_control Provisioning Upgrade database using cloud_control Provisioning
Upgrade database using cloud_control Provisioning
 
12c Flex ASM: Moving to Flex ASM
12c Flex ASM: Moving to Flex ASM12c Flex ASM: Moving to Flex ASM
12c Flex ASM: Moving to Flex ASM
 
Exadata - BULK DATA LOAD Testing on Database Machine
Exadata - BULK DATA LOAD Testing on Database Machine Exadata - BULK DATA LOAD Testing on Database Machine
Exadata - BULK DATA LOAD Testing on Database Machine
 
Edtc6341 63 esther_sauceda_practice_test5
Edtc6341 63 esther_sauceda_practice_test5Edtc6341 63 esther_sauceda_practice_test5
Edtc6341 63 esther_sauceda_practice_test5
 
1247g3hg1238 2011
1247g3hg1238 20111247g3hg1238 2011
1247g3hg1238 2011
 
Migration Database from SQL SERVER 2012 to Oracle12c with Pluggable Database
Migration Database from SQL SERVER 2012 to Oracle12c with Pluggable Database  Migration Database from SQL SERVER 2012 to Oracle12c with Pluggable Database
Migration Database from SQL SERVER 2012 to Oracle12c with Pluggable Database
 
EM12c Configuration Setup - Step by Step
EM12c Configuration Setup - Step by StepEM12c Configuration Setup - Step by Step
EM12c Configuration Setup - Step by Step
 
Oracle AWR baseline - Basic
Oracle AWR baseline - BasicOracle AWR baseline - Basic
Oracle AWR baseline - Basic
 
GMO OILBOOSTER Proposal (Eng)
GMO OILBOOSTER Proposal (Eng)GMO OILBOOSTER Proposal (Eng)
GMO OILBOOSTER Proposal (Eng)
 
Testing Orachk for Database Health Monitoring
Testing Orachk for Database Health MonitoringTesting Orachk for Database Health Monitoring
Testing Orachk for Database Health Monitoring
 

Similaire à Exadata - Smart Scan Testing

11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01
Karam Abuataya
 
Understanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
Understanding Query Optimization with ‘regular’ and ‘Exadata’ OracleUnderstanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
Understanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
Guatemala User Group
 
Oracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersOracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmasters
Kyle Hailey
 
Thomas+Niewel+ +Oracletuning
Thomas+Niewel+ +OracletuningThomas+Niewel+ +Oracletuning
Thomas+Niewel+ +Oracletuning
afa reg
 

Similaire à Exadata - Smart Scan Testing (20)

Informix Warehouse Accelerator (IWA) features in version 12.1
Informix Warehouse Accelerator (IWA) features in version 12.1Informix Warehouse Accelerator (IWA) features in version 12.1
Informix Warehouse Accelerator (IWA) features in version 12.1
 
EvolveExecutionPlans.pdf
EvolveExecutionPlans.pdfEvolveExecutionPlans.pdf
EvolveExecutionPlans.pdf
 
SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013
 
Oracle 11g caracteristicas poco documentadas 3 en 1
Oracle 11g caracteristicas poco documentadas 3 en 1Oracle 11g caracteristicas poco documentadas 3 en 1
Oracle 11g caracteristicas poco documentadas 3 en 1
 
Oracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor formatOracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor format
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01
 
Oracle 12c SPM
Oracle 12c SPMOracle 12c SPM
Oracle 12c SPM
 
Understanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
Understanding Query Optimization with ‘regular’ and ‘Exadata’ OracleUnderstanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
Understanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
 
Oracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersOracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmasters
 
12c SQL Plan Directives
12c SQL Plan Directives12c SQL Plan Directives
12c SQL Plan Directives
 
OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developers
 
Thomas+Niewel+ +Oracletuning
Thomas+Niewel+ +OracletuningThomas+Niewel+ +Oracletuning
Thomas+Niewel+ +Oracletuning
 
5 Cool Things About SQL
5 Cool Things About SQL5 Cool Things About SQL
5 Cool Things About SQL
 
MySQL SQL Tutorial
MySQL SQL TutorialMySQL SQL Tutorial
MySQL SQL Tutorial
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
 
Sql queries
Sql queriesSql queries
Sql queries
 
MV sql profile and index
MV sql profile and indexMV sql profile and index
MV sql profile and index
 
SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
 
SQLQueries
SQLQueriesSQLQueries
SQLQueries
 

Dernier

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Dernier (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

Exadata - Smart Scan Testing

  • 1. Exadata - SMART SCAN testing -------------------------------------------Samrt scan works with cell offloading which relate to offloaded the sql processing from the database layer to the cell (storage) layer. Smart scan is the access mechanism to offload data from storage layer. For example passing only required data blocks after applying predicate filters at the cell layer instead of sending every possible blocks from cell server to database server. Flash current buffer cache ==================== alter system flush buffer_cache; Create a table for testing ======================= create table sales_SM_SC as select mod(rownum,5) as channel_id, mod(rownum,1000) as cust_id , 5000 as amount_sold, to_date ('01.' || lpad(to_char(mod(rownum,12)+1),2,'0') || '.2007' ,'dd.mm.yyyy') as time_id from dual connect by level<=2e4; Check the table size ================= SQL> select bytes/1024/1024 as SizeMB from user_segments where segment_name='SALES_SM_SC'; SIZEMB ---------.5625 SQL> alter table sales nologging; Table altered. Insert data ============ insert /*+ append */ into sales_SM_SC select channel_id, cust_id,amount_sold, time_id from sales; 12399984 rows created. / 12399984 rows created. SQL> commit; Commit complete. SQL> select bytes/1024/1024 as SizeMB from user_segments where segment_name='SALES_SM_SC'; SIZEMB ---------656 Gather Statistics ============== SQL> exec dbms_stats.gather_table_stats('SH','SALES_SM_SC') SQL>
  • 2. PL/SQL procedure successfully completed. Check the Query Processing speed without Smart Scan: --------------------------------------------------------------------SQL> alter session set cell_offload_processing=false; Session altered. --------------------------------------------------------------------------------------------------------------------------------------NOTE : Inside the SQL statement optimizer hint to disables Smart Scan for the query select /*+ OPT_PARAM('cell_offload_processing' 'false') */ count(*) from SALES_SM_SC where channel_id=1 ------------------------------------------------------------------------------------------------------ --------------------------------SQL> set timing on select /* NO_SMART_SCAN */ count(*) from SALES_SM_SC where channel_id=1; SQL> COUNT(*) ---------4000 Elapsed: 00:00:16.19 SQL> / COUNT(*) ---------4000 Elapsed: 00:00:15.68 WIth Smart Scan: ---------------------SQL> set timing off; SQL> alter session set cell_offload_processing=true; Session altered. SQL> set timing on SQL> select /* WITH_SMART_SCAN */ count(*) from SALES_SM_SC where channel_id=1; COUNT(*) ---------4000 Elapsed: 00:00:23.75 SQL> / COUNT(*) ---------4000 Elapsed: 00:00:00.05 Note: Without cell_offload_processing query took 15:68 seconds where with cell_offload_processing it took 00:05 seconds.
  • 3. Query to check Predicate offload and smart scan ---------------------------------------------------------------SQL> select a.name, b.value/1024/1024 MB 2 from v$sysstat a, v$mystat b 3 where a.statistic# = b.statistic# and 4 (a.name in ('physical read total bytes', 5 'physical write total bytes', 6 'cell IO uncompressed bytes') 7 or a.name like 'cell phy%'); NAME MB ---------------------------------------------------------------- ---------physical read total bytes 53.0703125 physical write total bytes 0 cell physical IO interconnect bytes .188957214 cell physical IO bytes sent directly to DB node to balanceCPU u 0 cell physical IO bytes saved during optimized file creation 0 cell physical IO bytes saved during optimized RMAN file restore 0 cell physical IO bytes eligible for predicate offload 53.0625 cell physical IO bytes saved by storage index 0 cell physical IO interconnect bytes returned by smart scan .181144714 cell IO uncompressed bytes 53.0625 10 rows selected. So query is getting almost every blocks from predicate offload. Smart scan is required to get only 0.18MB data. Explain Plan for Without SMART_SCAN -----------------------------------SQL> set timing off; SQL> select sql_id from v$sql where sql_text like '%NO_SMART_SCAN%' and sql_text not like '%like%'; SQL_ID ------------9fmuwnmmrvapv SQL> select plan_table_output from table (dbms_xplan.display_cursor('9fmuwnmmrvapv')); PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------SQL_ID 9fmuwnmmrvapv, child number 0 ------------------------------------select /* NO_SMART_SCAN */ count(*) from SALES_SM_SC where channel_id=1 Plan hash value: 1381054164 -----------------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time -----------------------------------------------------------------------------------------| 0 | SELECT STATEMENT | 1 | SORT AGGREGATE | | | | | 1| | 22874 (100)| 3| | PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- | | |
  • 4. |* 2 | TABLE ACCESS STORAGE FULL| SALES_SM_SC | 3545K| 10M| 22874 (2)|00:04:35 | ------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------2 - filter("CHANNEL_ID"=1) 19 rows selected. Explain Plan for SMART SCAN ----------------------------------------SQL> SQL> select sql_id from v$sql where sql_text like '%WITH_SMART_SCAN%' and sql_text not like '%like%'; SQL_ID ------------8rb96afm261ry SQL> select plan_table_output from table (dbms_xplan.display_cursor('&SQLID')); Enter value for sqlid: 8rb96afm261ry old 1: select plan_table_output from table (dbms_xplan.display_cursor('&SQLID')) new 1: select plan_table_output from table (dbms_xplan.display_cursor('8rb96afm261ry')) PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------SQL_ID 8rb96afm261ry, child number 0 ------------------------------------select /* WITH_SMART_SCAN */ count(*) from SALES_SM_SC where channel_id=1 Plan hash value: 1381054164 -----------------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|Time | -----------------------------------------------------------------------------------------| 0 | SELECT STATEMENT | 1 | SORT AGGREGATE | | | | | 1| | 22874 (100)| 3| | | | PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------|* 2 | TABLE ACCESS STORAGE FULL| SALES_SM_SC | 3545K| 10M| 22874 (2)|00:04:35 | ------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------2 - storage("CHANNEL_ID"=1)
  • 5. filter("CHANNEL_ID"=1) 21 rows selected. NOTE: The Storage Layer did filter on the predicate channel_id=1 before transmitting the result to the Database Layer, which is the reason for the reduced runtime. ---------------------------------------2nd Example SMART SCAN --------------------------------------SQL> conn sh/sh Connected. SQL> set autotrace on SQL> set timing on SQL> select count (*) from customers where cust_valid='B'; COUNT(*) ---------0 Elapsed: 00:00:07.08 Execution Plan ---------------------------------------------------------Plan hash value: 296924608 -------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 1 | 2 | 10245 (1)| 00:02:03 | | 1 | SORT AGGREGATE | | 1| 2| | | |* 2 | TABLE ACCESS STORAGE FULL| CUSTOMERS | 65588 | 128K| 10245 (1)| 00:02:03 | -------------------------------------------------------------------------------Predicate Information (identified by operation id): --------------------------------------------------2 - storage("CUST_VALID"='B') filter("CUST_VALID"='B') Statistics ---------------------------------------------------------1 recursive calls 0 db block gets 36884 consistent gets 36880 physical reads 0 redo size 525 bytes sent via SQL*Net to client 519 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed
  • 6. SQL> set autotrace off SQL> select a.name, b.value/1024/1024 MB from v$sysstat a, v$mystat b where a.statistic# = b.statistic# and (a.name in ('physical read total bytes', 'physical write total bytes', 'cell IO uncompressed bytes') or a.name like 'cell phy%'); NAME MB ---------------------------------------------------------------- ---------physical read total bytes 288.25 physical write total bytes 0 cell physical IO interconnect bytes .222740173 cell physical IO bytes sent directly to DB node to balanceCPU u 0 cell physical IO bytes saved during optimized file creation 0 cell physical IO bytes saved during optimized RMAN file restore 0 cell physical IO bytes eligible for predicate offload 288.070313 cell physical IO bytes saved by storage index 0 cell physical IO interconnect bytes returned by smart scan .043052673 cell IO uncompressed bytes 288.070313 10 rows selected. Elapsed: 00:00:00.01 SQL> select distinct event, total_waits, time_waited/100 wait_secs, average_wait/100 avgwait_secs from v$session_event e, v$mystat s where event like 'cell%' and e.sid=s.sid;SQL> 2 3 EVENT TOTAL_WAITS WAIT_SECS AVGWAIT_SECS ---------- ---------------------------------------------------------------cell single block physical read 52 .59 .0113 cell multiblock physical read 1 .02 .0217 cell smart table scan 191 6.96 .0364 Elapsed: 00:00:00.50 Open another Session, update the query without commit: +++++++++++++++++++++++++++++++++++++++++++++ SQL> update customers 2 set cust_credit_limit=1.5*cust_credit_limit 3 where cust_id > 500000; Go to first session -------------------SQL> select count (*) from customers where cust_valid='B'; COUNT(*) ---------0 Elapsed: 00:01:43.12 ======> Finding1 (more time to get query output) AME MB ---------------------------------------------------------------- ---------physical read total bytes 607.484375 physical write total bytes 0 cell physical IO interconnect bytes 186.811409 ---->find2: more data to interconnect
  • 7. cell physical IO bytes sent directly to DB node to balanceCPU u 0 cell physical IO bytes saved during optimized file creation 0 cell physical IO bytes saved during optimized RMAN file restore 0 cell physical IO bytes eligible for predicate offload 576.140625 cell physical IO bytes saved by storage index 0 cell physical IO interconnect bytes returned by smart scan 155.467659 ---->find3: More data was returned cell IO uncompressed bytes 576.140625 10 rows selected. Elapsed: 00:00:00.07 SQL> select distinct event, total_waits, time_waited/100 wait_secs, average_wait/100 avgwait_secs from v$session_event e, v$mystat s where event like 'cell%' and e.sid=s.sid; 2 3 EVENT TOTAL_WAITS WAIT_SECS AVGWAIT_SECS ---------- ---------------------------------------------------------------cell single block physical read 4009 89.91 ---> find4 .0224 [Wait is more than .59sec] cell multiblock physical read cell smart table scan 1 375 .02 .0217 14.06 .0375 Elapsed: 00:00:00.14 Note: All because for uncommited transaction ---working as traditional buffer cache