Presentation is loading. Please wait.

Presentation is loading. Please wait.

Set Query for Oracle 9.0.1 이우진, 이상협 숭실대학교 컴퓨터학과 June 2002.

Similar presentations


Presentation on theme: "Set Query for Oracle 9.0.1 이우진, 이상협 숭실대학교 컴퓨터학과 June 2002."— Presentation transcript:

1 Set Query for Oracle 9.0.1 이우진, 이상협 숭실대학교 컴퓨터학과 bluewjl@dreamx.net lsh95ss@netsgo.com June 2002

2 Database Systems Laboratory 2 목 차목 차목 차목 차 Set query 개요 Set query 개요 실험 환경 실험 환경 벤치마크 도구 벤치마크 도구 실험 결과 및 분석 실험 결과 및 분석

3 Database Systems Laboratory 3 Set Query 개요

4 Database Systems Laboratory 4 Set Query 개요 (1) 문서 검색, 직접 마케팅, 의사 결정 지원, 경영 보 고서 같은 전략적 가치 정보의 응용프로그램이 원 하는 결과를 $/QPS (Price per Queries Per Second) 로 얻을 수 있게 하여 제품에 대한 성능 평가를 할 목적으로 개발 문서 검색, 직접 마케팅, 의사 결정 지원, 경영 보 고서 같은 전략적 가치 정보의 응용프로그램이 원 하는 결과를 $/QPS (Price per Queries Per Second) 로 얻을 수 있게 하여 제품에 대한 성능 평가를 할 목적으로 개발 단일 사용자 환경 단일 사용자 환경 시험 대상 시스템 – 상용 관계형 데이터베이스 시험 대상 시스템 – 상용 관계형 데이터베이스

5 Database Systems Laboratory 5 Set Query 개요 (2) Set Query 개요 (2) 구성 구성 하나의 테이블 – bench 하나의 테이블 – bench 3 개 영역의 69 개 질의로 구성 3 개 영역의 69 개 질의로 구성 측정 요소 측정 요소 응답시간 - 1/1000 초 단위 응답시간 - 1/1000 초 단위 CPU 사용시간 - 1/1000 초 단위 CPU 사용시간 - 1/1000 초 단위 I/O 사용 - block 수 단위 I/O 사용 - block 수 단위

6 Database Systems Laboratory 6 Set Query 개요 (3) 질의 결과 출력 질의 결과 출력 각 질의의 결과를 사용자가 원하는 파일로 출력 각 질의의 결과를 사용자가 원하는 파일로 출력 $/QPS (Dollar Price per Query Per Second) $/QPS (Dollar Price per Query Per Second) P*T / 69 P*T / 69 P: 하드웨어와 소프트웨어 비용 P: 하드웨어와 소프트웨어 비용 T: 전체 질의를 수행하는데 소요된 시간 T: 전체 질의를 수행하는데 소요된 시간

7 Database Systems Laboratory 7 시험 테이블 – BENCH(1) 하나의 테이블 하나의 테이블 1,000,000 개 터플 1,000,000 개 터플 터플 크기 – 200 바이트 터플 크기 – 200 바이트 높은 기수성을 얻기 위해 일관된 방법하에 정수 배로 재구성 가능 높은 기수성을 얻기 위해 일관된 방법하에 정수 배로 재구성 가능 Ex) K500K, k250K 를 K5M, K2500K 로 바꾸어 KSEQ 가 10,000,000 까지 증가하게 하여 실험 수행 Ex) K500K, k250K 를 K5M, K2500K 로 바꾸어 KSEQ 가 10,000,000 까지 증가하게 하여 실험 수행

8 Database Systems Laboratory 8 시험 테이블 – BENCH(2) 13 개의 정수 인덱스 컬럼 13 개의 정수 인덱스 컬럼 기수성 (cardinality) – 2 ~ 500K (K2~K500K) 기수성 (cardinality) – 2 ~ 500K (K2~K500K) 무작위로 생성되어 다양한 값을 가지도록 12 개로 구성 무작위로 생성되어 다양한 값을 가지도록 12 개로 구성 KSEQ – 순서를 나타내는 정수 컬럼 KSEQ – 순서를 나타내는 정수 컬럼 크기 - 4 바이트 크기 - 4 바이트 8 개의 문자 컬럼 8 개의 문자 컬럼 데이터 저장시 압축되지 않도록 문자열 생성 데이터 저장시 압축되지 않도록 문자열 생성 ex) ‘12345678900987654321’ ex) ‘12345678900987654321’ 크기 - S1 (8 바이트 ), S2~S10 (20 바이트 ) 크기 - S1 (8 바이트 ), S2~S10 (20 바이트 )

9 Database Systems Laboratory 9 시험 테이블 – BENCH(3) 정수 인덱스 컬럼 KSEQ not null sequence[1,N] K500K random[1,N/2] K250K random[1,N/4] K100K random[1, 100000] K40K not null random[1, 40000] K10K not null random[1, 10000] K1K not null random[1, 1000] K100 not null random[1, 100] K25 not null random[1, 25] K10 not null random[1, 10] K5 not null random[1, 5] K4 not null random[1, 4] K2 not null random[1, 2] 문자 컬럼 S1 not null ‘12345678’ S2 ~ S8 not null ‘12345678900987 654321’ N: 1,000,000(defaults size) 에 정수 배

