Data Compression in Oracle

Size: px
Start display at page:

Download "Data Compression in Oracle"

Transcription

1 Data Compression in Oracle Carl Dudley University of Wolverhampton, UK UKOUG SIG Director 1

2 Main Topics Oracle 9i and 10g Compression - major features Compression in data warehousing Sampling the data to predict compression Pre-sorting the data for compression Behaviour of DML/DDL on compressed tables Compression Internals Advanced Compression in Oracle11g (for OLTP operations) Shrinking unused space 2

3 Oracle Data Compression Main Features 3

4 Compression : Characteristics Trades Physical I/O against CPU utilization Transparent to applications Can increase I/O throughput and buffer cache capacity Useful for 'read mostly' applications Decision Support and OLAP Compression is performed only when Oracle considers it worthwhile Depends on column length and amount of duplication Compression algorithms have caused little change to the Kernel code Modifications only to block formatting and accessing rows and columns No compression within individual column values or across blocks Blocks retrieved in compressed format in the buffer cache 4

5 Getting Compressed Building a new compressed table CREATE TABLE <table_name>... COMPRESS; CREATE TABLE <table_name> COMPRESS AS SELECT... Altering an existing table to be compressed ALTER TABLE <table_name> MOVE COMPRESS; No additional copy created but temp space and exclusive table level lock required for the compression activity ALTER TABLE <table_name> COMPRESS; Future bulk inserts may be compressed existing data is not Compressing individual partitions ALTER TABLE <table_name> MOVE PARTITION <partition_name> COMPRESS; Existing data and future bulk inserts compressed in a specific partition 5

6 Tablespace Level Compression Entire tablespaces can compress by default CREATE ALTER TABLESPACE < tablespace_name> DEFAULT [ COMPRESS NOCOMPRESS ]... All objects in the tablespace will be compressed by default 6

7 Compressing Table Data Uncompressed conventional emp table CREATE TABLE emp (empno NUMBER(4),ename VARCHAR2(12)...); Compressed emp table CREATE TABLE emp (empno NUMBER(4),ename VARCHAR2(12)...) COMPRESS; Could consider sorting the data on columns which lend themselves to compression 7

8 Table Data Compression Uncompressed emp table 7369 CLERK ACCOUNTING 7782 MANAGER PLANT 7902 ANALYST OPERATIONS 7900 CLERK OPERATIONS 7934 CLERK ACCOUNTING 7654 PLANT RESEARCH Compressed emp table Similar to index compression [SYMBOL TABLE] [A]=CLERK, [B]=ACCOUNTING, [C]=PLANT, [D]=OPERATIONS 7369 [A] [B] 7782 MANAGER [C] 7902 ANALYST [D] 7900 [A] [D] 7934 [A] [B] 7654 [C] RESEARCH 8

9 Observing Compression Information Compressed tables are not identified in user_tables in Oracle9i Fixed in Oracle10g Create a new view called my_user_tables by modifying the create view statement for user_tables in the catalog.sql file (see italic type) create or replace view MY_USER_TABLES (TABLE_NAME, TABLESPACE_NAME, CLUSTER_NAME, IOT_NAME, PCT_FREE, PCT_USED, : GLOBAL_STATS, USER_STATS, DURATION, SKIP_CORRUPT, MONITORING, CLUSTER_OWNER, DEPENDENCIES,COMPRESSED) as select o.name, decode(bitand(t.property, ), 0, ts.name, null), decode(bitand(t.property, 1024), 0, null, co.name), : decode(bitand(t.flags, ), , 'ENABLED', 'DISABLED'), decode(bitand(s.spare1, 2048), 2048, 'ENABLED', 'DISABLED') from sys.ts$ ts, sys.seg$ s, sys.obj$ co, sys.tab$ t, sys.obj$ o, sys.obj$ cx, sys.user$ cu : Create a public synonym for the new view and grant public access to it 9

10 Table Data Compression (continued) Scanning the compressed table is much faster Compressing can significantly reduce disk I/O - good for queries Possible increase in CPU activity Must unravel the compression but logical reads will be reduced SELECT table_name,compressed,num_rows FROM my_user_tables; TABLE_NAME COMPRESSED NUM_ROWS EC DISABLED EC1 ENABLED SELECT COUNT(ename) uncompressed FROM ec; UNCOMPRESSED Elapsed: 00:00:04.00 SELECT COUNT(ename) compressed FROM ec1; COMPRESSED Elapsed: 00:00:

11 Space Reduction Due to Compression Space usage summary Statistics for table EC Free Blocks...1 Total Blocks Total Bytes Unused Blocks...58 Unused Bytes Last Used Ext FileId...1 Last Used Ext BlockId Last Used Block...70 Statistics for table EC1 Free Blocks...0 Total Blocks Total Bytes Unused Blocks...46 Unused Bytes Last Used Ext FileId...1 Last Used Ext BlockId Last Used Block...82 Summary routine adapted from Tom Kyte s example 11

12 Compression in Data Warehousing 12

13 Compression in Data Warehousing Fact tables are good candidates for compression Large and have repetitive values Repetitive data tends to be clustered More clustered than in TPC-H tables Dimension tables are often too small for compression Large block size leads to greater compression Typical in data warehouses More rows available for compression within each block Materialized views can be compressed (and partitioned) Naturally sorted on creation due to GROUP BY Especially good for ROLLUP views and join views Tend to contain repetitive data 13

14 Compression of Individual Table Partitions Partition level Partitioning must be range or list (or composite) CREATE TABLE sales (sales_id NUMBER(8) : :,sales_date DATE) PARTITION BY RANGE(sales_date) (PARTITION sales_jan2003 VALUES LESS THAN (TO_DATE('02/01/2003','DD/MM/YYYY')) COMPRESS, PARTITION sales_feb2003 VALUES LESS THAN (TO_DATE('03/01/2003','DD/MM/YYYY')), PARTITION sales_mar2003 VALUES LESS THAN (TO_DATE('04/01/2003','DD/MM/YYYY')), PARTITION sales_apr2003 VALUES LESS THAN (TO_DATE('05/01/2003','DD/MM/YYYY'))); The first partition will be compressed Could consider compressing read only partitions of historical data 14

15 Effect of Partition Operations Consider individual partitions compressed as shown PARTITION p1 COMPRESS VALUES LESS THAN 100 PARTITION p2 COMPRESS VALUES LESS THAN 200 PARTITION p3 NOCOMPRESS VALUES LESS THAN 300 PARTITION p4 NOCOMPRESS VALUES LESS THAN 400 Splitting a compressed partition ALTER TABLE s1 SPLIT PARTITION p1 (50) INTO (PARTITION p1a, PARTITION p1b); Produces two new compressed partitions PARTITION p1acompress VALUES LESS THAN 50 PARTITION p1bcompress VALUES LESS THAN 100 PARTITION p2 COMPRESS VALUES LESS THAN 200 PARTITION p3 NOCOMPRESS VALUES LESS THAN 300 PARTITION p4 NOCOMPRESS VALUES LESS THAN

16 Effect of Partition Operations (contd) Effect of merging compressed partitions PARTITION p1acompress VALUES LESS THAN 50 PARTITION p1bcompress VALUES LESS THAN 100 PARTITION p2 COMPRESS VALUES LESS THAN 200 PARTITION p3 NOCOMPRESS VALUES LESS THAN 300 PARTITION p4 NOCOMPRESS VALUES LESS THAN 400 Merge of two compressed partitions ALTER TABLE s1 MERGE PARTITIONS p1b,p2 INTO PARTITION p1b_2; PARTITION p1a COMPRESS VALUES LESS THAN 50 PARTITION p1b_2 NOCOMPRESS VALUES LESS THAN 200 PARTITION p3 NOCOMPRESS VALUES LESS THAN 300 PARTITION p4 NOCOMPRESS VALUES LESS THAN 400 New partition p1b_2 is not compressed by default Same applies if any to be merged are initially uncompressed 16

17 Forcing Compression During Partition Maintenance Force compression of the new partition(s) after a split operation ALTER TABLE s1 SPLIT PARTITION p1 AT (50) INTO (PARTITION p1a COMPRESS,PARTITION p2a); Force compression of new partition after a merge operation ALTER TABLE s1 MERGE PARTITIONS p2,p3 INTO PARTITION p2_3 COMPRESS; Partitions may be empty or contain data during maintenance operations involving compression 17

