/** * * Copyright 2012 Jaromir D.B. Nemec * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language * governing permissions and limitations under the License. * */ alter session set nls_language=english; -- setup script for test Adaptive Cursor Sharing -- drop table T_ADAPT; create table T_ADAPT (status number not null, vpad varchar2(200)) tablespace users; -- fill insert into T_ADAPT select status, vpad from ( select 1 status, to_char(rownum) || rpad('x',100,'y') vpad from dual connect by level <= 10 union all select 2 status, to_char(rownum) || rpad('x',100,'y') vpad from dual connect by level <= 100 union all select 3 status, to_char(rownum) || rpad('x',100,'y') vpad from dual connect by level <= 2000000 ) order by DBMS_RANDOM.VALUE(0,1); commit; create index T_ADAPT_IDX1 on T_ADAPT(status) tablespace users; --- -- table + index with sample size begin dbms_stats.gather_table_stats( ownname => USER, tabname => 'T_ADAPT', estimate_percent => 1, cascade => TRUE, method_opt => 'FOR ALL COLUMNS SIZE 1', no_invalidate => false ); end; / -- begin dbms_stats.gather_table_stats( ownname => USER, tabname => 'T_ADAPT', estimate_percent => 100, method_opt => 'FOR COLUMNS SIZE 254 STATUS', no_invalidate => false ); end; /