Académique Documents
Professionnel Documents
Culture Documents
-------------------------------------------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>
| Name
|
|
|
|
|
1|
| 22874 (100)|
3|
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
|
|
19 rows selected.
| Name
|
|
|
|
|
1|
| 22874 (100)|
3|
|
|
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------|* 2 | TABLE ACCESS STORAGE FULL| SALES_SM_SC | 3545K| 10M| 22874 (2)|00:04:35 |
------------------------------------------------------------------------------------------
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
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
1
375
.02
.0217
14.06
.0375
Elapsed: 00:00:00.14
Note: All because for uncommited transaction ---working as traditional buffer cache