18 Effect of Partitioned Bitmap Indexes Scenario : Table having no compressed partitions has bitmap locally partitioned indexes The presence of usable bitmap indexes will prevent the first operation that compresses a partition SQL> ALTER TABLE sales MOVE PARTITION p4 COMPRESS; ORA-14646: Specified alter table operation involving compression cannot be performed in the presence of usable bitmap indexes SQL> ALTER TABLE part2 SPLIT PARTITION p1a AT (25) INTO ( PARTITION p1c COMPRESS,PARTITION p1d); ORA-14646: Specified alter table operation involving compression cannot be performed in the presence of usable bitmap indexes 18

19 Compression of Partitions with Bitmap Indexes in Place Uncompressed partitioned table with bitmap index in 3 partitions CREATE TABLE emp_part PARTITION BY RANGE (deptno) (PARTITION p1 VALUES LESS THAN (11), PARTITION p2 VALUES LESS THAN (21), PARTITION p3 VALUES LESS THAN (31)) AS SELECT * FROM emp; CREATE BITMAP INDEX part$empno ON emp_part(empno) LOCAL; 19

20 Compression of Partitions with Bitmap Indexes in Place (continued) First compression operation requires the following 1. Mark bitmap indexes unusable (or drop them) ALTER INDEX part$empno UNUSABLE; 2. Compress the first (and any subsequent) partition as required ALTER TABLE emp_part MOVE PARTITION p1 COMPRESS; 3. Rebuild the bitmap indexes (or recreate them) ALTER INDEX part$empno REBUILD PARTITION p1; ALTER INDEX part$empno REBUILD PARTITION p2; ALTER INDEX part$empno REBUILD PARTITION p3; Each index partition must be individually rebuilt 20

21 Compression of Partitions with Bitmap Indexes in Place (continued) Oracle needs to know maximum records per block Correct mapping of bits to blocks can then be done On compression this value increases Oracle has to rebuild bitmaps to accommodate potentially larger number of values even if no data is present in the partition(s) Could result in larger bitmaps for uncompressed partitions Increase in size can be offset by the actual compression Once rebuilt, the indexes can cope with any compression Subsequent compression operations do not invalidate bitmap indexes Recommended to create each partitioned table with at least one compressed (dummy/empty?) partition Can be subsequently dropped Compression activity does not affect Btree usability 21

22 Table Level Compression for Partitioned Tables Compression can be the default for all partitions CREATE TABLE sales (sales_id NUMBER(8), : : sales_date DATE) COMPRESS PARTITION BY (sales_date)... Can still specify individual partitions to be NOCOMPRESS Default partition maintenance actions on compressed tables Splitting non-compressed partitions results in non-compressed partitions Merging non-compressed partitions results in a compressed partition Adding a partition will result in a new compressed partition Moving a partition does not alter its compression 22

23 Finding the Largest Tables Useful for finding candidates for compression SELECT owner,name,sum(gb),sum(pct) FROM (SELECT owner,name,to_char(gb,'999.99') gb,to_char((ratio_to_report(gb) OVER())*100,'999,999,999.99') pct FROM (SELECT owner,substr(segment_name,1,30) name,sum(bytes/(1024*1024*1024)) gb FROM dba_segments WHERE segment_type IN ('TABLE','TABLE PARTITION') GROUP BY owner,segment_name ) ) WHERE pct > 3 GROUP BY ROLLUP(owner,name) ORDER BY 3; 23

24 Finding the Largest Tables (contd) OWNER NAME SUM(GB) SUM(PCT) SH COSTS SH SALES SH SALES_HIST SH SYS IDL_UB2$ SYS SOURCE$ SYS

25 Sampling Data to Predict Compression 25

26 Compression Factor and Space Saving Compression Factor (CF) CF = non-compressed blocks compressed blocks * 100 Space Savings (SS) SS = non-compressed blocks - compressed blocks compressed blocks *

27 Predicting the Compression Factor CREATE OR REPLACE FUNCTION compression_ratio (tabname VARCHAR2) RETURN NUMBER IS pct NUMBER := ; -- sample percentage blkcnt NUMBER := 0; -- original block count (should be < 10K) blkcntc NUMBER; -- compressed block count BEGIN EXECUTE IMMEDIATE ' CREATE TABLE temp_uncompressed PCTFREE 0 AS SELECT * FROM ' tabname ' WHERE ROWNUM < 1'; WHILE ((pct < 100) AND (blkcnt < 1000)) LOOP -- until > 1000 blocks in sample EXECUTE IMMEDIATE 'TRUNCATE TABLE temp_uncompressed'; EXECUTE IMMEDIATE 'INSERT INTO temp_uncompressed SELECT * FROM ' tabname ' SAMPLE BLOCK (' pct ',10)'; EXECUTE IMMEDIATE 'SELECT COUNT(DISTINCT(dbms_rowid.rowid_block_number(rowid))) FROM temp_uncompressed' INTO blkcnt; pct := pct * 10; END LOOP; EXECUTE IMMEDIATE 'CREATE TABLE temp_compressed COMPRESS AS SELECT * FROM temp_uncompressed'; EXECUTE IMMEDIATE 'SELECT COUNT(DISTINCT(dbms_rowid.rowid_block_number(rowid))) FROM temp_compressed' INTO blkcntc; EXECUTE IMMEDIATE 'DROP TABLE temp_compressed'; EXECUTE IMMEDIATE 'DROP TABLE temp_uncompressed'; RETURN (blkcnt/blkcntc); END; / 27

28 Predicting the Compression Factor (continued) CREATE OR REPLACE PROCEDURE compress_test(p_comp VARCHAR2) IS comp_ratio NUMBER; BEGIN comp_ratio := compression_ratio(p_comp); dbms_output.put_line('compression factor for table ' p_comp ' is ' comp_ratio ); END; Run the compression test for the emp table EXEC compress_test('emp') Compression factor for table EMP is

29 Compression Test Clustered Data CREATE TABLE noclust (col1 VARCHAR2(1000)) COMPRESS; INSERT INTO noclust VALUES ('VV...VV'); INSERT INTO noclust VALUES ('WW...WW'); INSERT INTO noclust VALUES ('XX...XX'); INSERT INTO noclust VALUES ('YY...YY'); INSERT INTO noclust VALUES ('ZZ...ZZ'); INSERT INTO noclust VALUES ('VV...VV'); INSERT INTO noclust VALUES ('WW...WW'); INSERT INTO noclust VALUES ('XX...XX'); INSERT INTO noclust VALUES ('YY...YY'); INSERT INTO noclust VALUES ('ZZ...ZZ'); INSERT INTO noclust VALUES ('VV...VV'); : : : INSERT INTO noclust VALUES ('ZZ...ZZ'); Every value for column col1 is 390 bytes long CREATE TABLE clust (col1 VARCHAR2(1000)) COMPRESS; INSERT INTO clust VALUES ('VV...VV'); INSERT INTO clust VALUES ('VV...VV'); INSERT INTO clust VALUES ('VV...VV'); INSERT INTO clust VALUES ('VV...VV'); INSERT INTO clust VALUES ('VV...VV'); INSERT INTO clust VALUES ('WW...WW'); : : : INSERT INTO clust VALUES ('WW...WW'); INSERT INTO clust VALUES ('XX...XX'); : : : INSERT INTO clust VALUES ('YY...YY'); : : : INSERT INTO clust VALUES ('ZZ...ZZ'); Both tables have a total of 25 rows stored in blocks of size 2K So a maximum of four rows will fit in each block Both have same amount of repeated values but the clustering is different 29

30 Compression Test (continued) noclust - 4 rows per block. (7 blocks in total) The 5th row to be inserted must go in the next block as it contains different data header header header header vv vv zz zz yy yy xx xx ww ww vv vv zz zz yy yy xx xx ww ww vv vv zz zz yy yy xx xx ww ww vv vv header vv vv ww ww xx xx yy yy header zz zz clust - 20 rows per block. Rows 2,3,4,5 are duplicates of the first row in the block. Rows 7,8,9,10 are duplicates of the 6th row in the block, and this pattern is repeated. The residual space in the first block is used by the compressed data 30

31 Compression Test - Compression Factors Compression test routine is accurate due to sampling of actual data Make sure default tablespace is correctly set Temporary sample tables are physically built for the testing EXEC compress_test('clust') Compression factor for table CLUST is 3.5 EXEC compress_test('noclust') Compression factor for table NOCLUST is 1 31

32 Testing Compression : Using Repeatable sampling on Oracle9i Estimate the compression/decompression ratio for a table, abc 1. Make sampling repeatable: ALTER SESSION SET EVENTS '10193 trace name context forever, level 1'; This statement appears to have no effect in Oracle10g 2. Drop any previously created test tables DROP TABLE abc$test1; DROP TABLE abc$test2; 32

