!--NEWSZW_HZH_BEGIN--
优化前:
select count(t.id)
from test t
where t.status = 1
and t.id not in (select distinct a.app_id
from test2 a
where a.type = 1
and a.rule_id in (152, 153, 154))
17:20:57 laojiu>@plan
PLAN_TABLE_OUTPUT
————————————————————————————————————————-
Plan hash value: 684502086
—————————————————————————————-
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
—————————————————————————————-
| 0 | SELECT STATEMENT | | 1 | 18 | 176K (2)| 00:35:23 |
| 1 | SORT AGGREGATE | | 1 | 18 | | |
|* 2 | FILTER | | | | | |
|* 3 | TABLE ACCESS FULL| test | 1141 | 20538 | 845 (2)| 00:00:11 |
|* 4 | TABLE ACCESS FULL| test2 | 1 | 12 | 309 (2)| 00:00:04 |
—————————————————————————————-
Predicate Information (identified by operation id):
—————————————————
2
select count(t.id)
f