10 Database Systems Laboratory 10 평가 질의 (1) 3 개 영역의 69 개 질의 3 개 영역의 69 개 질의 문서 검색 : Q1, Q2, Q4 문서 검색 : Q1, Q2, Q4 Q1 Count, Single Exact Match: 10 개 Q1 Count, Single Exact Match: 10 개 Q2 Count ANDing two Clauses: 18 개 Q2 Count ANDing two Clauses: 18 개 Q2A AND of two exact match conditions: 9 개 Q2A AND of two exact match conditions: 9 개 Q2B NOT of an exact match condition: 9 개 Q2B NOT of an exact match condition: 9 개 Q4 Multiple Condition Selection :15 개 Q4 Multiple Condition Selection :15 개 ANDing 3 match or range conditions: 8 개 ANDing 3 match or range conditions: 8 개 ANDing 5 match or range conditions: 7 개 ANDing 5 match or range conditions: 7 개

11 Database Systems Laboratory 11 평가 질의 (2) 직접 마케팅 : Q3 직접 마케팅 : Q3 Q3 Sum, Range and Match Clause: 14 개 Q3 Sum, Range and Match Clause: 14 개 Q3A single range selection, exact match: 7 개 Q3A single range selection, exact match: 7 개 Q3B OR of multiple range selection, exact match: 7 개 Q3B OR of multiple range selection, exact match: 7 개 의사 결정 지원, 경영 보고서 : Q5, Q6 의사 결정 지원, 경영 보고서 : Q5, Q6 Q5 Multiple column GROUP BY: 3 개 Q5 Multiple column GROUP BY: 3 개 Q6 Join Condition: 9 개 Q6 Join Condition: 9 개 Q6A exact match of the first table only: 5 개 Q6A exact match of the first table only: 5 개 Q6B exact match on both tables: 4 개 Q6B exact match on both tables: 4 개

12 Database Systems Laboratory 12 실험 환경

13 Database Systems Laboratory 13 하드웨어 및 소프트웨어 하드웨어 하드웨어 CPU : Pentium III 733MHz 1 개 CPU : Pentium III 733MHz 1 개 Main Memory : 512 MB Main Memory : 512 MB HDD : 18 GB 내장 HDD 1 개 HDD : 18 GB 내장 HDD 1 개 소프트웨어 소프트웨어 운영체제 : Redhat Linux 7.2 운영체제 : Redhat Linux 7.2 Compiler: GCC 2.96 Compiler: GCC 2.96 Oracle : Oracle 9i 9.0.1 Oracle : Oracle 9i 9.0.1

14 Database Systems Laboratory 14 Oracle 9i 실험 환경 (1) 시스템 파라미터 시스템 파라미터 data_block_size: 8192 bytes(8KB) data_block_size: 8192 bytes(8KB) db_block_buffers: 6,000 blocks(48MB) db_block_buffers: 6,000 blocks(48MB) shared_pool_size: 16,384,000 bytes(16MB) shared_pool_size: 16,384,000 bytes(16MB) log_buffers : 524,288 bytes(512KB) log_buffers : 524,288 bytes(512KB) log_checkpoint_timeout: 1800 sec log_checkpoint_timeout: 1800 sec other parameters : 기본값 사용 other parameters : 기본값 사용

15 Database Systems Laboratory 15 Oracle 9i 실험 환경 (2) 데이터베이스 크기 데이터베이스 크기 Data tablespace: 1024MB Data tablespace: 1024MB Index tablespace: 1024MB Index tablespace: 1024MB Temporary tablespace: 1024MB Temporary tablespace: 1024MB 시험 대상 데이터 텍스트 크기 시험 대상 데이터 텍스트 크기 터플 수 1,000,000 개 - 210MB 터플 수 1,000,000 개 - 210MB

16 Database Systems Laboratory 16 Oracle 9i 실험 환경 (3) 질의 최적화 방법 질의 최적화 방법 비용 기반 질의 최적화 사용 비용 기반 질의 최적화 사용 시험 테이블에 대해 통계 갱신 시험 테이블에 대해 통계 갱신 ANALYZE TABLE 문 사용 ANALYZE TABLE 문 사용 Cold start 사용 Cold start 사용 하나의 질의 수행 후 메모리에 1GB 만큼 할당 한 후 다음 질의 수행 하나의 질의 수행 후 메모리에 1GB 만큼 할당 한 후 다음 질의 수행

17 Database Systems Laboratory 17 벤치마크 도구

18 Database Systems Laboratory 18 개요 작성 언어 : C 언어 작성 언어 : C 언어 DBMS Programming API DBMS Programming API OCI 사용 OCI 사용 데이터 벌크 로딩 도구 데이터 벌크 로딩 도구 Oracle 에서 제공하는 SQL*Loader 사용 Oracle 에서 제공하는 SQL*Loader 사용

19 Database Systems Laboratory 19 메뉴 구성 ******************************************** * The Set Query Benchmark Test * * The Set Query Benchmark Test ***************************************************************************************** * 1. DATA GENERATE (UniSQL, Oracle) * * 1. DATA GENERATE (UniSQL, Oracle) * * 2. TABLE CREATE AND LOAD * * 2. TABLE CREATE AND LOAD * * 3. START TEST * * 3. START TEST * * 4. DROP TABLE * * 4. DROP TABLE * * 5. QUIT * * 5. QUIT * * 6. CREATE DATABASE * * 6. CREATE DATABASE * * 7. DROP DATABASE * ******************************************** * 7. DROP DATABASE * ********************************************