33 Testing Compression : Further Example (continued) 3. Create an empty compressed table: CREATE TABLE abc$test1 COMPRESS AS SELECT * FROM abc WHERE ROWNUM < 1; 4. Create an empty uncompressed table: CREATE TABLE abc$test2 NOCOMPRESS AS SELECT * FROM abc WHERE ROWNUM < 1; 5. Place the same test data in each of the test tables LOCK TABLE abc IN SHARE MODE; INSERT /*+ APPEND */ INTO abc$test1 SELECT * FROM abc SAMPLE BLOCK(x,y); INSERT /*+ APPEND */ INTO abc$test2 SELECT * FROM abc SAMPLE BLOCK(x,y); This example uses block level sampling 33

34 Testing Compression : Sampling Rows Tables can be sampled at row or block level Block level samples a random selection of whole blocks Row level (default) samples a random selection of rows SELECT * FROM emp SAMPLE (10); Selects a 10% sample of rows If repeated, a different sample will be taken Samples can be 'fixed' in Oracle10g using SEED SEED can can have integer values from Can also have higher numbers ending in '00' SELECT * FROM emp SAMPLE (10) SEED (1); Shows a 10% sample of rows If repeated, the exact same sample will be taken Also applies to block level sampling The sample set will change if DML is performed on the table 34

35 Pre-Sorting the Data for Compression 35

36 Sorting the Data for Compression Reorganize (pre-sort) rows in segments that will be compressed to cause repetitive data within blocks For multi-column tables, order the rows by the low cardinality column(s) CREATE TABLE emp_comp COMPRESS AS SELECT * FROM emp ORDER BY<some unselective column(s)>; For a single-column table, order the table rows by the column value Presort the data on a column which has : no. of distinct values ~ no. of blocks Information on column cardinality is shown in: ALL_TAB_COL_STATISTICS ALL_PART_COL_STATISTICS ALL_SUBPART_COL_STATISTICS 36

37 Sorting the Data for Compression Presort data on column having no. of distinct values ~ no. of blocks ~ SELECT * FROM large_emp; ( rows) EMPNO ENAME JOB ***** CLERK **** ANALYST ****** MANAGER : : : SELECT COUNT(DISTINCT job) FROM large_emp; 5 jobs SELECT COUNT(DISTINCT ename) FROM large_emp; 170 enames 37

38 Sorting the Data for Compression (continued) CREATE TABLE nocomp AS SELECT empno,ename,job FROM large_emp; Non-compressed table : Number of used blocks = 360 CREATE TABLE cjob COMPRESS AS SELECT empno,ename,job FROM large_emp ORDER BY job; Compressed table sorted on job : Number of used blocks = 243 CREATE TABLE cename COMPRESS AS SELECT empno,ename,job FROM large_emp ORDER BY ename; Compressed table sorted on ename : Number of used blocks = 172 Sorting on the job column is not the most effective 38

39 Behaviour of DML/DDL on Tables with Default Compression 39

40 Default Compressed Table Behaviour Updates, and conventional single and multi-row inserts are NOT compressed UPDATE Wholesale updates lead to large increases in storage (>250%) Performance impact on UPDATEs can be around 400% Rows are migrated to new blocks (default value of PCTFREE is 0) DELETE Performance impact of around 15% for compressed rows Creating a compressed table can take 50% longer Compressed tables cannot be modified in ORA cannot add column to object tables 40

41 Default Compressed Table Behaviour (continued) Operations which 'perform' compression CREATE TABLE... AS SELECT... ALTER TABLE... MOVE... INSERT /*+APPEND*/ (single threaded) INSERT /*+PARALLEL(sales,4)*/ Requires ALTER SESSION ENABLE PARALLEL DML; Both of the above inserts work with data from database tables and external tables SQL*Loader DIRECT = TRUE Various partition maintenance operations Can not be used for: LOB and VARRAY constructs Index organized tables Can use index compression on IOTs External tables, index clusters, hash clusters Bulk loads within PL/SQL Logical standby techniques 41

42 Compression Internals 42

43 Hexadecimal Dump of Compressed Data Symbol Table : 14 unique names 5 unique jobs Start of next block 43

44 Oracle Dump - Two Uncompressed Employee Rows ALTER SYSTEM DUMP DATAFILE 8 BLOCK 35; Creates a trace file in USER_DUMP_DEST... block_row_dump: tab 0, row tl: 41 fb: --H-FL-- lb: 0x2 cc: 8 col 0: [ 3] c col 1: [ 5] 43 4c b col 2: [ 7] 4d 41 4e col 3: [ 3] c2 4f 28 col 4: [ 7] 77 b col 5: [ 3] c col 6: *NULL* col 7: [ 2] c1 0b tab 0, row tl: 40 fb: --H-FL-- lb: 0x2 cc: 8 col 0: [ 3] c col 1: [ 5] f col 2: [ 7] 41 4e 41 4c col 3: [ 3] c2 4c 43 col 4: [ 7] 77 bb col 5: [ 2] c2 1f col 6: *NULL* col 7: [ 2] c

45 Oracle Dump of Table of empno,ename,job tl: 18 fb: --H-FL-- lb: 0x0 cc: 2 col 0: [ 9] e 54 col 1: [ 4] 4b 49 4e 47 bindmp: 00 0b 02 d e 54 cc 4b 49 4e 47 tab 0, row PRESIDENT KING tl: 9 fb: --H-FL-- lb: 0x0 cc: 2 col 0: [ 7] 41 4e 41 4c col 1: [ 4] 46 4f bindmp: 00 0a cc 46 4f FORD... tab 0, row tl: 10 fb: --H-FL-- lb: 0x0 cc: 2 col 0: [ 5] 43 4c b col 1: [ 5] 53 4d bindmp: 00 0b 02 0e cd 53 4d SMITH tab 0, row tl: 8 fb: --H-FL-- lb: 0x0 cc: 1 col 0: [ 5] 43 4c b bindmp: cd 43 4c b CLERK... tab 0, row tl: 10 fb: --H-FL-- lb: 0x0 cc: 1 col 0: [ 7] 41 4e 41 4c bindmp: cf 41 4e 41 4c tab 1, row tl: 9 fb: --H-FL-- lb: 0x0 cc: 3 col 0: [ 5] 43 4c b col 1: [ 5] 53 4d col 2: [ 3] c bindmp: 2c d cb c ANALYST 45

46 Oracle Avoids Unnecessary Compression Create two tables with repeating small values in one column CREATE TABLE tnocomp ( col1 VARCHAR2(1),col2 VARCHAR2(6)) PCTFREE 0; CREATE TABLE tcomp ( col1 VARCHAR2(1),col2 VARCHAR2(6)) COMPRESS; Insert data (320 rows) as follows COL1 COL A 1ZZZZZ 2A 2ZZZZZ 3A 3ZZZZZ 4A 4ZZZZZ 5A 5ZZZZZ 1A 6ZZZZZ 2A 7ZZZZZ... 4A 319ZZZ 5A 320ZZZ Values unique in col2 Values repeat in col1 every 5 rows 46

47 Evidence of Minimal Compression SELECT dbms_rowid.rowid_block_number(rowid) block,dbms_rowid.rowid_relative_fno(rowid) file,count(*) num_rows FROM &table_name GROUP BY dbms_rowid.rowid_block_number(rowid),dbms_rowid.rowid_relative_fno(rowid); tnocomp BLOCK FILE NUM_ROWS tcomp BLOCK FILE NUM_ROWS Evidence of compression in the 'compressed' table 47

48 Further Evidence of Compression ALTER SYSTEM DUMP DATAFILE 8 BLOCK 67; HEX(A) = 41 block_row_dump: tab 0, row tl: 5 fb: --H-FL-- lb: 0x0 cc: 1 col 0: [ 2] bindmp: 00 1b ca tab 0, row tl: 5 fb: --H-FL-- lb: 0x0 cc: 1 col 0: [ 2] bindmp: 00 1b ca tab 0, row tl: 5 fb: --H-FL-- lb: 0x0 cc: 1 col 0: [ 2] bindmp: 00 1b ca tab 0, row tl: 5 fb: --H-FL-- lb: 0x0 cc: 1 col 0: [ 2] bindmp: 00 1a ca tab 0, row tl: 5 fb: --H-FL-- lb: 0x0 cc: 1 col 0: [ 2] bindmp: ca tab 1, row tl: 12 fb: --H-FL-- lb: 0x0 cc: 2 col 0: [ 2] col 1: [ 6] bindmp: 2c c tab 1, row tl: 12 fb: --H-FL-- lb: 0x0 cc: 2 col 0: [ 2] col 1: [ 6] bindmp: 2c c Symbol Table (tab0) (1A,2A. 3A.4A.5A) 48

