We often compare select results. The commonly used function is minus. So when two tables have a large amount of data, what can be done to improve efficiency?

Minus Mode Minus The execution plan is as follows. Sort and compare the results. Select object_id from T2 minus select object_id from T1. . Elapsed: 00:00:00.93 Execution Plan

Plan hash value: 1578327006

| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |

| 0 | SELECT STATEMENT | | 102K| 2357K| | 1318 (1)| 00:00:16 | | 1 | MINUS | | | | | | | | 2 | SORT UNIQUE | | 102K| 1304K| 2024K| 861 (1)| 00:00:11 | | 3 | TABLE ACCESS FULL | T2 | 102K| 1304K| | 371 (1)| 00:00:05 | | 4 | SORT UNIQUE | | 82926 | 1052K| 1640K| 457 (1)| 00:00:06 | | 5 | INDEX FAST FULL SCAN| T1_IDX | 82926 | 1052K| | 60 (0)| 00:00:01 |

Note

dynamic sampling used for this statement (level=2) Statistics

9 Recursive calls — recursive 0 DB block gets 1681 consistent gets 1798 physical reads 0 redo size 41734 bytes sent via SQLNet to client 2173 bytes received via SQLNet from client 152 SQL*Net roundtrips to/from client 2 sorts (memory) 0 sorts (Disk) 2255 Rows processed by join in order to perform more efficient games, especially in large amounts of data. select t2.object_id t2_id from t1 right join t2 on t1.object_id=t2.object_id where t1.object_id is null; Elapsed: 00:00:00.56 Execution Plan

Plan hash value: 4276371593

| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |

| 0 | SELECT STATEMENT | | 102K| 2609K| | 653 (1)| 00:00:08 | |* 1 | HASH JOIN RIGHT ANTI | | 102K| 2609K| 2032K| 653 (1)| 00:00:08 | | 2 | INDEX FAST FULL SCAN| T1_IDX | 82926 | 1052K| | 60 (0)| 00:00:01 | | 3 | TABLE ACCESS FULL | T2 | 102K| 1304K| | 371 (1)| 00:00:05 |

Predicate Information (identified by operation id):

1-access (“T1″.”OBJECT_ID”=”T2″.”OBJECT_ID”)

Note the game www.cungun.com

dynamic sampling used for this statement (level=2) Statistics

0 db block gets 1692 consistent gets 1534 physical reads 0 redo size 41730 bytes sent via SQLNet to client 2173 bytes received via SQLNet from client 152 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 2255 rows processed