Documente Academic
Documente Profesional
Documente Cultură
Bert.Scalzo@Quest.com
About the Author
What is Tunable:
Hardware
Operating System
Database
Network
Application
Network
Hardware
OS
DBMS
Application
Where Should We Look
Network
Hardware
OS
DBMS
Application
Hardware Wont Compensate
CPU Disk IO
SMP 15,000 RPM
MPP RAID (EMC)
OS Oracle
UNIX OPS / PQO
64-bit 64-bit
Hardware Tuning Example
Pros:
DBAs tend to know SQL very well
Cons:
DBAs often focus more on OS and RDBMS
DBAs often dont know the application code
DBAs often dont know the datas nature
DBAs often dont know the business rules
DBAs generally have way too much to do
Proactive: TOAD Proc Editor
Proactive: TOAD SQL Editor
Proactive: TOAD SQL Tuning
Proactive Summary
Pros:
Developers focus is application code & data
Developers know the relevant business rules
Cons:
Developers must take time to identify problem
code
Developers often dont tune SQL as well as DBA
Developers often measured by lines of code
Developers often not part of production support
Hybrid: SQLab
Explain Plan for Top SQL
SQLab can Advise & Fix!!!
Hybrid Summary
important under rule based optimizer, and won't hurt under cost based optimizer
order FROM clauses in descending order of table sizes based upon row counts
for example
IN example
Bad: select * from address where
state = 'TX or
state = 'FL or
state = 'OH
Good: select * from address where
state in ('TX','FL','OH')
UNION example
Bad: select * from address where
state = TX or
areacode = 972
Good: select * from address where
state = TX
union
select * from address where
areacode = 972
SQL Guidelines
when the percentage of rows returned from the outer sub-query is high
when the percentage of rows returned from the outer sub-query is low
avoid sub-queries that use NOT IN, use NOT EXISTS instead
Bad:
select city_name, state_code
into :v_city, :v_sate
from zip_codes where zip_code = 75022;
Good:
begin
select city_name, state_code
into :v_city, :v_sate
from zip_codes where zip_code = 75022;
insert into customer (Bert Scalzo,75022, :v_city, v_state);
end;
/