20 Database Systems Laboratory 20 제어 흐름 메뉴 query 결과 파일 Create/Drop DB Create/Drop DB generate 자료 파일 데이터베이스 응답 시간 결과 테스트 수행 선택 데이터 생성 선택 파일 생성 데이터베이스 생성 / 삭제 선택 데이터베이스 생성 / 삭제 SQL*LOADER 벌크 로딩 Create/Drop table Create/Drop table 인덱스 생성 / 테이블 통계정보 생성 테이블 생성 / 삭제 선택 각 트랜잭션 수행 결과 파일 질의 결과

21 Database Systems Laboratory 21 데이터 생성 pseudo-random number generator PROCEDURE FIELDVGEN()/* Procedure to generate indexed field values */ INTEGER I, J; /* Looping Variables */ DOUBLE SEED INIT (1.); /* Seed For Random Number Generation */ INTEGER ARRAY COLVAL(1:12), /* Array to hold one row of values */ COLCARD(1:12) /* Array holding largest value in each field */ INIT (500000,250000,100000,40000,10000,1000,100,25,10,5,4,2);/* Initialize */ FOR I FROM 1 TO 1000000; /* One Million Rows */ FOR J FROM 1 TO 12; /* Twelve randomly generated column values */ SEED = MOD(16807.0D * SEED, 2147483647.0D); /* I.E.: Si+1 = (7**5 * Si ) MOD (2**31-1), where Si is SEED, a random # */ COLVAL(J) = MOD(SEED, COLCARD(J) )+1; /* Generate next column value */ END FOR J /* Row complete */ PRINT COLVAL VALUES FOR THIS ROW TO OUTPUT;/*Output row's values*/ END FOR I /* We have generated One Million Rows */ END

22 Database Systems Laboratory 22 데이터 벌크 로딩 결과 로딩 시간 850.48 초 (14 분 10 초 ) CPU 사용 시간 91.55 초 (1 분 31 초 ) BENCH 테이블 크기 29,416 blocks (240,975,872 bytes)

23 Database Systems Laboratory 23 실험 결과

24 Database Systems Laboratory 24 Count, Single Exact Match – Q1 Q1: Count,Single Exact Match Q1: Count,Single Exact Match SELECT COUNT(*) FROM BENCH SELECT COUNT(*) FROM BENCH WHERE KN = 2; KN ε {KSEQ, K100K, …, K4, K2} KN ε {KSEQ, K100K, …, K4, K2} 수행 계획 수행 계획 INDEX RANGE SCAN – KSEQ, K100K, K10K, K1K, K100,K25, K10 INDEX RANGE SCAN – KSEQ, K100K, K10K, K1K, K100,K25, K10 INDEX FAST FULL SCAN – K5, K4, K2 INDEX FAST FULL SCAN – K5, K4, K2

25 Database Systems Laboratory 25 Count, Single Exact Match – Q1 Q1 ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read KSEQ 1회1회1회1회0.6050.079355120.6310.08135515 2회2회2회2회0.6370.081355120.6600.08135512 3회3회3회3회0.3000.081355130.6360.07935512 K100K 1회1회1회1회3.9240.236530.0850.00553 2회2회2회2회4.4560.213530.0850.00553 3회3회3회3회4.8320.241530.0860.00553

26 Database Systems Laboratory 26 Count, Single Exact Match – Q1 Q1 ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K10K 1회1회1회1회5.6170.249530.1000.00553 2회2회2회2회5.1640.259530.0830.00553 3회3회3회3회5.2410.259530.0830.00553 K1K 1회1회1회1회5.2070.295750.0930.00775 2회2회2회2회5.2250.278750.0940.00675 3회3회3회3회7.7060.251750.0930.00675

27 Database Systems Laboratory 27 Count, Single Exact Match – Q1 Q1 ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K100 1회1회1회1회5.2840.35025230.1030.0132523 2회2회2회2회4.9880.46625230.1030.0132523 3회3회3회3회5.7140.36125230.1030.0132523 K25 1회1회1회1회5.4790.48583810.1260.0358381 2회2회2회2회5.8490.48683810.1320.0358381 3회3회3회3회5.6720.50583810.1330.0358381

28 Database Systems Laboratory 28 Count, Single Exact Match – Q1 Q1 ColdNo-cold Elapsed time CPU time Logical read Physical read Elapse d time CPU time Logical read Physic al read K10 1회1회1회1회5.8620.5382001980.1960.080200198 2회2회2회2회6.0980.6692001980.1970.080200198 3회3회3회3회6.2470.7172001980.2020.080200198 K5 1회1회1회1회12.1842.0811,9741,9600.8570.5641,9741,960 2회2회2회2회12.2181.4971,9741,9600.8470.5571,9741,960 3회3회3회3회10.0861.1371,9741,9600.8540.5641,9761,960

29 Database Systems Laboratory 29 Count, Single Exact Match – Q1 Q1 ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physica l read K4 1회1회1회1회12.5153.5131,9711,9600.8920.5641,9711,960 2회2회2회2회12.4672.0001,9711,9600.8530.5641,9711,960 3회3회3회3회12.6181.9931,9711,9600.8580.5621,9711,960 K2 1회1회1회1회10.9882.7761,9711,9600.8650.5751,9711,960 2회2회2회2회11.7731.9291,9711,9600.9130.5711,9711,960 3회3회3회3회12.0791.9161,9711,9600.9130.5671,9711,960

30 Database Systems Laboratory 30 Count ANDing two Clauses – Q2 Q2: Count AND ing Two Clauses Q2: Count AND ing Two Clauses Q2A: AND of two exact match conditions Q2A: AND of two exact match conditions SELECT COUNT(*) FROM BENCH SELECT COUNT(*) FROM BENCH WHERE K2 = 2 AND KN = 3; KN ε {KSEQ, K100K, …, K4} KN ε {KSEQ, K100K, …, K4} 수행 계획 수행 계획 1. INDEX RANGE SCAN: KN 1. INDEX RANGE SCAN: KN 2. INDEX RANGE SCAN: K2 2. INDEX RANGE SCAN: K2