49 Compression not Performed on Unsuitable Data Both tables recreated with values in col1 now set to TO_CHAR(MOD(ROWNUM,50)) Much less repetition of values (only every 50 rows) allowing less compression tnocomp COL1 COL ZZZZZ 2 2ZZZZZ 3 3ZZZZZ 4 4ZZZZZ... 5ZZZZZ 49 49ZZZZ 50 50ZZZZ 1 51ZZZZ 2 52ZZZZ 3 53ZZZZ Oracle decides not to compress BLOCK FILE NUM_ROWS tcomp BLOCK FILE NUM_ROWS

50 Comparison of Heap and IOT Compression IOT = Index Organized table 50

51 Comparison of IOT and Heap Tables Tests constructed using a standard set of data in emptest Six columns with absence of nulls EMPNO ENAME JOB HIREDATE SAL DEPTNO KING PRESIDENT 17-NOV FORD ANALYST 03-DEC SCOTT ANALYST 09-DEC JONES MANAGER 02-APR BLAKE MANAGER 01-MAY CLARK MANAGER 09-JUN ALLEN SALESMAN 20-FEB TURNER SALESMAN 08-SEP MILLER CLERK 23-JAN WARD SALESMAN 22-FEB MARTIN SALESMAN 28-SEP ADAMS CLERK 12-JAN JAMES CLERK 03-DEC SMITH CLERK 17-DEC KING PRESIDENT 17-NOV FORD ANALYST 03-DEC SMITH CLERK 17-DEC IOT = Index Organized table 51

52 Creation of IOTs empi : Conventional IOT based on emptest data CREATE TABLE empi (empno,ename,job,hiredate,sal,deptno, CONSTRAINT pk_empi PRIMARY KEY(ename,job,hiredate,sal,deptno,empno)) ORGANIZATION INDEX PCTFREE 0 AS SELECT * FROM emptest empic : First five columns compressed CREATE TABLE empic (empno,ename,job,hiredate,sal,deptno, CONSTRAINT pk_empic PRIMARY KEY(ename,job,hiredate,sal,deptno,empno)) ORGANIZATION INDEX PCTFREE 0 COMPRESS 5 AS SELECT * FROM emptest 52

53 Test tables Four tables built having heap/iot structures and compressed/noncompressed data Unique index built on empno column in emph and emphc tables Table Table Compress Blocks Average Name Type row length emph Heap No emphc Heap Yes empi IOT No empic IOT Yes Average row length obtained from user_tables (avg_row_len) Compressed heap tables show no reduction in average row length 53

54 Compression Data Number of blocks in heap tables obtained using dbms_rowid SELECT COUNT(COUNT(*)) FROM &table_name GROUP BY dbms_rowid.rowid_block_number(rowid),dbms_rowid.rowid_relative_fno(rowid); Number of blocks in IOTs obtained from index validation VALIDATE INDEX &index_name; SELECT * FROM index_stats; Compressed IOTs have compression shown as DISABLED in user_tables, but ENABLED in user_indexes 54

55 Timings to Scan Tables SELECT COUNT(deptno) FROM <table_name>; Table Table Compress Elapsed Name Type Time (s) emph Heap No 0.70 emphc Heap Yes 0.47 empi IOT No 0.37 empic IOT Yes

56 Access Paths for Heap Table EXPLAIN PLAN FOR SELECT * FROM emph WHERE EMPNO > ; SELECT * FROM TABLE(dbms_xplan.display); PLAN_TABLE_OUTPUT Id Operation Name Rows Bytes Cost (%CPU) SELECT STATEMENT K 252 (2) 1 TABLE ACCESS BY INDEX ROWID EMPH K 252 (2) * 2 INDEX RANGE SCAN PK_EMPH (3) EXPLAIN PLAN FOR SELECT * FROM emph WHERE EMPNO > ; SELECT * FROM TABLE(dbms_xplan.display); PLAN_TABLE_OUTPUT Id Operation Name Rows Bytes Cost (%CPU) SELECT STATEMENT K 252 (5) * 1 TABLE ACCESS FULL EMPH K 252 (5)

57 Access Paths for Compressed Heap Table EXPLAIN PLAN FOR SELECT * FROM emphc WHERE EMPNO > ; SELECT * FROM TABLE(dbms_xplan.display); PLAN_TABLE_OUTPUT Id Operation Name Rows Bytes Cost (%CPU) SELECT STATEMENT K 86 (3) 1 TABLE ACCESS BY INDEX ROWID EMPHC K 86 (3) * 2 INDEX RANGE SCAN PK_EMPHC (3) EXPLAIN PLAN FOR SELECT * FROM emphc WHERE EMPNO > ; SELECT * FROM TABLE(dbms_xplan.display); PLAN_TABLE_OUTPUT Id Operation Name Rows Bytes Cost (%CPU) SELECT STATEMENT K 91 (11) * 1 TABLE ACCESS FULL EMPHC K 91 (11) Note that full table scan is (rightly) more likely to be performed 57

58 Access Path for IOTs EXPLAIN PLAN FOR SELECT * FROM empi WHERE EMPNO > ; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY); PLAN_TABLE_OUTPUT Id Operation Name Rows Bytes Cost (%CPU) SELECT STATEMENT K 238 (1) * 1 INDEX FAST FULL SCAN PK_EMPI K 238 (1)

59 Updates to Heap and IOT Tables UPDATE <table_name> SET ename = 'XXXXXXX ; Lengthens each employee name by at least one character Table Table Compress Blocks Blocks Increase PCT Elapsed Name Type before after in blocks increase Time update update Emph Heap No ~ 10% 5 mins Emphc Heap Yes ~ 600% 15 mins Empi IOT No ~ 100% 4 mins Empic IOT Yes ~ 100% 12 mins Note the explosion in size of the compressed heap table 59

60 Advanced Compression in Oracle11g (for OLTP Operations) 60

61 Advanced Compression in Oracle 11g Conventional DML maintains the compression Inserted and updated rows remain compressed The compress activity is kept at a minimum Known as the Advanced Compression option Extra cost 61

62 Compressing for OLTP Operations Requires COMPATIBILITY = (or higher) CREATE TABLE t1... COMPRESS FOR ALL OPERATIONS ; Conventionally inserted rows stay uncompressed until PCTFREE is reached Mimimises compression operations Existing rows are not compressed Header Header Header Header Header Free space Free space Free space Free space Free space Conventional inserts are not compressed Block becomes full Rows are now compressed Transaction activity More uncompressed Inserts fill the block Rows are compressed again 62

63 OLTP Compression Some early results Table containing 3million parts records No compression 35M Compression for direct path operations 12M Compression for all operations 16M Avoid large scale (batch) updates on OLTP compressed tables Significant processing overheads 63

64 OLTP Compression Test Table containing sales records PROD_ID CUST_ID TIME_ID CHANNEL_ID PROMO_ID AMOUNT_SOLD ACCOUNT_TYPE JAN Minor account FEB Minor account NOV Minor account : : : : : : : Three tables created CREATE TABLE s_non_c PCTFREE 0 AS SELECT * FROM sales; Non-compressed table with fully packed blocks CREATE TABLE s_c COMPRESS AS SELECT * FROM sales; Compressed table for DSS operations CREATE TABLE s_c_all COMPRESS FOR ALL OPERATIONS AS SELECT * FROM sales; Compressed table for OLTP operations 64

65 OLTP Compression Test (continued) Update stress test update 94% of the rows No lengthening of any data UPDATE sales SET account_type = Major account WHERE prod_id > 13; Non-compressed table Compressed Table for DSS Compressed Table for OLTP Original size (blocks) Size after update (blocks) Elapsed time for update 39 secs 1:04 secs Test somewhat unfair on OLTP compression Update is large and batch orientated I/O subsystem was single disk But still interesting? 2:20:12 secs 65

66 Shrinking Unused Space in Oracle10g 66

67 Reclaiming Space in Oracle10g Unused space below the High Water Mark can be reclaimed online ALTER TABLE <table_name> SHRINK SPACE; Space caused by delete operations can be returned to free space Object must be in a locally managed tablespace with automatic segment space management (ASSM) Removes the need for Online Redefinition to reclaim space? Two-step operation Rows are moved to blocks available for insert Requires row movement to be enabled ALTER TABLE <table_name> ENABLE ROW MOVEMENT; High water mark (HWM) is repositioned Newly freed blocks are returned to free space if the COMPACT keyword is not used 67

