Skip to content

Commit cb28861

Browse files
committed
make tab
1 parent e2755f2 commit cb28861

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

optimizer/first_rows/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ It improves the costing of FIRST ROWS type queries so that the optimizer makes b
44

55
This is important for applications that return rows (in sorted order) to users that paginate through the result set.
66

7+
Create the table with make_tab.sql
8+
79
See scripts before.sql and after.sql - spooled 'lst' output files are provided.
810

911
Compare the cost in the before and after versions, and also compare the differences in the resulting plans. The costs in the *after* example (for FETCH FIRST) are much lower and compare favorably with the ROWNUM queries.

optimizer/first_rows/make_tab.sql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
drop table t purge;
2+
3+
create table t nologging as
4+
select d.* from dba_objects d,
5+
( select 1 from dual connect by level <= 10 )
6+
where object_id is not null;
7+
8+
alter table t noparallel;
9+
10+
alter table t modify object_id not null;
11+
12+
create index ix on t ( object_id ) ;
13+
14+
exec dbms_stats.gather_table_stats(user,'t')

0 commit comments

Comments
 (0)