SQL plan analysis

Look at the execution plan for the last SQL statement in the session:

FROM table(dbms_xplan.display_cursor(null,null,’basic’));

Record and display run time statistics:

SELECT /*+ gather_plan_statistics */
p.prod_name, SUM(s.quantity_sold)
FROM sales s, products p
WHERE s.prod_id =p.prod_id GROUP By p.prod_name ;

Check if statistics for a table exists and is not stale:

select column_name, num_distinct, histograms, stale_stats
From user_tab_col_statistics
Where table_name=‘BIGEMP’;