31 Database Systems Laboratory 31 Count ANDing two Clauses – Q2 Q2A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read KSEQ 1회1회1회1회5.0710.297410.1020.007106 2회2회2회2회4.9590.354410.0740.00541 3회3회3회3회5.1950.382410.0720.00541 K100K 1회1회1회1회5.2881.18986200.4620.3858620 2회2회2회2회4.9191.14086200.4630.3898580 3회3회3회3회6.1571.19286200.4640.3858620

32 Database Systems Laboratory 32 Count ANDing two Clauses – Q2 Q2A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapse d time CPU time Logical read Physical read K10K 1회1회1회1회6.0410.92998200.5430.4661200 2회2회2회2회5.6971.06998200.5440.4661200 3회3회3회3회5.8271.07398200.5450.4629820 K1K 1회1회1회1회5.7010.98998420.5520.4739842 2회2회2회2회5.8231.03398420.5520.4699842 3회3회3회3회5.8951.14198420.5510.4689842

33 Database Systems Laboratory 33 Count ANDing two Clauses – Q2 Q2A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapse d time CPU time Logical read Physical read K100 1회1회1회1회6.0121.0721,001190.5690.4851,00119 2회2회2회2회5.8981.0911,001190.5690.4851,00119 3회3회3회3회5.6781.1761,001190.5780.4931,00119 K25 1회1회1회1회6.1561.4601,060780.6360.5291,06078 2회2회2회2회5.7621.1201,060780.6340.5301,06078 3회3회3회3회6.5821.3781,060780.6420.5301,06078

34 Database Systems Laboratory 34 Count ANDing two Clauses – Q2 Q2A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K10 1회1회1회1회7.1551.7461,1771950.7180.6021,177195 2회2회2회2회7.3461.8481,1771950.7200.6031,177195 3회3회3회3회7.0561.6941,1771950.7320.6011,177195 K5 1회1회1회1회6.8552.2971,37300.8330.7361,3730 2회2회2회2회5.7841.5431,37300.8280.7321,3730 3회3회3회3회6.2341.5331,37300.8280.7311,3730

35 Database Systems Laboratory 35 Count ANDing two Clauses – Q2 Q2A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K4 1회1회1회1회6.3831.5031,47000.8810.7841,4700 2회2회2회2회6.2681.5641,47000.8800.7821,4700 3회3회3회3회6.3181.5331,47000.8870.7881,4700

36 Database Systems Laboratory 36 Count ANDing two Clauses – Q2 Q2: Count AND ing Two Clauses Q2: Count AND ing Two Clauses Q2B: NOT of an exact match conditions Q2B: NOT of an exact match conditions SELECT COUNT(*) FROM BENCH SELECT COUNT(*) FROM BENCH WHERE K2 = 2 AND NOT KN = 3; KN ε {KSEQ, K100K, …, K4} KN ε {KSEQ, K100K, …, K4} 수행 계획 수행 계획 1. INDEX RANGE SCAN: K2 1. INDEX RANGE SCAN: K2 2. INDEX RANGE SCAN: KN 2. INDEX RANGE SCAN: KN

37 Database Systems Laboratory 37 Count ANDing two Clauses – Q2 Q2B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read KSEQ 1회1회1회1회5.7441.00998200.5530.4709820 2회2회2회2회5.8341.26798200.5560.4749820 3회3회3회3회6.2471.21998200.5530.4749820 K100K 1회1회1회1회5.9460.87998200.5680.4839820 2회2회2회2회6.2991.01198200.5700.4849820 3회3회3회3회5.7410.93298200.5770.4849820

38 Database Systems Laboratory 38 Count ANDing two Clauses – Q2 Q2B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K10K 1회1회1회1회5.9630.94498200.5700.4919820 2회2회2회2회5.6280.89098200.5720.4889820 3회3회3회3회5.6210.90398200.5690.4859820 K1K 1회1회1회1회6.7000.96598400.5670.4859840 2회2회2회2회5.8820.93798400.5700.4879840 3회3회3회3회5.9660.96498400.5700.4869840

39 Database Systems Laboratory 39 Count ANDing two Clauses – Q2 Q2B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapse d time CPU time Logical read Physica l read K100 1회1회1회1회5.5780.9871,00100.5800.4961,0010 2회2회2회2회5.6181.1621,00100.5830.4991,0010 3회3회3회3회5.7450.9501,00100.5820.4981,0010 K25 1회1회1회1회5.9131.1881,06000.6210.5361,0600 2회2회2회2회5.7921.0591,06000.6210.540590 3회3회3회3회5.2541.0681,06000.6220.5401,0600

40 Database Systems Laboratory 40 Count ANDing two Clauses – Q2 Q2B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K10 1회1회1회1회6.0061.3121,17700.6860.5981,1770 2회2회2회2회5.8981.4061,17700.6870.5981,1770 3회3회3회3회5.7571.2401,17700.6870.5961,1770 K5 1회1회1회1회6.2181.4981,37300.8240.7301,3730 2회2회2회2회6.4191.6851,37300.8220.7311,3730 3회3회3회3회6.3641.4011,37300.8230.7271,3730