68 Repositioning of HWM During shrinks HWM Allocated block above the high water mark HWM Free block Free block Free block Rows are physically moved to space in blocks on the freelist Shrinking causes ROWIDs to change Indexes (bitmap and btree) are updated accordingly Shrinking does not work with compressed tables 68

69 Shrinking Objects Why Shrink? To reclaim space To increase speed of full table scans To allow access to table during the necessary reorganisation The shrink operation can be terminated/interrupted at any time Can be continued at a later time from point of termination Objects that can be SHRINKed Tables Indexes Materialized views Materialized view logs Dependent objects may be shrunk when a table shrinks ALTER TABLE <table_name> SHRINK SPACE [CASCADE]; 69

70 Data Compression in Oracle Carl Dudley University of Wolverhampton, UK UKOUG SIG Director 70

Table Compression in Oracle9i Release2. An Oracle White Paper May 2002

Table Compression in Oracle9i Release2. An Oracle White Paper May 2002 Table Compression in Oracle9i Release2 An Oracle White Paper May 2002 Table Compression in Oracle9i Release2 Executive Overview...3 Introduction...3 How It works...3 What can be compressed...4 Cost and

More information

Programming Languages

Programming Languages Programming Languages Chapter 19 - Continuations Dr. Philip Cannata 1 Exceptions (define (f n) (let/cc esc (/ 1 (if (zero? n) (esc 1) n)))) > (f 0) 1 > (f 2) 1/2 > (f 1) 1 > Dr. Philip Cannata 2 Exceptions

More information

Real-World Performance Training SQL Introduction

Real-World Performance Training SQL Introduction Real-World Performance Training SQL Introduction Real-World Performance Team Basics SQL Structured Query Language Declarative You express what you want to do, not how to do it Despite the name, provides

More information

Tuning Considerations for Different Applications Lesson 4

Tuning Considerations for Different Applications Lesson 4 4 Tuning Considerations for Different Applications Lesson 4 Objectives After completing this lesson, you should be able to do the following: Use the available data access methods to tune the logical design

More information

CS2 Current Technologies Lecture 2: SQL Programming Basics

CS2 Current Technologies Lecture 2: SQL Programming Basics T E H U N I V E R S I T Y O H F R G E D I N B U CS2 Current Technologies Lecture 2: SQL Programming Basics Dr Chris Walton (cdw@dcs.ed.ac.uk) 4 February 2002 The SQL Language 1 Structured Query Language

More information

Creating and Managing Tables Schedule: Timing Topic

Creating and Managing Tables Schedule: Timing Topic 9 Creating and Managing Tables Schedule: Timing Topic 30 minutes Lecture 20 minutes Practice 50 minutes Total Objectives After completing this lesson, you should be able to do the following: Describe the

More information

CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries

CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries T E H U N I V E R S I T Y O H F R G E D I N B U CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries Chris Walton (cdw@dcs.ed.ac.uk) 11 February 2002 Multiple Tables 1 Redundancy requires excess

More information

Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University

Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University 1 Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University Lecture 3 Part A CIS 311 Introduction to Management Information Systems (Spring 2017)

More information

King Fahd University of Petroleum and Minerals

King Fahd University of Petroleum and Minerals 1 King Fahd University of Petroleum and Minerals Information and Computer Science Department ICS 334: Database Systems Semester 041 Major Exam 1 18% ID: Name: Section: Grades Section Max Scored A 5 B 25

More information

CS2 Current Technologies Note 1 CS2Bh

CS2 Current Technologies Note 1 CS2Bh CS2 Current Technologies Note 1 Relational Database Systems Introduction When we wish to extract information from a database, we communicate with the Database Management System (DBMS) using a query language

More information

Horrid compression collateral

Horrid compression collateral Horrid compression collateral jonathanlewis.wordpress.com www.jlcomp.demon.co.uk Who am I? Independent Consultant 28+ years in IT 24+ using Oracle Strategy, Design, Review, Briefings, Educational, Trouble-shooting

More information

Advanced indexing methods Usage and Abusage. Riyaj Shamsudeen Ora!nternals

Advanced indexing methods Usage and Abusage. Riyaj Shamsudeen Ora!nternals Advanced indexing methods Usage and Abusage Riyaj Shamsudeen Ora!nternals Introduction Who am I? Various indexing features Use and abuse of index types Questions Riyaj Shamsudeen @Orainternals 2 Who am

More information

Data Warehousing & Big Data at OpenWorld for your smartphone

Data Warehousing & Big Data at OpenWorld for your smartphone Data Warehousing & Big Data at OpenWorld for your smartphone Smartphone and tablet apps, helping you get the most from this year s OpenWorld Access to all the most important information Presenter profiles

More information

Oracle DB-Tuning Essentials

Oracle DB-Tuning Essentials Infrastructure at your Service. Oracle DB-Tuning Essentials Agenda 1. The DB server and the tuning environment 2. Objective, Tuning versus Troubleshooting, Cost Based Optimizer 3. Object statistics 4.

More information

VLDB. Partitioning Compression

VLDB. Partitioning Compression VLDB Partitioning Compression Oracle Partitioning in Oracle Database 11g Oracle Partitioning Ten Years of Development Core functionality Performance Manageability Oracle8 Range partitioning

More information

<Insert Picture Here> DBA Best Practices: A Primer on Managing Oracle Databases

<Insert Picture Here> DBA Best Practices: A Primer on Managing Oracle Databases DBA Best Practices: A Primer on Managing Oracle Databases Mughees A. Minhas Sr. Director of Product Management Database and Systems Management The following is intended to outline

More information

Introduction. Introduction to Oracle: SQL and PL/SQL

Introduction. Introduction to Oracle: SQL and PL/SQL Introduction Introduction to Oracle: SQL and PL/SQL 1 Objectives After completing this lesson, you should be able to do the following: Discuss the theoretical and physical aspects of a relational database

More information

RDBMS Using Oracle. BIT-4 Lecture Week 3. Lecture Overview

RDBMS Using Oracle. BIT-4 Lecture Week 3. Lecture Overview RDBMS Using Oracle BIT-4 Lecture Week 3 Lecture Overview Creating Tables, Valid and Invalid table names Copying data between tables Character and Varchar2 DataType Size Define Variables in SQL NVL and

More information

Oracle DB-Tuning Essentials

Oracle DB-Tuning Essentials Infrastructure at your Service. Oracle DB-Tuning Essentials Agenda 1. The DB server and the tuning environment 2. Objective, Tuning versus Troubleshooting, Cost Based Optimizer 3. Object statistics 4.

More information

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1 Part III Data Modelling Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1 Outline of this part (I) 1 Introduction to the Relational Model and SQL Relational Tables Simple Constraints

More information

ENHANCING DATABASE PERFORMANCE

ENHANCING DATABASE PERFORMANCE ENHANCING DATABASE PERFORMANCE Performance Topics Monitoring Load Balancing Defragmenting Free Space Striping Tables Using Clusters Using Efficient Table Structures Using Indexing Optimizing Queries Supplying

More information

Pivot Tables Motivation (1)

Pivot Tables Motivation (1) Pivot Tables The Pivot relational operator (available in some SQL platforms/servers) allows us to write cross-tabulation queries from tuples in tabular layout. It takes data in separate rows, aggregates

More information

Seminar: Presenter: Oracle Database Objects Internals. Oren Nakdimon.

Seminar: Presenter: Oracle Database Objects Internals. Oren Nakdimon. Seminar: Oracle Database Objects Internals Presenter: Oren Nakdimon www.db-oriented.com oren@db-oriented.com 054-4393763 @DBoriented 1 Oren Nakdimon Who Am I? Chronology by Oracle years When What Where

More information

Informatics Practices (065) Sample Question Paper 1 Section A

Informatics Practices (065) Sample Question Paper 1 Section A Informatics Practices (065) Sample Question Paper 1 Note 1. This question paper is divided into sections. Section A consists 30 marks. 3. Section B and Section C are of 0 marks each. Answer the questions

More information

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Copyright 2012, Oracle and/or its affiliates. All rights reserved. 1 Oracle Partitioning für Einsteiger Hermann Bär Partitioning Produkt Management 2 Disclaimer The goal is to establish a basic understanding of what can be done with Partitioning I want you to start thinking

More information

Optimal Physical Database Design for Oracle8i

Optimal Physical Database Design for Oracle8i Optimal Physical Database Design for Oracle8i Dave Ensor BMC Software, Inc The opinions expressed in this paper are those of the author, and are not necessarily shared by BMC Software, Inc. Introduction

More information

SQL Structured Query Language Introduction

