Advanced DatabaseTechniquesAdvanced DatabaseTechniques Optimisation & Performance Tuning University of Derby - School of Maths & Computing University of Derby 2000 ORACLE SERVER Remote Host Applications Web Server PC-LAN server Object Oriented Server (e.g.UNIX box) O-O workstations PCs Clients ISDN Web Server Internet TYPICAL ORACLE SERVER ENVIRONMENT Remote Web Browser Clients
Advanced DatabaseTechniquesAdvanced DatabaseTechniques Optimisation & Performance Tuning University of Derby - School of Maths & Computing University of Derby 2000 DATABASE PERFORMANCE OPTIMISATION APPLICATIONS TUNING SERVER OPTIMISATION Parallel Processing Indexing Clustering Monitoring Execution Plan SQL statement tuning Transaction logic tuning Client/server performance Query Optimiser
Advanced DatabaseTechniquesAdvanced DatabaseTechniques Optimisation & Performance Tuning University of Derby - School of Maths & Computing University of Derby 2000 Explain Plan EXPLAIN PLAN SET STATEMENT_ID ‘Derby students try1’ INTO PLAN_TABLE FOR SELECT LASTNAME,FIRSTNAME FROM STUDENTS WHERE UNIVERSITY = ‘DERBY’; We can then proceed to perform a simple query on the PLAN_TABLE as follows
Advanced DatabaseTechniquesAdvanced DatabaseTechniques Optimisation & Performance Tuning University of Derby - School of Maths & Computing University of Derby 2000 Query on Plan Table SELECT STATEMENT_ID, OPERATION, OPTIONS, COST FROM PLAN_TABLE; STATEMENT_IDOPERATIONOPTIONSCOST Derby students try1SELECT STATEMENT 30 Derby students try1TABLE ACCESSFULL ACCESS 0 Oracle has made a full scan of the database because no index is available possibly because the DBA has not ‘analyzed’ the table to produce statistics for the optimiser to use. This is easily corrected as follows.
Advanced DatabaseTechniquesAdvanced DatabaseTechniques Optimisation & Performance Tuning University of Derby - School of Maths & Computing University of Derby 2000 ANALYZE TABLE STUDENTS COMPUTE STATISTICS; EXPLAIN PLAN SET STATEMENT_ID ‘Derby students try2’ INTO PLAN_TABLE FOR SELECT LASTNAME,FIRSTNAME FROM STUDENTS WHERE UNIVERSITY = ‘DERBY’; SELECT STATEMENT_ID, OPERATION, OPTIONS, COST FROM PLAN_TABLE; STATEMENT_IDOPERATIONOPTIONSCOST Derby students try1SELECT STATEMENT 30 Derby students try1TABLE ACCESSFULL ACCESS 0 Derby students try2SELECT STATEMENT 5 Derby students try2TABLE ACCESSBY ROWID 0 Derby students try2INDEX RANGE SCAN 1