41 Database Systems Laboratory 41 Count ANDing two Clauses – Q2 Q2B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K4 1회1회1회1회6.3761.5161,47000.8860.7921,4700 2회2회2회2회6.2741.5921,47000.8740.7761,4700 3회3회3회3회6.5741.5721,47000.8770.7781,4700

42 Database Systems Laboratory 42 Sum, Range and Match – Q3 Q3: Sum, Range and Match Clause Q3: Sum, Range and Match Clause Q3A: the values of an integer binary column Q3A: the values of an integer binary column SELECT SUM(K1K) FROM BENCH SELECT SUM(K1K) FROM BENCH WHERE KSEQ BETWEEN 400000 AND 500000 AND KN = 3; KN ε {K100K, …, K4} KN ε {K100K, …, K4} 수행 계획 수행 계획 One time index One time index INDEX KN RANGE SCAN – K100K, K10K INDEX KN RANGE SCAN – K100K, K10K INDEX KSEQ RANGE SCAN – K10, K5, K4 INDEX KSEQ RANGE SCAN – K10, K5, K4 Two times indexes – K100, K25 Two times indexes – K100, K25 1. INDEX RANGE SCAN: KN 1. INDEX RANGE SCAN: KN 2. INDEX RANGE SCAN: KSEQ 2. INDEX RANGE SCAN: KSEQ

43 Database Systems Laboratory 43 Sum, Range and Match – Q3 Q3A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K100K 1회1회1회1회7.7790.88414110.1750.0051411 2회2회2회2회6.2050.93014110.1710.0061411 3회3회3회3회5.4090.54114110.1760.0061411 K10K 1회1회1회1회7.9891.429100970.7530.01110097 2회2회2회2회8.2961.281100970.7650.01010097 3회3회3회3회7.8121.435100970.7530.01010097

44 Database Systems Laboratory 44 Sum, Range and Match – Q3 Q3A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K100 1회1회1회1회15.9784.7403,1601,2863.0822.0383,3501,298 2회2회2회2회15.9314.3503,2071,2903.0752.0132,2261,294 3회3회3회3회15.9715.1572,9731,2893.0821.9722,2121,293 K25 1회1회1회1회10.1932.8502,4831,7431.0190.8372,4831,743 2회2회2회2회10.4092.5802,4831,7431.0370.8582,4831,743 3회3회3회3회10.9822.6192,4831,7431.0250.8442,4831,743

45 Database Systems Laboratory 45 Sum, Range and Match – Q3 Q3A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapse d time CPU time Logical read Physica l read K10 1회1회1회1회10.6954.4613,1685240.4560.3513,168524 2회2회2회2회10.9404.5203,1685240.4560.3513,168524 3회3회3회3회11.0833.8483,1685240.4600.3493,168524 K5 1회1회1회1회6.1101.2683,16800.4370.3593,1680 2회2회2회2회6.0051.2553,16800.4370.3583,1680 3회3회3회3회6.1251.3193,16800.4360.3573,1680

46 Database Systems Laboratory 46 Sum, Range and Match – Q3 Q3A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K4 1회1회1회1회6.4541.3033,16800.4420.3653,1680 2회2회2회2회5.8931.3253,16800.4480.3693,1680 3회3회3회3회6.0291.2993,16800.4450.37000

47 Database Systems Laboratory 47 Sum, Range and Match – Q3 Q3: Sum, Range and Match Clause Q3: Sum, Range and Match Clause Q3B: OR Q3B: OR SELECT SUM(K1K) FROM BENCH SELECT SUM(K1K) FROM BENCH WHERE (KSEQ BETWEEN 400000 AND 410000 OR KSEQ BETWEEN 420000 AND 430000 OR KSEQ BETWEEN 440000 AND 450000 OR KSEQ BETWEEN 460000 AND 470000 OR KSEQ BETWEEN 480000 AND 500000) AND KN = 3; KN ε {K100K, …, K4} KN ε {K100K, …, K4}

48 Database Systems Laboratory 48 Sum, Range and Match – Q3 수행 계획 수행 계획 K100K, K10K - INDEX KN RANGE SCAN K100K, K10K - INDEX KN RANGE SCAN K100, K25 K100, K25 INDEX KN RANGE SCAN INDEX KN RANGE SCAN INDEX KSEQ RANGE SCAN – five times INDEX KSEQ RANGE SCAN – five times K10, K5, K4 K10, K5, K4 INDEX KSEQ RANGE SCAN – five times INDEX KSEQ RANGE SCAN – five times

49 Database Systems Laboratory 49 Sum, Range and Match – Q3 Q3B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K100K 1회1회1회1회5.0570.4421400.0700.008140 2회2회2회2회5.3790.3431400.0700.008140 3회3회3회3회4.9480.3521400.0710.008140 K10K 1회1회1회1회5.6611.00010000.0700.0111000 2회2회2회2회7.3322.56210000.0690.0101000 3회3회3회3회5.7370.86810000.0710.0101000

50 Database Systems Laboratory 50 Sum, Range and Match – Q3 Q3B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K100 1회1회1회1회6.8371.937686400.3780.30368640 2회2회2회2회6.8241.895686400.3690.29568640 3회3회3회3회6.7801.880686400.4150.33868640 K25 1회1회1회1회6.8441.8291,532400.4050.3281,53240 2회2회2회2회6.1671.9561,532400.4250.3471,53240 3회3회3회3회6.5911.8261,532400.4230.3491,53240