SQL Structured Query Language Introduction SQL Structured Query Language Introduction Rifat Shahriyar Dept of CSE, BUET Tables In relational database systems data are represented using tables (relations). A query issued against the database also

More information

Oracle Exam 1z0-054 Oracle Database 11g: Performance Tuning Version: 5.0 [ Total Questions: 192 ]

Oracle Exam 1z0-054 Oracle Database 11g: Performance Tuning Version: 5.0 [ Total Questions: 192 ] s@lm@n Oracle Exam 1z0-054 Oracle Database 11g: Performance Tuning Version: 5.0 [ Total Questions: 192 ] Question No : 1 You work for a small manufacturing company as a DBA. The company has various applications

More information

Oracle Database 11g Release 2 for SAP Advanced Compression. Christoph Kersten Oracle Database for SAP Global Technology Center (Walldorf, Germany)

Oracle Database 11g Release 2 for SAP Advanced Compression. Christoph Kersten Oracle Database for SAP Global Technology Center (Walldorf, Germany) Oracle Database 11g Release 2 for SAP Advanced Compression Christoph Kersten Oracle Database for SAP Global Technology Center (Walldorf, Germany) Implicit Compression Efficient Use

More information

Oracle Database In-Memory

Oracle Database In-Memory Oracle Database In-Memory Mark Weber Principal Sales Consultant November 12, 2014 Row Format Databases vs. Column Format Databases Row SALES Transactions run faster on row format Example: Insert or query

More information

Partitioning. The Uses of Partitioning

Partitioning. The Uses of Partitioning Partitioning Partitioning in Oracle was first introduced in Oracle 8.0. It is the ability to physically break a table or index into many smaller more manageable pieces. As far as the application accessing

More information

7/17/2018. Copyright 2016, Oracle and/or its affiliates. All rights reserved. 2

7/17/2018. Copyright 2016, Oracle and/or its affiliates. All rights reserved. 2 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 2 1 Typical speaker ego slide blog connor-mcdonald.com youtube tinyurl.com/connor-tube twitter @connor_mc_d Copyright 2016, Oracle and/or

More information

An Overview of Oracle Indexes

An Overview of Oracle Indexes Indexes Indexing is a crucial aspect of your application design and development. Too many indexes and the performance of DML will suffer. Too few indexes and the performance of queries (including inserts,

More information

Exam: 1Z Title : Oracle9i: Performance Tuning. Ver :

Exam: 1Z Title : Oracle9i: Performance Tuning. Ver : Exam: Title : Oracle9i: Performance Tuning Ver : 01.22.04 Section A contains 226 questions. Section B contains 60 questions. The total number of questions is 286. Answers to the unanswered questions will

More information

ABSTRACT INTRODUCTION. Bhaskar Himatsingka, Oracle Corporation & Juan Loaiza, Oracle Corporation

ABSTRACT INTRODUCTION. Bhaskar Himatsingka, Oracle Corporation & Juan Loaiza, Oracle Corporation HOW TO STOP DEFRAGMENTING AND START LIVING: THE DEFINITIVE WORD ON FRAGMENTATION Bhaskar Himatsingka, Oracle Corporation & Juan Loaiza, Oracle Corporation ABSTRACT Fragmentation is an issue of great concern

More information

1 SQL Structured Query Language

1 SQL Structured Query Language 1 SQL Structured Query Language 1.1 Tables In relational database systems (DBS) data are represented using tables (relations). A query issued against the DBS also results in a table. A table has the following

More information

Table : Purchase. Field DataType Size Constraints CustID CHAR 5 Primary key CustName Varchar 30 ItemName Varchar 30 PurchaseDate Date

Table : Purchase. Field DataType Size Constraints CustID CHAR 5 Primary key CustName Varchar 30 ItemName Varchar 30 PurchaseDate Date Q1. Write SQL query for the following : (i) To create above table as per specification given (ii) To insert 02 records as per your choice (iii) Display the Item name, qty & s of all items purchased by

More information

1z Oracle9i Performance Tuning. Version 19.0

1z Oracle9i Performance Tuning. Version 19.0 1z0-033 Oracle9i Performance Tuning Version 19.0 Important Note Please Read Carefully Study Tips This product will provide you questions and answers along with detailed explanations carefully compiled

More information

Oracle Advanced Compression Proof-of-Concept (POC) Insights and Best Practices

Oracle Advanced Compression Proof-of-Concept (POC) Insights and Best Practices O R A C L E A D V A N C E D C O M P R E S S I O N B E S T P R A C T I C E S Oracle Advanced Compression Proof-of-Concept (POC) Insights and Best Practices Oracle Advanced Compression FEATURES TYPICALLY

More information

Query Optimization, part 2: query plans in practice

Query Optimization, part 2: query plans in practice Query Optimization, part 2: query plans in practice CS634 Lecture 13 Slides by E. O Neil based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Working with the Oracle query optimizer First

More information

04 Storage management 15/07/17 12:34 AM. Storage management

04 Storage management 15/07/17 12:34 AM. Storage management Storage management 1 "High water" and "low water" marks PCTFREE and PCTUSED parameters PCTFREE ("high water" mark) and PCTUSED ("low water" mark) parameters control the use of free space for inserts and

More information

Ensuring Optimal Performance. Vivek Sharma. 3 rd November 2012 Sangam 2012

Ensuring Optimal Performance. Vivek Sharma. 3 rd November 2012 Sangam 2012 Ensuring Optimal Performance Vivek Sharma 3 rd November 2012 Sangam 2012 Who am I? Around 12 Years using Oracle Products Certified DBA versions 8i Specializes in Performance Optimization COE Lead with

More information

1 SQL Structured Query Language

1 SQL Structured Query Language 1 SQL Structured Query Language 1.1 Tables In relational database systems (DBS) data are represented using tables (relations). A query issued against the DBS also results in a table. A table has the following

More information

Database implementation Further SQL

Database implementation Further SQL IRU SEMESTER 2 January 2010 Semester 1 Session 2 Database implementation Further SQL Objectives To be able to use more advanced SQL statements, including Renaming columns Order by clause Aggregate functions

More information

Database Management System. * First install Mysql Database or Wamp Server which contains Mysql Databse.

Database Management System. * First install Mysql Database or Wamp Server which contains Mysql Databse. Database Management System * First install Mysql Database or Wamp Server which contains Mysql Databse. * Installation steps are provided in pdf named Installation Steps of MySQL.pdf or WAMP Server.pdf

More information

Oracle Tables TECHGOEASY.COM

Oracle Tables TECHGOEASY.COM Oracle Tables TECHGOEASY.COM 1 Oracle Tables WHAT IS ORACLE DATABASE TABLE? -Tables are the basic unit of data storage in an Oracle Database. Data is stored in rows and columns. -A table holds all the

More information

Experiences of Global Temporary Tables in Oracle 8.1

Experiences of Global Temporary Tables in Oracle 8.1 Experiences of Global Temporary Tables in Oracle 8.1 Global Temporary Tables are a new feature in Oracle 8.1. They can bring significant performance improvements when it is too late to change the design.

More information

CS Reading Packet: "Writing relational operations using SQL"

CS Reading Packet: Writing relational operations using SQL CS 325 - Reading Packet: "Writing relational operations using SQL" p. 1 CS 325 - Reading Packet: "Writing relational operations using SQL" Sources: Oracle9i Programming: A Primer, Rajshekhar Sunderraman,

More information

GFC_ARCH_MGMT: SEGMENT MANAGEMENT UTILITY PACKAGE

GFC_ARCH_MGMT: SEGMENT MANAGEMENT UTILITY PACKAGE T E C H N I C A L N O T E GFC_ARCH_MGMT: SEGMENT MANAGEMENT UTILITY PACKAGE Prepared By David Kurtz, Go-Faster Consultancy Ltd. Technical Note Version 0.08 Tuesday 15 July 2014 (E-mail: david.kurtz@go-faster.co.uk,

More information

Oracle Rebuild All Unusable Indexes In Schema

Oracle Rebuild All Unusable Indexes In Schema Oracle Rebuild All Unusable Indexes In Schema How to determine row count for all tables in an Oracle Schema? Manual Script to compile invalid objects Script to rebuild all UNUSABLE indexes in oracle. In

More information

PBarel@Qualogy.com http://blog.bar-solutions.com About me Patrick Barel Working with Oracle since 1997 Working with PL/SQL since 1999 Playing with APEX since 2003 (mod_plsql) ACE since 2011 OCA since December

More information

Query Optimisation Part 2

Query Optimisation Part 2 Query Optimisation Part 2 Brendan Tierney For each query in the workload What relations does it access? What attributes are retrieved? Understanding the Workload What attributes are involved in selection

More information

<Insert Picture Here> Controlling resources in an Exadata environment

<Insert Picture Here> Controlling resources in an Exadata environment Controlling resources in an Exadata environment Agenda Smart IO IO Resource Manager Compression Hands-on time Exadata Security Flash Cache Storage Indexes Parallel Execution Agenda

More information

Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Slide 17-1

Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Slide 17-1 Slide 17-1 Chapter 17 Introduction to Transaction Processing Concepts and Theory Multi-user processing and concurrency Simultaneous processing on a single processor is an illusion. When several users are

More information

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Copyright 2013, Oracle and/or its affiliates. All rights reserved. 2 Copyright 23, Oracle and/or its affiliates. All rights reserved. Oracle Database 2c Heat Map, Automatic Data Optimization & In-Database Archiving Platform Technology Solutions Oracle Database Server

More information

CS Reading Packet: "Views, and Simple Reports - Part 1"

CS Reading Packet: Views, and Simple Reports - Part 1 CS 325 - Reading Packet: "Views, and Simple Reports - Part 1" p. 1 Sources: CS 325 - Reading Packet: "Views, and Simple Reports - Part 1" * Oracle9i Programming: A Primer, Rajshekhar Sunderraman, Addison

More information

Introduc.on to Databases

Introduc.on to Databases Introduc.on to Databases G6921 and G6931 Web Technologies Dr. Séamus Lawless Housekeeping Course Structure 1) Intro to the Web 2) HTML 3) HTML and CSS Essay Informa.on Session 4) Intro to Databases 5)

