Performance and Tuning - SQL query

Performance and Tuning

Below are few steps to use for performance and tuning of long running queries in Oracle database.

  1. Identification --> Use any tool such as Profiler, Execution Plan, AWR report
  2. Analysis --> Analyze the data volume of tables being used in query
  3. Create an Index, Only If required**
  4. Update table's statistics
  5. Rebuilding table, indexes etc.

1] Query Execution Plan
  • It list out all details of how the RDBMS plan on query processing
  • How the indexes will be used
  • How joins will be performed
  • Estimate cost
  • it will tell optimizer to perform certain action
  • Index hint is special syntax that you can put in SQL query
  • Order of table name (Choose selective table first which having where condition)
2] Analyze Plan
  • Driving table
  • Join order
  • Join methods
  • Loops --> Nested, Hash join, Merge sort
  • Full table scan
  • Indexes are present but not used properly

Flow of query execution:
  • Query checked for semantics
  • Parsing
  • Parsing can be Hard or Soft parse
  • Oracle check, if the parsed statement exist in library cache
  • If exist, the statement is used, otherwise it will be hard parsed & placed in library cache
  • Optimizer then decides on best execution plan and execute the statement
  • The data to be retrieved is fetched from buffer cache if already exist, if not then data blocks are read data fetched and stored in buffer cache & finally present the values to session based on requesting data

Comments

Popular posts from this blog

PUTTY - The server's host key is not cached in the registry cache

OIM-12c Installation - FMW - SOA - IDM

Apache Kafka - Zookeeper