51 Database Systems Laboratory 51 Sum, Range and Match – Q3 Q3B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapse d time CPU time Logical read Physica l read K10 1회1회1회1회7.6192.8391,91800.3030.2311,9180 2회2회2회2회7.5482.6621,91800.3040.2311,9180 3회3회3회3회7.6262.4821,91800.3060.2381,9180 K5 1회1회1회1회5.7530.9061,91800.3350.2481,9180 2회2회2회2회6.3631.0931,91800.3300.2481,9180 3회3회3회3회5.6281.0991,91800.3330.2481,9180

52 Database Systems Laboratory 52 Sum, Range and Match – Q3 Q3B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K4 1회1회1회1회7.4820.8661,91800.3250.2531,9180 2회2회2회2회4.5980.8831,91800.3280.2551,9180 3회3회3회3회5.6280.8301,91800.3290.2551,9180

53 Database Systems Laboratory 53 Multiple Condition Selection – Q4 Q4: Multiple Condition Selection Q4: Multiple Condition Selection Q4A: ANDing 3 Q4A: ANDing 3 SELECT KSEQ, K500K FROM BENCH SELECT KSEQ, K500K FROM BENCH WHERE constraint with 3 conditions; Condition Sequence Condition Sequence (1) K2 =1(2) k100 > 80 (3) K10K BETWEEN 2000 AND 3000(4) K5 = 3 (5) K25 IN (11, 19)(6) K4 = 3 (7) K100 < 41 (8) K1K BETWEEN 850 AND 950 (9) K10 = 7(10) K25 IN (3, 4)

54 Database Systems Laboratory 54 Multiple Condition Selection – Q4 수행 계획 수행 계획 (1)~(3), (6)~(8) - TABLE FULL SCAN (1)~(3), (6)~(8) - TABLE FULL SCAN INDEX K25 RANGE SCAN – two times INDEX K25 RANGE SCAN – two times Query contain (5), (10) condition Query contain (5), (10) condition (3)~(5), (4)~(6), (5)~(7), (8)~(10) (3)~(5), (4)~(6), (5)~(7), (8)~(10) INDEX RANGE SCAN in order high selectivity INDEX RANGE SCAN in order high selectivity

55 Database Systems Laboratory 55 Multiple Condition Selection – Q4 Q4A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read 1~3 1회1회1회1회21.5488.85134,30726,3768.7843.20434,30726,376 2회2회2회2회21.3538.89934,30726,37612.0783.18334,30726,376 3회3회3회3회20.4428.34134,30726,3768.7103.17634,30726,376 2~4 1회1회1회1회32.81412.44611,7195,14013.9489.54112,1365,153 2회2회2회2회30.34312.33812,2435,14012.1759.42111,9615,149 3회3회3회3회33.95912.13111,2935,14518.0449.81812,1265,154

56 Database Systems Laboratory 56 Multiple Condition Selection – Q4 Q4A ColdNo-cold Elapsed time CPU time Logical read Physic al read Elapse d time CPU time Logical read Physical read 3~5 1회1회1회1회23.9065.9442,3992,2343.5842.1452,3991,981 2회2회2회2회22.6045.8852,3991,9423.1792.2462,3992,011 3회3회3회3회21.6056.7362,3992,2644.8892.3142,3992,011 4~6 1회1회1회1회24.4755.1694,9383,4764.3151.0974,9383,275 2회2회2회2회25.1435.2794,9383,4333.0671.0694,9382,982 3회3회3회3회24.3685.2164,9383,4917.2471.1004,9382,983

57 Database Systems Laboratory 57 Multiple Condition Selection – Q4 Q4A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapse d time CPU time Logical read Physical read 5~7 1회1회1회1회30.0486.64016,26613,1317.3401.70916,26613,195 2회2회2회2회30.8487.29116,26613,0798.1241.73016,26613,487 3회3회3회3회29.3447.05616,26613,1408.6271.70816,26613,305 6~8 1회1회1회1회36.55621.30034,39422,1448.4533.05534,39422,555 2회2회2회2회33.70019.35234,39422,1378.0013.03334,39422,614 3회3회3회3회34.16919.69334,39422,1458.8843.03734,39422,550

58 Database Systems Laboratory 58 Multiple Condition Selection – Q4 Q4A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read 7~9 1회1회1회1회24.2095.2439,1728,2949.9842.5679,1728,436 2회2회2회2회24.4165.4109,1728,2934.2122.5829,1728,453 3회3회3회3회24.1055.3059,1728,29910.8632.6559,1728,433 8~10 1회1회1회1회13.7754.6591,3671,4032.7052.0361,3671,421 2회2회2회2회13.7124.4881,3671,4072.2971.9891,3671,339 3회3회3회3회15.3215.3191,3671,4053.3382.0251,3671,421

59 Database Systems Laboratory 59 Multiple Condition Selection – Q4 Q4: Multiple Condition Selection Q4: Multiple Condition Selection Q4B: ANDing 5 Q4B: ANDing 5 SELECT KSEQ, K500K FROM BENCH SELECT KSEQ, K500K FROM BENCH WHERE constraint with 5 conditions; Condition Sequence Condition Sequence (1) K2 =1(2) k100 > 80 (3) K10K BETWEEN 2000 AND 3000(4) K5 = 3 (5) K25 IN (11, 19)(6) K4 = 3 (7) K100 < 41 (8) K1K BETWEEN 850 AND 950 (9) K10 = 7(10) K25 IN (3, 4)

60 Database Systems Laboratory 60 Multiple Condition Selection – Q4 수행 계획 수행 계획 INDEX K25 RANGE SCAN – two times INDEX K25 RANGE SCAN – two times Query contain (5), (10) condition Query contain (5), (10) condition INDEX RANGE SCAN in order high selectivity INDEX RANGE SCAN in order high selectivity