More information

Oracle Database 18c. Gentle introduction to Polymorphic Tables Functions with Common patterns and sample use cases

Oracle Database 18c. Gentle introduction to Polymorphic Tables Functions with Common patterns and sample use cases Oracle Database 18c Gentle introduction to Polymorphic Tables Functions with Common patterns and sample use cases About me. Keith Laker Product Manager for Analytic SQL and Autonomous DW Oracle Blog: oracle-big-data.blogspot.com

More information

Oracle Alter Table Add Unique Constraint Using Index Tablespace

Oracle Alter Table Add Unique Constraint Using Index Tablespace Oracle Alter Table Add Unique Constraint Using Index Tablespace You must also have space quota in the tablespace in which space is to be acquired in Additional Prerequisites for Constraints and Triggers

More information

E-Guide DATABASE DESIGN HAS EVERYTHING TO DO WITH PERFORMANCE

E-Guide DATABASE DESIGN HAS EVERYTHING TO DO WITH PERFORMANCE E-Guide DATABASE DESIGN HAS EVERYTHING TO DO WITH PERFORMANCE D atabase performance can be sensitive to the adjustments you make to design. In this e-guide, discover the affects database performance data

More information

Oracle 1Z0-053 Exam Questions & Answers

Oracle 1Z0-053 Exam Questions & Answers Oracle 1Z0-053 Exam Questions & Answers Number: 1Z0-053 Passing Score: 660 Time Limit: 120 min File Version: 38.8 http://www.gratisexam.com/ Oracle 1Z0-053 Exam Questions & Answers Exam Name: Oracle Database

More information

When should an index be used?

When should an index be used? When should an index be used? Christian Antognini Trivadis AG Zürich, Switzerland Introduction One of the biggest problems tuning a SQL statement or judging if its execution plan is optimal, is to decide

More information

VERSION. Version Date Description. Estimate size of B-tree Indexes ! " # $$% & ' ( )*(!+ $ &-+ / ! 5 '9

VERSION. Version Date Description. Estimate size of B-tree Indexes !  # $$% & ' ( )*(!+ $ &-+ / ! 5 '9 VERSION Version Date Description! " # $$% & ' ( )*(!+, -./01))( -#*** $ &-+ / 2 3 4 5 2 62 25 7 8! 5 '9!"-" 5 27/12/2005 Guy Lambregts OCP DBA Steria Benelux Page : 2 1. INTRODUCTION...4 2. HOW MANY LEAF

More information

Greenplum Architecture Class Outline

Greenplum Architecture Class Outline Greenplum Architecture Class Outline Introduction to the Greenplum Architecture What is Parallel Processing? The Basics of a Single Computer Data in Memory is Fast as Lightning Parallel Processing Of Data

More information

Oracle Database In-Memory

Oracle Database In-Memory Oracle Database In-Memory Under The Hood Andy Cleverly andy.cleverly@oracle.com Director Database Technology Oracle EMEA Technology Safe Harbor Statement The following is intended to outline our general

More information

RNDr. Michal Kopecký, Ph.D. Department of Software Engineering, Faculty of Mathematics and Physics, Charles University in Prague

RNDr. Michal Kopecký, Ph.D. Department of Software Engineering, Faculty of Mathematics and Physics, Charles University in Prague seminář: Administrace Oracle (NDBI013) LS2017/18 RNDr. Michal Kopecký, Ph.D. Department of Software Engineering, Faculty of Mathematics and Physics, Charles University in Prague Database structure Database

More information

Database statistics gathering: Synopsis

Database statistics gathering: Synopsis Database statistics gathering: Synopsis Introduction It is known that having proper database statistics is crucial for query optimizer. Statistics should properly describe data within the database. To

More information

Hybrid Columnar Compression (HCC) on Oracle Database 18c O R A C L E W H IT E P A P E R FE B R U A R Y

Hybrid Columnar Compression (HCC) on Oracle Database 18c O R A C L E W H IT E P A P E R FE B R U A R Y Hybrid Columnar Compression (HCC) on Oracle Database 18c O R A C L E W H IT E P A P E R FE B R U A R Y 2 0 1 8 Disclaimer The following is intended to outline our general product direction. It is intended

More information

RDBMS Topic 4 Adv. SQL, MSBTE Questions and Answers ( 12 Marks)

RDBMS Topic 4 Adv. SQL, MSBTE Questions and Answers ( 12 Marks) 2017 RDBMS Topic 4 Adv. SQL, MSBTE Questions and Answers ( 12 Marks) 2016 Q. What is view? Definition of view: 2 marks) Ans : View: A view is a logical extract of a physical relation i.e. it is derived

More information

Partitioning in Oracle 12 c. Bijaya K Adient

Partitioning in Oracle 12 c. Bijaya K Adient Partitioning in Oracle 12 c Bijaya K Pusty @ Adient Partitioning in Oracle 12 c AGENDA Concepts of Partittioning? Partitioning Basis Partitioning Strategy Additions Improvments in 12c Partitioning Indexes

More information

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement GIFT Department of Computing Science [Spring 2013] CS-217: Database Systems Lab-2 Manual Data Selection and Filtering using the SELECT Statement V1.0 4/12/2016 Introduction to Lab-2 This lab reinforces

More information

Oracle Database 10g: New Features for Administrators Release 2

Oracle Database 10g: New Features for Administrators Release 2 Oracle University Contact Us: +27 (0)11 319-4111 Oracle Database 10g: New Features for Administrators Release 2 Duration: 5 Days What you will learn This course introduces students to the new features

More information

Course Contents of ORACLE 9i

Course Contents of ORACLE 9i Overview of Oracle9i Server Architecture Course Contents of ORACLE 9i Responsibilities of a DBA Changing DBA Environments What is an Oracle Server? Oracle Versioning Server Architectural Overview Operating

More information

Databases IIB: DBMS-Implementation Exercise Sheet 10

Databases IIB: DBMS-Implementation Exercise Sheet 10 Prof. Dr. Stefan Brass December 15, 2017 Institut für Informatik MLU Halle-Wittenberg Databases IIB: DBMS-Implementation Exercise Sheet 10 As requested by the students, the repetition questions a) will

More information

DATABASE DEVELOPMENT (H4)

DATABASE DEVELOPMENT (H4) IMIS HIGHER DIPLOMA QUALIFICATIONS DATABASE DEVELOPMENT (H4) Friday 3 rd June 2016 10:00hrs 13:00hrs DURATION: 3 HOURS Candidates should answer ALL the questions in Part A and THREE of the five questions

More information

Exploring Oracle Database 11g/12c Partitioning New Features and Best Practices. Ami Aharonovich Oracle ACE & OCP

Exploring Oracle Database 11g/12c Partitioning New Features and Best Practices. Ami Aharonovich Oracle ACE & OCP Exploring Oracle Database 11g/12c Partitioning New Features and Best Practices Ami Aharonovich Oracle ACE & OCP Ami@DBAces.com About Me Oracle ACE Oracle Certified Professional DBA (OCP) Founder and CEO,

