Professional Documents
Culture Documents
Bloom Filters 169 PDF
Bloom Filters 169 PDF
Presented by
Joel Goodman
Oracle University EMEA
About Me
Email: Joel.Goodman@oracle.com
Blog: dbatrain.wordpress.com
Global Technical Lead Database Certifications
Global DBA Curriculum Quality Review Team
OCP DBA 7.3 to 12c
OCM DBA 9i to 12c
Member of Oak Table
Oracle University 1997 to Present
Oracle Support 1994 to 1996
Mini-Lesson Outline
--------------------------------------------------------------------------
| Id | Operation | Name | Pstart | Pstop |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | |
| *1 | HASH JOIN | | | |
| 2 | PART JOIN FILTER CREATE | :BF0000 | | |
| 3 | PARTITION HASH ALL | | 1| 16 |
| *4 | TABLE ACCESS FULL | TABLE1 | 1| 16 |
| 5 | PARTITION HASH JOIN-FILTER | |:BF0000 | :BF0000|
| 6 | TABLE ACCESSS FULL | TABLE2 | BF0000 | :BF0000|
-------------------------------------------------------------------------
1 - access(TABLE1".COLA"=TABLE2"."COLA")
filter(TABLE1"."COLB=999)
Smart Scan Join Processing with Bloom Filters
A Smart Scan is performed on the driving table used in the join
Each cell returns its portion of the table after filtering rows in the
cell
The Bloom Filter is built in the database instance and sent together
with the query to access the second table.
A Smart Scan is performed on the driven table and then the Bloom
Filter is applied in the cells
Only True and False Positives are returned by the cells for the
Smart Scan of the second table
The False Positives are eliminated during the join perfomed in the
database instance.
Smart Scan Join Filtering
SQL> SELECT AVG(s.amount_sold) FROM customers cu, sales s
2 WHERE cu.cust_id = s.cust_id
3 AND cu.cust_credit_limit > 5000;
-----------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib |
-----------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 19 | 55979 (1)| 00:11:12 | | | |
| 1 | SORT AGGREGATE | | 1 | 19 | | | | | |
| 2 | PX COORDINATOR | | | | | | | | |
| 3 | PX SEND QC (RANDOM) | :TQ10002 | 1 | 19 | | | Q1,02 | P->S | QC (RAND) |
| 4 | SORT AGGREGATE | | 1 | 19 | | | Q1,02 | PCWP | |
|* 5 | HASH JOIN | | 577M| 10g| 55979 (1)| 00:11:12 | Q1,02 | PCWP | |
| 6 | JOIN FILTER CREATE | :BF0000 | 57M| 547M| 14499 (1)| 00:02:54 | Q1,02 | PCWP | |
| 7 | PX RECEIVE | | 57M| 547M| 14499 (1)| 00:02:54 | Q1,02 | PCWP | |
| 8 | PX SEND HASH | :TQ10000 | 57M| 547M| 14499 (1)| 00:02:54 | Q1,00 | P->P | HASH |
| 9 | PX BLOCK ITERATOR | | 57M| 547M| 14499 (1)| 00:02:54 | Q1,00 | PCWC | |
|* 10 | TABLE ACCESS STORAGE FULL| CUSTOMERS | 57M| 547M| 14499 (1)| 00:02:54 | Q1,00 | PCWP | |
| 11 | PX RECEIVE | | 774M| 6651M| 24044 (1)| 00:04:49 | Q1,02 | PCWP | |
| 12 | PX SEND HASH | :TQ10001 | 774M| 6651M| 24044 (1)| 00:04:49 | Q1,01 | P->P | HASH |
| 13 | JOIN FILTER USE | :BF0000 | 774M| 6651M| 24044 (1)| 00:04:49 | Q1,01 | PCWP | |
| 14 | PX BLOCK ITERATOR | | 774M| 6651M| 24044 (1)| 00:04:49 | Q1,01 | PCWC | |
|* 15 | TABLE ACCESS STORAGE FULL| SALES | 774M| 6651M| 24044 (1)| 00:04:49 | Q1,01 | PCWP | |
-----------------------------------------------------------------------------------------------------------------------------
Smart Scan Join Filtering
5 - access("CU"."CUST_ID"="S"."CUST_ID")
10 - storage("CU"."CUST_CREDIT_LIMIT">5000)
filter("CU"."CUST_CREDIT_LIMIT">5000)
15 - storage(SYS_OP_BLOOM_FILTER(:BF0000,"S"."CUST_ID"))
filter(SYS_OP_BLOOM_FILTER(:BF0000,"S"."CUST_ID"))
In Memory Join Processing with Bloom Filters
A Scan is performed on the driving table used in the join
The Bloom Filter is built in the database instance and sent together
with the query to access the second table.
A Scan is performed on the driven table and then the Bloom Filter is
applied
Only True and False Positives are returned for the Scan of the
second table
The False Positives are eliminated during the join
In Memory Join Filtering
--------------------------------------------------------------------------------------------------
| Id | Operation | Name Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | 1 | 19 | 55979 (1)| 00:11:12 |
| 1 | SORT AGGREGATE | | 1 | 19 | | |
|* 2 | HASH JOIN | | 577M| 10g| 55979 (1)| 00:00:02 |
| 3 | JOIN FILTER CREATE | :BF0000 | 57M| 547M| 14499 (1)| 00:00:02 |
|* 4 | TABLE ACCESS INMEMORY FULL | CUSTOMERS | 57M| 547M| 14499 (1)| 00:00:02 |
| 5 | JOIN FILTER USE |:BF0000 | 774M| 6651M| 24044 (1)| 00:00:02 |
|* 6 | TABLE ACCESS INMEMORY FULL | SALES | 774M| 6651M| 24044 (1)| 00:00:02 |
--------------------------------------------------------------------------------------------------
In MemoryJoin Filtering
2 - access("CU"."CUST_ID"="S"."CUST_ID")
4- storage("CU"."CUST_CREDIT_LIMIT">5000)
filter("CU"."CUST_CREDIT_LIMIT">5000)
6 - storage(SYS_OP_BLOOM_FILTER(:BF0000,"S"."CUST_ID"))
filter(SYS_OP_BLOOM_FILTER(:BF0000,"S"."CUST_ID"))