61 Database Systems Laboratory 61 Multiple Condition Selection – Q4 Q4B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read 1~5 1회1회1회1회18.5686.8942,5321,9603.3002.5352,5322,057 2회2회2회2회17.2596.8322,5321,9493.1592.6642,5322,094 3회3회3회3회18.2187.3462,5321,9453.8622.7332,5321,960 2~6 1회1회1회1회11.1434.8921,6569012.5992.2471,656724 2회2회2회2회10.8674.9391,6568912.5482.2791,656905 3회3회3회3회11.0254.8971,6569032.5462.2781,656886

62 Database Systems Laboratory 62 Multiple Condition Selection – Q4 Q4B ColdNo-cold Elapsed time CPU time Logical read Physic al read Elapse d time CPU time Logical read Physical read 3~7 1회1회1회1회7.9713.0631,6563962.4222.2441,656396 2회2회2회2회7.9102.8701,6563962.5062.3201,656396 3회3회3회3회7.9963.0141,6563962.4992.3121,656396 4~8 1회1회1회1회12.6504.4221,6556792.5612.2091,655681 2회2회2회2회12.3384.3541,6556712.5762.2881,655681 3회3회3회3회12.6244.5711,655680 2.944 2.9442.2861,655680

63 Database Systems Laboratory 63 Multiple Condition Selection – Q4 Q4B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapse d time CPU time Logical read Physical read 5~9 1회1회1회1회24.2505.3992,7471,5341.5610.5962,7471,550 2회2회2회2회28.5555.6742,7471,5361.1320.6052,7471,568 3회3회3회3회26.9938.0782,7471,5372.9550.6032,7471,556 6~10 1회1회1회1회26.6604.9392,7891,6771.6860.6042,7891,689 2회2회2회2회24.6495.3582,7891,6751.1460.6064263 3회3회3회3회25.9525.3562,7891,6763.0860.61342142

64 Database Systems Laboratory 64 Multiple Condition Selection – Q4 Q4B ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read 7~1 1회1회1회1회16.4855.1801,3626932.0451.8601,362702 2회2회2회2회14.5905.2211,3626962.1701.9851,362698 3회3회3회3회14.3345.0411,3626962.1621.9731,362704

65 Database Systems Laboratory 65 Multiple Column GROUP BY – Q5 Q5: Multiple Column GROUP BY Q5: Multiple Column GROUP BY SELECT KN1, KN2, COUNT(*) FROM BENCH SELECT KN1, KN2, COUNT(*) FROM BENCH GROUP BY KN1, KN2; (KN1, KN2) ε { (K2, K100), (K10, K25), (K10, K25) } (KN1, KN2) ε { (K2, K100), (K10, K25), (K10, K25) } 수행 계획 수행 계획 TABLE FULL SCAN TABLE FULL SCAN

66 Database Systems Laboratory 66 Multiple Column GROUP BY – Q5 Q5 ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K2,K100 1회1회1회1회44.93233.58429,42823,3059.0614.48129,42824,632 2회2회2회2회43.69531.63129,42823,2888.6664.48729,42825,072 3회3회3회3회47.03534.56029,42823,2959.0894.46729,42824,489 K4,K25 1회1회1회1회26.85813.19729,42823,3054.6133.86129,42823,112 2회2회2회2회28.93612.22029,42823,2994.5713.82229,42823,197 3회3회3회3회24.13511.96029,42823,30510.7954.07729,42823,269

67 Database Systems Laboratory 67 Multiple Column GROUP BY – Q5 Q3A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapse d time CPU time Logical read Physical read K10,K25 1회1회1회1회24.49012.24029,42823,3055.3564.51329,42823,112 2회2회2회2회25.18012.59929,42823,2994.9534.15929,42823,197 3회3회3회3회25.99012.71529,42823,3068.8054.34629,42823,269

68 Database Systems Laboratory 68 Multiple Condition Selection – Q6 Q6: Multiple Condition Selection Q6: Multiple Condition Selection Q6A: equality condition limiting the rows of the first table only Q6A: equality condition limiting the rows of the first table only SELECT COUNT(*) FROM BENCH B1, BENCH B2 SELECT COUNT(*) FROM BENCH B1, BENCH B2 WHERE B1.KN = 49 AND B1.K250K = B2.K500K; KN1 ε { K100K, K40K, K10K, K1K, K100 } KN1 ε { K100K, K40K, K10K, K1K, K100 }

69 Database Systems Laboratory 69 Multiple Condition Selection – Q6 수행 계획 수행 계획 K100K, K40K, K10K K100K, K40K, K10K NESTED LOOPS NESTED LOOPS 1. INDEX RANGE SCAN: KN 1. INDEX RANGE SCAN: KN 2. INDEX RANGE SCAN: K500K 2. INDEX RANGE SCAN: K500K K1K K1K HASH JOIN HASH JOIN 1. INDEX RANGE SCAN: K1K 1. INDEX RANGE SCAN: K1K 2. INDEX FAST FULL SCAN: K500K 2. INDEX FAST FULL SCAN: K500K K100 K100 HASH JOIN HASH JOIN 1. INDEX RANGE SCAN: K100 1. INDEX RANGE SCAN: K100 2. INDEX FAST FULL SCAN: K250K 2. INDEX FAST FULL SCAN: K250K 3. INDEX FAST FULL SCAN: K500K 3. INDEX FAST FULL SCAN: K500K

