|
做个实验:
CREATE TABLE test_part (
id number
,city_id number
,val number
)
PARTITION BY LIST (city_id)
( PARTITION p1 VALUES (1), PARTITION p2 VALUES (2));
insert into test_part select level,1,level from dual connect by level<=10000;
insert into test_part values(200000,2,20000);
commit;
execute dbms_stats.gather_table_stats(ownname => user,tabname => 'TEST_PART' ,estimate_percent => null ,method_opt => 'for all columns size AUTO' ,cascade => true);
select * from test_part where city_id=:v_city_id;
Plan hash value: 651004966
---------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
---------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 5001 | 55011 | 274 (0)| 00:00:01 | | |
| 1 | PARTITION LIST SINGLE| | 5001 | 55011 | 274 (0)| 00:00:01 | KEY | KEY |
| 2 | TABLE ACCESS FULL | TEST_PART | 5001 | 55011 | 274 (0)| 00:00:01 | KEY | KEY |
---------------------------------------------------------------------------------------------------
explain plan 取了个平均值。 |
|