TAILIEUCHUNG - ORACLE8i- P20

ORACLE8i- P20: We want information information.” Possibly you recognize these words as the primary interest of a somewhat clandestine group, and as told by a character called Number 2 to Patrick McGoohan’s character Number 6 (in the old TV show The Prisoner). Indeed, in this day, information is king, and the speedy, accurate, and reliable retrieval of this information is paramount. | 756 I CHAPTER 16 ORACLE8i SQL PERFORMANCE MONITORING AND TUNING which results in the following execution plan and statistics from Autotrace Elapsed 00 00 Execution Plan 0 SELECT STATEMENT Optimizer RULE 1 0 NESTED LOOPS 2 1 TABLE ACCESS BY INDEX ROWID OF EMPLOYEE 3 2 INDEX RANGE SCAN OF ID_EMP NON-UNIQUE 4 1 INDEX RANGE SCAN OF ID_DEPT NON-UNIQUE Statistics 0 recursive calls 0 db block gets 24 consistent gets 0 physical reads 14 rows processed Notice the index lookup on the EMPLOYEE and DEPT tables. Every employee in EMPLOYEE is a member of the research department. Notice also that EMPLOYEE is the driving table. We know that DEPT is going to be a better driving table however because only one row is needed from it as compared to reading every row from EMPLOYEE . So we re scanning the index on the EMPLOYEE table for every employee and then we have to scan the DEPT index for every row in the EMPLOYEE table. This is costing us 24 consistent gets. What if we just did a full table scan of the EMPLOYEE table We re reading every row anyway so wouldn t it help Let s see. To force the optimizer to do a full table scan append a 0 to the left side of the EMPNO 7800 line in the WHERE clause SELECT empno dname FROM dept b EMPLOYEE a WHERE dname RESEARCH and empno 0 7950 and In the following output you ll see there s not much improvement. In fact we ve managed to increase the number of logical I Os by 12. Also the runtime has about doubled. Elapsed 00 00 Execution Plan 0 SELECT STATEMENT Optimizer RULE Please purchase PDF Split-Mewon to removetthia watermark. TUNING SQL STATEMENTS 757 1 0 NESTED LOOPS 2 1 TABLE ACCESS FULL OF EMPLOYEE 3 1 INDEX RANGE SCAN OF ID_DEPT NON-UNIQUE Statistics 0 recursive calls 12 db block gets 24 consistent gets 0 physical reads 0 sorts memory 0 sorts disk 14 rows processed Tuning is an iterative thing so you try and try again. Let s try again. We know we want DEPT to be the driving table. Let s disable .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.