70 Database Systems Laboratory 70 Multiple Condition Selection – Q6 Q5 ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K100K 1회1회1회1회6.9670.57365350.2890.0546536 2회2회2회2회6.9380.66265350.2690.0436537 3회3회3회3회6.3340.63665350.3180.0626536 K40K 1회1회1회1회6.8840.806120530.2350.01112054 2회2회2회2회7.4120.719120530.2340.01112052 3회3회3회3회6.7320.740120530.2940.01112054

71 Database Systems Laboratory 71 Multiple Condition Selection – Q6 Q5 ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K10K 1회1회1회1회10.0071.5934391790.5100.018439180 2회2회2회2회9.8211.4594391800.5520.018439183 3회3회3회3회10.1301.5034391800.6650.018439180 K1K 1회1회1회1회23.4244.1353,2292,8761.3750.9623,2292,876 2회2회2회2회23.0684.1543,2292,8761.4120.9733,2292,875 3회3회3회3회25.3434.9793,2292,8722.3020.9793,2292,884

72 Database Systems Laboratory 72 Multiple Condition Selection – Q6 Q3A ColdNo-cold Elapsed time CPU time Logical read Physical read Elapse d time CPU time Logical read Physical read K100 1회1회1회1회15.9953.3694,5034,4702.8152.3044,5034,484 2회2회2회2회16.2843.6154,5034,4692.8002.2971,2741,609 3회3회3회3회16.3573.4044,5034,4692.9282.3461,2741,600

73 Database Systems Laboratory 73 Multiple Condition Selection – Q6 Q6: Multiple Condition Selection Q6: Multiple Condition Selection Q6B: equality conditions limit the rows on both tables Q6B: equality conditions limit the rows on both tables SELECT B1.KSEQ, B2.KSEQ FROM BENCH B1, BENCH B2 SELECT B1.KSEQ, B2.KSEQ FROM BENCH B1, BENCH B2 WHERE B1.KN = 99 AND B1.K250K = B2.K500K AND B2.K25 = 19; KN1 ε { K40K, K10K, K1K, K100 } KN1 ε { K40K, K10K, K1K, K100 }

74 Database Systems Laboratory 74 Multiple Condition Selection – Q6 수행 계획 수행 계획 K100K, K40K, K10K, K1K K100K, K40K, K10K, K1K NESTED LOOPS NESTED LOOPS 1. INDEX RANGE SCAN: KN 1. INDEX RANGE SCAN: KN 2. INDEX RANGE SCAN: K500K 2. INDEX RANGE SCAN: K500K K100 K100 HASH JOIN HASH JOIN TABLE FULL SCAN – two times TABLE FULL SCAN – two times

75 Database Systems Laboratory 75 Multiple Condition Selection – Q6 Q5 ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K100K 1회1회1회1회7.2821.052155690.1750.03015568 2회2회2회2회7.4431.176155690.1660.03215568 3회3회3회3회7.4501.119155690.2710.03615568 K40K 1회1회1회1회11.4782.5686783040.2790.031678304 2회2회2회2회12.2152.8876783030.2660.027678304 3회3회3회3회12.8253.2096783030.7300.028678307

76 Database Systems Laboratory 76 Multiple Condition Selection – Q6 Q5 ColdNo-cold Elapsed time CPU time Logical read Physical read Elapsed time CPU time Logical read Physical read K1K 1회1회1회1회38.3116.5136,0702,8951.8870.1935,3922,598 2회2회2회2회43.9158.0476,0702,9081.7900.1926,0702,909 3회3회3회3회42.1057.2946,0702,8966.8340.1986,0702,911 K100 1회1회1회1회47.63225.33859,24648,33617.2513.36959,24648,141 2회2회2회2회52.77831.44259,24648,07416.6353.35053,17645,403 3회3회3회3회45.18530.36559,24648,33417.8163.44659,24648,404

77 Database Systems Laboratory 77 결 론 (1) $/QPS (Price per Queries Per Second) $/QPS (Price per Queries Per Second) 실험에 사용한 하드웨어 및 소프트웨어 가격정 보 불충분으로 제시하지 못함 실험에 사용한 하드웨어 및 소프트웨어 가격정 보 불충분으로 제시하지 못함 수행 결과 수행 결과 질의 수행 결과를 파일로 제공 질의 수행 결과를 파일로 제공 질의 수행 시 응답시간, CPU 사용시간, 논리적 / 물리적 읽기 블록 수의 결과를 질의당 파일에 기록하여 제공 질의 수행 시 응답시간, CPU 사용시간, 논리적 / 물리적 읽기 블록 수의 결과를 질의당 파일에 기록하여 제공

78 Database Systems Laboratory 78 결 론 (2) 질의 수행 결과 검증 질의 수행 결과 검증 Set Query 논문 부록 A 의 결과와 동일한 결과 Set Query 논문 부록 A 의 결과와 동일한 결과 Set Query 논문의 데이터 생성기 알고리즘으로 구 현한 데이터의 올바름을 입증 Set Query 논문의 데이터 생성기 알고리즘으로 구 현한 데이터의 올바름을 입증 시스템 통계 시스템 통계 CPU 사용시간, 논리적 / 물리적 읽기 블록 수 CPU 사용시간, 논리적 / 물리적 읽기 블록 수 Set Query 논문에서는 DBMS 제공 툴 사용 수집 Set Query 논문에서는 DBMS 제공 툴 사용 수집 Oralce 9i 에서 제공하는 view 테이블 이용 수집 Oralce 9i 에서 제공하는 view 테이블 이용 수집


Download ppt "Set Query for Oracle 9.0.1 이우진, 이상협 숭실대학교 컴퓨터학과 June 2002."

Similar presentations


Ads by Google