2026-03-12 20:23:15
This commit is contained in:
27
tpt/demos/create_wide_table.sql
Normal file
27
tpt/demos/create_wide_table.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- Copyright 2020 Tanel Poder. All rights reserved. More info at https://tanelpoder.com
|
||||
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
|
||||
|
||||
DECLARE
|
||||
cmd CLOB := 'CREATE TABLE widetable ( id NUMBER PRIMARY KEY ';
|
||||
ins CLOB := 'INSERT INTO widetable SELECT rownum';
|
||||
BEGIN
|
||||
FOR x IN 1..999 LOOP
|
||||
cmd := cmd || ', col'||TRIM(TO_CHAR(x))||' VARCHAR2(10)';
|
||||
ins := ins || ', TRIM(TO_CHAR(rownum))';
|
||||
END LOOP;
|
||||
cmd := cmd || ')';
|
||||
ins := ins || ' FROM dual CONNECT BY level <= 100';
|
||||
EXECUTE IMMEDIATE cmd;
|
||||
EXECUTE IMMEDIATE ins;
|
||||
END;
|
||||
/
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- stats with histograms
|
||||
EXEC DBMS_STATS.GATHER_TABLE_STATS(user,'WIDETABLE',method_opt=>'FOR TABLE, FOR ALL COLUMNS SIZE 254');
|
||||
|
||||
-- no histograms
|
||||
-- EXEC DBMS_STATS.GATHER_TABLE_STATS(user,'WIDETABLE',method_opt=>'FOR TABLE, FOR ALL COLUMNS SIZE 1');
|
||||
|
||||
-- EXEC sys.dbms_shared_pool.purge('SYSTEM', 'WIDETABLE', 1, 1);
|
||||
Reference in New Issue
Block a user