More information

Safe Harbor Statement

Safe Harbor Statement Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment

More information

INFSCI 2711 Database Analysis and Design Example I for Final Exam: Solutions

INFSCI 2711 Database Analysis and Design Example I for Final Exam: Solutions Dr. Stefan Brass July 26, 2001 School of Information Sciences University of Pittsburgh INFSCI 2711 Database Analysis and Design Example I for Final Exam: Solutions General Remarks The average was 22.2

More information

Oracle Database 11gR2 Optimizer Insights

Oracle Database 11gR2 Optimizer Insights Oracle Database 11gR2 Optimizer Insights Marcus Bender Distinguished Sales Consultant Presales Fellow Strategic Technical Support (STU) ORACLE Deutschland GmbH, Geschäftsstelle Hamburg Parallel Execution

More information

Miguel Anjo (IT/ADC)

Miguel Anjo (IT/ADC) Database Workshop for LHC online/offline developers SQL (2/2) (IT/ADC) Miguel.Anjo@cern.ch http://cern.ch/it-adc (based on Andrea Valassi slides on Advanced SQL) 26 January 2005 Previous tutorials: Database

More information

C. Use the TO_CHAR function around SYSDATE, that is, 1_date := TO_CHAR (SYSDATE).

C. Use the TO_CHAR function around SYSDATE, that is, 1_date := TO_CHAR (SYSDATE). Volume: 75 Questions Question: 1 Examine this code: Users of this function may set different date formats in their sessions. Which two modifications must be made to allow the use of your session s date

More information

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved. Database Foundations 6-3 Roadmap You are here Introduction to Oracle Application Express Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control

More information

SQL. Char (30) can store ram, ramji007 or 80- b

SQL. Char (30) can store ram, ramji007 or 80- b SQL In Relational database Model all the information is stored on Tables, these tables are divided into rows and columns. A collection on related tables are called DATABASE. A named table in a database

More information

LOGGING OR NOLOGGING THAT IS THE QUESTION. By: Francisco Munoz Alvarez

LOGGING OR NOLOGGING THAT IS THE QUESTION. By: Francisco Munoz Alvarez LOGGING OR NOLOGGING THAT IS THE QUESTION By: Francisco Munoz Alvarez LOGGING OR NOLOGGING : THAT IS THE QUESTION Francisco Munoz Alvarez Oracle ACE Director CLOUG (Chilean Oracle Users Group) President

More information

Kathleen Durant PhD Northeastern University CS Indexes

Kathleen Durant PhD Northeastern University CS Indexes Kathleen Durant PhD Northeastern University CS 3200 Indexes Outline for the day Index definition Types of indexes B+ trees ISAM Hash index Choosing indexed fields Indexes in InnoDB 2 Indexes A typical

More information

Deep Dive Into Storage Optimization When And How To Use Adaptive Compression. Thomas Fanghaenel IBM Bill Minor IBM

Deep Dive Into Storage Optimization When And How To Use Adaptive Compression. Thomas Fanghaenel IBM Bill Minor IBM Deep Dive Into Storage Optimization When And How To Use Adaptive Compression Thomas Fanghaenel IBM Bill Minor IBM Agenda Recap: Compression in DB2 9 for Linux, Unix and Windows New in DB2 10 for Linux,

More information

Appendix C. Database Administration. Using SQL. SQL Statements. Data Definition Statements (DDL)

Appendix C. Database Administration. Using SQL. SQL Statements. Data Definition Statements (DDL) Appendix C Appendix C Database Administration The following sections provide information about the tools that can be used to maintain your Oracle Utilities Work and Asset Management database. Using SQL

More information

ORACLE 12C NEW FEATURE. A Resource Guide NOV 1, 2016 TECHGOEASY.COM

ORACLE 12C NEW FEATURE. A Resource Guide NOV 1, 2016 TECHGOEASY.COM ORACLE 12C NEW FEATURE A Resource Guide NOV 1, 2016 TECHGOEASY.COM 1 Oracle 12c New Feature MULTITENANT ARCHITECTURE AND PLUGGABLE DATABASE Why Multitenant Architecture introduced with 12c? Many Oracle

More information

Indexing. Jan Chomicki University at Buffalo. Jan Chomicki () Indexing 1 / 25

Indexing. Jan Chomicki University at Buffalo. Jan Chomicki () Indexing 1 / 25 Indexing Jan Chomicki University at Buffalo Jan Chomicki () Indexing 1 / 25 Storage hierarchy Cache Main memory Disk Tape Very fast Fast Slower Slow (nanosec) (10 nanosec) (millisec) (sec) Very small Small

More information

DEBUNKING THE MYTHS ABOUT REDO, UNDO, COMMIT AND ROLLBACK

DEBUNKING THE MYTHS ABOUT REDO, UNDO, COMMIT AND ROLLBACK DEBUNKING THE MYTHS ABOUT REDO, UNDO, COMMIT AND ROLLBACK Introduction This paper is to explore various misconceptions about redo generation, undo generation, commit and rollback operations. Scripts are

More information

RAID in Practice, Overview of Indexing

RAID in Practice, Overview of Indexing RAID in Practice, Overview of Indexing CS634 Lecture 4, Feb 04 2014 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke 1 Disks and Files: RAID in practice For a big enterprise

More information

ColumnStore Indexes. מה חדש ב- 2014?SQL Server.

ColumnStore Indexes. מה חדש ב- 2014?SQL Server. ColumnStore Indexes מה חדש ב- 2014?SQL Server דודאי מאיר meir@valinor.co.il 3 Column vs. row store Row Store (Heap / B-Tree) Column Store (values compressed) ProductID OrderDate Cost ProductID OrderDate

More information

Projects. Corporate Trainer s Profile. CMM (Capability Maturity Model) level Project Standard:- TECHNOLOGIES

Projects. Corporate Trainer s Profile. CMM (Capability Maturity Model) level Project Standard:- TECHNOLOGIES Corporate Trainer s Profile Corporate Trainers are having the experience of 4 to 12 years in development, working with TOP CMM level 5 comapnies (Project Leader /Project Manager ) qualified from NIT/IIT/IIM

More information

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved. 1 Copyright 2011, Oracle and/or its affiliates. All rights 2 Copyright 2011, Oracle and/or its affiliates. All rights Optimizer Statistics CPU & IO DATA DICTIONARY OPTIMIZER STATISTICS Index Table Column

More information

NORAD DBControl Online Whitepaper

NORAD DBControl Online Whitepaper NORAD DBControl Online Whitepaper Ensuring Modern Database Service Standards with Online Reorganizations and Structural Changes Bradmark Technologies, Inc. 1 Contents Introduction... 3 Reasons to Reorganize...

More information

Oracle Performance Tuning. Overview of performance tuning strategies

Oracle Performance Tuning. Overview of performance tuning strategies Oracle Performance Tuning Overview of performance tuning strategies Allan Young June 2008 What is tuning? Group of activities used to optimize and homogenize the performance of a database Maximize use

More information

Infrastructure at your Service. In-Memory-Pläne für den 12.2-Optimizer: Teuer oder billig?

Infrastructure at your Service. In-Memory-Pläne für den 12.2-Optimizer: Teuer oder billig? Infrastructure at your Service. In-Memory-Pläne für den 12.2-Optimizer: Teuer oder billig? About me Infrastructure at your Service. Clemens Bleile Senior Consultant Oracle Certified Professional DB 11g,

More information

DumpsKing. Latest exam dumps & reliable dumps VCE & valid certification king

DumpsKing.   Latest exam dumps & reliable dumps VCE & valid certification king DumpsKing http://www.dumpsking.com Latest exam dumps & reliable dumps VCE & valid certification king Exam : 1z1-062 Title : Oracle Database 12c: Installation and Administration Vendor : Oracle Version

More information

Why is my Oracle10g Database SLOWER than my Oracle9i Database? Dan Hotka Author/Speaker/Oracle Expert

Why is my Oracle10g Database SLOWER than my Oracle9i Database? Dan Hotka Author/Speaker/Oracle Expert Why is my Oracle10g Database SLOWER than my Oracle9i Database? Dan Hotka Author/Speaker/Oracle Expert www.danhotka.com, LLC (c) www.danhotka.com LLC. Any reproduction or copying of this manual without

More information

IT100: Oracle Administration

IT100: Oracle Administration IT100: Oracle Administration IT100 Rev.001 CMCT COURSE OUTLINE Page 1 of 8 Training Description: Introduction to Oracle Administration and Management is a five-day course designed to provide Oracle professionals

More information