SlideShare una empresa de Scribd logo
1 de 41
Understanding	
  how	
  	
  
Adap1ve	
  Cursor	
  Sharing	
  (ACS)	
  	
  
produces	
  mul1ple	
  Op1mal	
  Plans	
  
Carlos	
  Sierra	
  
Carlos	
  Sierra	
  
•  Consultant/Developer/DBA	
  
•  Oracle	
  Performance	
  
•  SQLTXPLAIN	
  (SQLT)	
  
•  SQL	
  Tuning	
  
•  Tools	
  
Enkitec	
  (c)	
  2014	
   2	
  
Topics	
  
•  Adap1ve	
  Cursor	
  Sharing	
  (ACS)	
  
– Mechanics	
  
– Demos	
  
Enkitec	
  (c)	
  2014	
   3	
  
Plan	
  Flexibility	
  Allies	
  
•  CBO	
  Parameters	
  
•  CBO	
  Sta1s1cs	
  
•  Dynamic	
  Sampling	
  
•  Cardinality	
  Feedback	
  
•  Cursor	
  Sharing	
  
•  Adap%ve	
  Cursor	
  Sharing	
  (ACS)	
  
Enkitec	
  (c)	
  2014	
   4	
  
Plan	
  Stability	
  Tools	
  
•  CBO	
  Hints	
  
•  Stored	
  Outlines	
  
•  SQL	
  Profiles	
  
•  SQL	
  Plan	
  Management	
  (SPM)	
  
Enkitec	
  (c)	
  2014	
   5	
  
Cursor	
  Sharing	
  
•  Use	
  of	
  Bind	
  Variables	
  instead	
  of	
  Literals	
  
– AND	
  p.prod_category	
  LIKE	
  'So[ware%’	
  
– AND	
  p.prod_category	
  LIKE	
  :b5	
  
•  Goal:	
  Reduce	
  Hard	
  Parsing	
  
– Improve	
  Scalability	
  
•  Reduce	
  CPU	
  u1liza1on	
  
•  Reduce	
  Shared	
  Memory	
  footprint	
  
Enkitec	
  (c)	
  2014	
   6	
  
Cursor	
  Sharing	
  Shortcomings	
  
•  Flipping	
  Plans	
  
– Exacerbated	
  by	
  Histograms	
  on	
  Skewed	
  Data	
  	
  
– AND	
  c.cust_marital_status	
  =	
  :b2	
  
•  :b2	
  :=	
  ‘married’	
  
•  :b2	
  :=	
  ‘widow’	
  
– Plan	
  is	
  computed	
  at	
  hard	
  parse	
  
•  Plan	
  becomes	
  a	
  long	
  term	
  moving	
  target	
  
Enkitec	
  (c)	
  2014	
   7	
  
Adap1ve	
  Cursor	
  Sharing	
  (ACS)	
  
•  11g+	
  
•  Mul1ple	
  Op1mal	
  Plans	
  per	
  SQL	
  
– As	
  per	
  “Selec1vity”	
  of	
  Predicates	
  
•  :b2	
  :=	
  ‘married’	
  (close	
  to	
  60%	
  maybe)	
  
•  :b2	
  :=	
  ‘widow’	
  (this	
  one	
  is	
  more	
  selec1ve)	
  
Enkitec	
  (c)	
  2014	
   8	
  
ACS	
  Challenges	
  
•  Minimize	
  Resources	
  Impact	
  
– Monitor	
  only	
  a	
  subset	
  of	
  SQL	
  Statements	
  
– Ac1vate	
  ACS	
  only	
  for	
  a	
  subset	
  of	
  the	
  monitored	
  SQL	
  
– Share	
  Execu1ons	
  Plans	
  through	
  a	
  “Selec1vity	
  Profile”	
  
Enkitec	
  (c)	
  2014	
   9	
  
All	
  Statements	
  
Bind	
  Sensi1ve	
  
Bind	
  Aware	
  
ACS	
  
Becoming	
  Bind	
  Sensi1ve	
  
1.  SQL	
  has	
  Range	
  Predicates	
  on	
  Bind	
  Variables	
  
–  AND	
  c.cust_year_of_birth	
  BETWEEN	
  :b3	
  AND	
  :b4	
  
–  AND	
  p.prod_category	
  LIKE	
  :b5	
  
2.  SQL	
  has	
  Equality	
  Predicates	
  on	
  Bind	
  Variables	
  and	
  
Column	
  has	
  a	
  Histogram	
  
–  AND	
  c.cust_marital_status	
  =	
  :b2	
  
–  AND	
  TO_CHAR(s.1me_id,	
  'YYYY')	
  =	
  :b6	
  
Enkitec	
  (c)	
  2014	
   10	
  
Becoming	
  Bind	
  Aware	
  
1.  Rows	
  Processed	
  change	
  substan1ally	
  between	
  
Execu1ons	
  
– Between	
  a	
  few	
  rows	
  to	
  millions	
  
2.  Rows	
  Processed	
  oscillate	
  significantly	
  between	
  
Execu1ons	
  
– Between	
  a	
  few	
  rows	
  and	
  a	
  few	
  thousand	
  
– Between	
  a	
  few	
  thousand	
  and	
  millions	
  
Enkitec	
  (c)	
  2014	
   11	
  
ACS	
  Monitoring	
  
•  V$SQL	
  (State)	
  
– is_shareable	
  
– is_bind_sensi1ve	
  
– is_bind_aware	
  
•  V$SQL_CS_STATISTICS	
  (Rows	
  Processed)	
  
•  V$SQL_CS_HISTOGRAM	
  (3	
  Buckets	
  S/M/L)	
  
•  V$SQL_CS_SELECTIVITY	
  (Selec1vity	
  Profile)	
  
Enkitec	
  (c)	
  2014	
   12	
  
Rows	
  Processed	
  
•  v$sql_cs_sta1s1cs.rows_processed	
  
•  Updated	
  only	
  at	
  hard	
  parse	
  
•  A	
  measure	
  of	
  amount	
  of	
  work	
  on	
  Execu1on	
  Plan	
  
•  Three	
  sizes:	
  S/M/L	
  
– 0:	
  Small	
  	
  
– 1:	
  Medium	
  	
  
– 2:	
  Large	
  
Enkitec	
  (c)	
  2014	
   13	
  
Rows	
  Processed	
  
•  v$sql_cs_sta1s1cs.rows_processed	
  
•  Updated	
  only	
  at	
  hard	
  parse	
  
•  A	
  measure	
  of	
  amount	
  of	
  work	
  on	
  Execu1on	
  Plan	
  
•  Three	
  sizes:	
  S/M/L	
  
– 0:	
  Small	
  (less	
  than	
  1K	
  rows)	
  
– 1:	
  Medium	
  (between	
  1k	
  and	
  1m	
  rows)	
  
– 2:	
  Large	
  (more	
  than	
  1m	
  rows)	
  
Enkitec	
  (c)	
  2014	
   14	
  
ACS	
  Buckets	
  
•  v$sql_cs_histogram.bucket_id	
  
– 0:	
  Small	
  
– 1:	
  Medium	
  
– 2:	
  Large	
  
•  v$sql_cs_histogram.count	
  
– Incremented	
  with	
  each	
  Execu1on	
  as	
  per	
  
•  v$sql_cs_sta1s1cs.rows_processed	
  
Enkitec	
  (c)	
  2014	
   15	
  
Rows	
  Processed	
  and	
  ACS	
  Buckets	
  
IF	
  	
  	
  	
  v$sql_cs_statistics.rows_processed	
  <	
  1K	
  THEN	
  
	
  	
  	
  	
  	
  	
  v$sql_cs_histogram.count(0)++	
  
ELSIF	
  v$sql_cs_statistics.rows_processed	
  <	
  1M	
  THEN	
  
	
  	
  	
  	
  	
  	
  v$sql_cs_histogram.count(1)++	
  
ELSE	
  	
  	
  
	
  	
  	
  	
  	
  	
  v$sql_cs_histogram.count(2)++	
  
END	
  IF	
  
	
  
	
  
	
   Enkitec	
  (c)	
  2014	
   16	
  
Becoming	
  Bind	
  Aware	
  
1.  Small	
  and	
  Large	
  buckets	
  have	
  a	
  value	
  
– bucket_id.count(0)	
  >	
  0	
  AND	
  bucket_id.count(2)	
  >	
  0	
  
2.  Two	
  adjacent	
  buckets	
  have	
  same	
  non-­‐zero	
  value	
  
– bucket_id.count(0)	
  =	
  bucket_id.count(1)	
  >	
  0	
  
– bucket_id.count(1)	
  =	
  bucket_id.count(2)	
  >	
  0	
  	
  
Enkitec	
  (c)	
  2014	
   17	
  
Rows	
  Processed	
  per	
  Execu1on	
  
•  10(0)…	
  50(0)…	
  3,000,000(2)…	
  BA	
  
•  30(0)…	
  3,000(1)…	
  BA	
  
•  2,000,000(2)…	
  1(0)…	
  BA	
  
•  0(0)…	
  10,000(1)…	
  BA	
  
•  3,000(1)…	
  2,000(1)…	
  200(0)…	
  300(0)…	
  BA	
  
•  10…	
  100…	
  500…	
  2,000…	
  3,000…	
  5,000…	
  BA	
  
•  rows_processed(bucket_id)…	
  Bind	
  Aware(BA)	
  
Enkitec	
  (c)	
  2014	
   18	
  
WHY	
  becoming	
  BA	
  is	
  important?	
  
•  Mul1ple	
  Op1mal	
  Plans	
  are	
  created	
  a[er	
  Cursor	
  
becomes	
  Bind	
  Aware	
  
Enkitec	
  (c)	
  2014	
   19	
  
Sample	
  Query	
  (1)	
  
SELECT	
  p.prod_subcategory_desc	
  subcatagory,	
  
	
  	
  	
  	
  	
  	
  	
  SUM(amount_sold)	
  amount_sold	
  
	
  	
  FROM	
  sh.customers	
  c,	
  
	
  	
  	
  	
  	
  	
  	
  sh.products	
  p,	
  
	
  	
  	
  	
  	
  	
  	
  sh.sales	
  s	
  
	
  WHERE	
  c.cust_gender	
  =	
  'M'	
  
	
  	
  	
  AND	
  c.cust_marital_status	
  =	
  'single'	
  
	
  	
  	
  AND	
  c.cust_year_of_birth	
  BETWEEN	
  1913	
  AND	
  1990	
  
	
  	
  	
  AND	
  p.prod_category	
  LIKE	
  'Software%'	
  
	
  	
  	
  AND	
  TO_CHAR(s.time_id,	
  'YYYY')	
  =	
  '2001'	
  
	
  	
  	
  AND	
  s.cust_id	
  =	
  c.cust_id	
  
	
  	
  	
  AND	
  s.prod_id	
  =	
  p.prod_id	
  
	
  GROUP	
  BY	
  
	
  	
  	
  	
  	
  	
  	
  p.prod_subcategory_desc	
  
	
  ORDER	
  BY	
  
	
  	
  	
  	
  	
  	
  	
  p.prod_subcategory_desc;	
  
Enkitec	
  (c)	
  2014	
   20	
  
Sample	
  Query	
  (2)	
  
•  Based	
  on	
  Sample	
  Schema	
  SH	
  
– With	
  CBO	
  Histograms	
  in	
  all	
  Columns	
  
•  Not	
  a	
  requirement	
  for	
  this	
  ACS	
  test	
  
•  3	
  Tables	
  with	
  Filter	
  Predicates	
  
•  2	
  Joins	
  
•  6	
  possible	
  Join	
  Orders	
  
•  Several	
  possible	
  Execu1on	
  Plans	
  
Enkitec	
  (c)	
  2014	
   21	
  
Demo	
  1	
  
•  5	
  Execu1ons	
  of	
  Sample	
  Query	
  using	
  Literals	
  
– Different	
  values	
  for	
  each	
  Execu1on	
  
•  Sequence	
  1,	
  2,	
  3,	
  4	
  and	
  5	
  
– Each	
  Execu1on	
  performs	
  a	
  Hard	
  Parse	
  
– Each	
  Execu1on	
  computes	
  a	
  “new”	
  Plan	
  
– Each	
  seems	
  to	
  be	
  an	
  “Op1mal”	
  Plan	
  
Enkitec	
  (c)	
  2014	
   22	
  
Demo	
  2	
  
•  5	
  Execu1ons	
  of	
  Sample	
  Query	
  using	
  Binds	
  
– Different	
  values	
  for	
  each	
  Execu1on	
  
•  Sequence	
  1,	
  2,	
  3,	
  4	
  and	
  5	
  
– Each	
  Execu1on	
  performs	
  a	
  Hard	
  Parse	
  
•  Forced	
  with	
  a	
  Cursor	
  Flush	
  before	
  the	
  Execu1on	
  
– Each	
  computes	
  a	
  “new”	
  Op1mal	
  Plan	
  
•  Almost	
  same	
  as	
  “with	
  Literals”	
  
Enkitec	
  (c)	
  2014	
   23	
  
Demo	
  2	
  Results	
  
Query	
   Rows	
  Processed	
   ACS	
  Bucket	
   Plan	
  Hash	
  Value	
  
1	
   1,483,124	
   2	
   2048551027	
  
2	
   1,272,154	
   2	
   3022804314	
  
3	
   1,014,876	
   2	
   2326939410	
  
4	
   716,168	
   1	
   2163719564	
  
5	
   530	
   0	
   2163719564	
  
Enkitec	
  (c)	
  2014	
   24	
  
Demo	
  3	
  
•  5	
  Execu1ons	
  of	
  Sample	
  Query	
  using	
  Binds	
  
– Different	
  values	
  for	
  each	
  Execu1on	
  
•  Sequence	
  1,	
  2,	
  3,	
  4	
  and	
  5	
  
– No	
  Cursor	
  Flush	
  between	
  Execu1ons	
  
– First	
  Execu1on	
  computes	
  a	
  “new”	
  Op1mal	
  Plan	
  
– All	
  Execu1ons	
  use	
  same	
  Plan…	
  
Enkitec	
  (c)	
  2014	
   25	
  
Demo	
  3	
  Results	
  
Query	
   Rows	
  Processed	
   ACS	
  Bucket	
   Op%mal	
  Plan	
   ACS	
  Aware	
   Executed	
  
1	
   1,483,124	
   2	
   2048551027	
   N	
   2048551027	
  
2	
   1,272,154	
   2	
   3022804314	
   N	
   2048551027	
  
3	
   1,014,876	
   2	
   2326939410	
   N	
   2048551027	
  
4	
   716,168	
   1	
   2163719564	
   N	
   2048551027	
  
5	
   530	
   0	
   2163719564	
   N	
   2048551027	
  
Enkitec	
  (c)	
  2014	
   26	
  
Demo	
  4	
  
•  5	
  Execu1ons	
  of	
  Sample	
  Query	
  using	
  Binds	
  
– Different	
  values	
  for	
  each	
  Execu1on	
  
•  Sequence	
  5,	
  4,	
  3,	
  2	
  and	
  1	
  
– No	
  Cursor	
  Flush	
  between	
  Execu1ons	
  
– Cursor	
  becomes	
  Bind	
  Aware	
  a[er	
  2nd	
  Execu1on	
  
– All	
  Execu1ons	
  used	
  an	
  Op1mal	
  Plan	
  
Enkitec	
  (c)	
  2014	
   27	
  
Demo	
  4	
  Results	
  
Query	
   Rows	
  Processed	
   ACS	
  Bucket	
   Op%mal	
  Plan	
   Bind	
  Aware	
   Executed	
  
5	
   530	
   0	
   2163719564	
   N	
   2163719564	
  
4	
   716,168	
   1	
   2163719564	
   N	
   2163719564	
  
3	
   1,014,876	
   2	
   2326939410	
   Y	
   2326939410	
  
2	
   1,272,154	
   2	
   3022804314	
   Y	
   3022804314	
  
1	
   1,483,124	
   2	
   2048551027	
   Y	
   2048551027	
  
Enkitec	
  (c)	
  2014	
   28	
  
Demo	
  5	
  
•  5	
  Execu1ons	
  of	
  Sample	
  Query	
  using	
  Binds	
  
– Different	
  values	
  for	
  each	
  Execu1on	
  
•  Sequence	
  5,	
  1,	
  2,	
  3	
  and	
  4	
  
– No	
  Cursor	
  Flush	
  between	
  Execu1ons	
  
– Cursor	
  becomes	
  Bind	
  Aware	
  a[er	
  2nd	
  Execu1on	
  
– All	
  but	
  one	
  Execu1ons	
  used	
  an	
  Op1mal	
  Plan	
  
Enkitec	
  (c)	
  2014	
   29	
  
Demo	
  5	
  Results	
  
Query	
   Rows	
  Processed	
   ACS	
  Bucket	
   Op%mal	
  Plan	
   Bind	
  Aware	
   Executed	
  
5	
   530	
   0	
   2163719564	
   N	
   2163719564	
  
1	
   1,483,124	
   2	
   2048551027	
   N	
   2163719564	
  
2	
   1,272,154	
   2	
   3022804314	
   Y	
   3022804314	
  
3	
   1,014,876	
   2	
   2326939410	
   Y	
   2326939410	
  
4	
   716,168	
   1	
   2163719564	
   Y	
   2163719564	
  
Enkitec	
  (c)	
  2014	
   30	
  
Controlling	
  ACS	
  with	
  CBO	
  Hint	
  
•  /*+	
  BIND_AWARE	
  */	
  
– Bypasses	
  the	
  monitoring	
  phase	
  of	
  a	
  Bind	
  Sensi1ve	
  SQL	
  
•  /*+	
  NO_BIND_AWARE	
  */	
  
– Turns	
  off	
  ACS	
  for	
  given	
  SQL	
  
Enkitec	
  (c)	
  2014	
   31	
  
Controlling	
  ACS	
  with	
  SQL	
  Patch	
  
•  SYS.DBMS_SQLDIAG_INTERNAL.I_CREATE_PATCH	
  
– sql_text	
  
– hint_text	
  =>	
  BIND_AWARE	
  
•  Script	
  sqlpch.sql	
  
Enkitec	
  (c)	
  2014	
   32	
  
ACS	
  Plan	
  Selec1on	
  
•  On	
  every	
  Execu1on	
  of	
  Bind	
  Aware	
  Cursor	
  
– Compute	
  Selec1vity	
  of	
  each	
  qualifying	
  Predicate	
  
– Search	
  Selec1vity	
  within	
  Range	
  of	
  values	
  on	
  ACS	
  
Selec1vity	
  Profile	
  
– If	
  within	
  Range,	
  lookup	
  Child	
  Number	
  and	
  use	
  its	
  Plan	
  
– Else,	
  Hard	
  Parse	
  and	
  Execute	
  newly	
  computed	
  Plan	
  
•  If	
  same	
  as	
  exis1ng	
  Plan,	
  then	
  update	
  Selec1vity	
  Profile	
  
•  Else,	
  create	
  Selec1vity	
  Profile	
  for	
  new	
  Child	
  Number	
  
Enkitec	
  (c)	
  2014	
   33	
  
Selec1vity	
  Profile	
  (1)	
  
•  v$sql_cs_selec1vity	
  
– predicate	
  
– range_id	
  
•  low	
  and	
  high	
  (selec1vi1es)	
  
– child_number	
  
Enkitec	
  (c)	
  2014	
   34	
  
Selec1vity	
  Profile	
  (2)	
  
	
  	
  	
  	
  	
  	
  CHILD	
  PREDICATE	
  	
  	
  	
  	
  RANGE_ID	
  LOW	
  	
  	
  	
  	
  	
  	
  	
  HIGH	
  
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  <=B4	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.860941	
  	
  	
  1.052262	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  =B1	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.602369	
  	
  	
  0.736229	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  =B2	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.455337	
  	
  	
  0.556523	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  >=B3	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.182445	
  	
  	
  0.222988	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  B5	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.306250	
  	
  	
  0.374306	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  2	
  <=B4	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.892666	
  	
  	
  1.091036	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  2	
  =B1	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.297574	
  	
  	
  0.363702	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  2	
  =B2	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.455337	
  	
  	
  0.556523	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  2	
  >=B3	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.077947	
  	
  	
  0.095268	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  2	
  B5	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.306250	
  	
  	
  0.374306	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  3	
  <=B4	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.836835	
  	
  	
  1.022798	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  3	
  =B1	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.297574	
  	
  	
  0.363702	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  3	
  =B2	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.002085	
  	
  	
  0.002548	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  3	
  >=B3	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.221447	
  	
  	
  0.270657	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  3	
  B5	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  0.306250	
  	
  	
  0.374306	
  
Enkitec	
  (c)	
  2014	
   35	
  
ACS	
  Summary	
  
•  ACS	
  is	
  capable	
  of	
  producing	
  mul1ple	
  Op1mal	
  
Execu1on	
  Plans	
  per	
  SQL	
  
•  During	
  ramp-­‐up	
  sub	
  Op1mal	
  Plans	
  may	
  happen	
  
•  ACS	
  Metadata	
  resides	
  in	
  Memory	
  (not	
  Persistent)	
  
•  ACS	
  provides	
  desirable	
  Plan	
  Flexibility	
  
•  ACS	
  does	
  not	
  address	
  the	
  Plan	
  Stability	
  concern	
  
Enkitec	
  (c)	
  2014	
   36	
  
ACS	
  Suggested	
  Strategy	
  
•  Use	
  sys.dbms_sqldiag_internal.i_create_patch	
  to	
  
SQL	
  Patch	
  with	
  BIND_AWARE	
  the	
  SQL	
  on	
  Baselines	
  	
  
Enkitec	
  (c)	
  2014	
   37	
  
SPM	
  Suggested	
  Strategy	
  
•  Use	
  dbms_applica1on_info.set_module	
  in	
  your	
  
code	
  to	
  set	
  MODULE	
  and	
  ACTION	
  
•  Use	
  dbms_spm.load_plans_from_cursor_cache	
  
filtering	
  with	
  MODULE	
  or	
  ACTION	
  
•  Use	
  dbms_spm.evolve_sql_plan_baseline	
  to	
  verify	
  
and	
  evolve	
  periodically	
  good	
  performing	
  Plans	
  
Enkitec	
  (c)	
  2014	
   38	
  
References	
  (1)	
  
•  Using	
  SQL	
  Patch	
  to	
  add	
  hints	
  to	
  a	
  packaged	
  
applica1on	
  
– hxps://blogs.oracle.com/op1mizer/entry/
how_can_i_hint_a	
  
Enkitec	
  (c)	
  2014	
   39	
  
References	
  (2)	
  
•  Oracle®	
  Database	
  PL/SQL	
  Packages	
  and	
  Types	
  
Reference	
  
– 11g	
  Release	
  2	
  (11.2)	
  
– Part	
  Number	
  E25788-­‐04	
  
Enkitec	
  (c)	
  2014	
   40	
  
Contact	
  Informa1on	
  
•  carlos.sierra@enkitec.com	
  
•  carlos-­‐sierra.net	
  
•  @csierra_usa	
  
Enkitec	
  (c)	
  2014	
   41	
  

Más contenido relacionado

La actualidad más candente

Adapting and adopting spm v04
Adapting and adopting spm v04Adapting and adopting spm v04
Adapting and adopting spm v04Carlos Sierra
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsCarlos Sierra
 
Hitchhiker's Guide to free Oracle tuning tools
Hitchhiker's Guide to free Oracle tuning toolsHitchhiker's Guide to free Oracle tuning tools
Hitchhiker's Guide to free Oracle tuning toolsBjoern Rost
 
Oracle SQL tuning with SQL Plan Management
Oracle SQL tuning with SQL Plan ManagementOracle SQL tuning with SQL Plan Management
Oracle SQL tuning with SQL Plan ManagementBjoern Rost
 
Sql tuning tools of the trade
Sql tuning tools of the tradeSql tuning tools of the trade
Sql tuning tools of the tradeEnkitec
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the TradeEnkitec
 
Combining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM StabilityCombining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM StabilityEnkitec
 
How to find what is making your Oracle database slow
How to find what is making your Oracle database slowHow to find what is making your Oracle database slow
How to find what is making your Oracle database slowSolarWinds
 
Oem12c patching -OOW13
Oem12c patching -OOW13Oem12c patching -OOW13
Oem12c patching -OOW13Bobby Curtis
 
OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASKyle Hailey
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2SolarWinds
 
SQLServerDays2012_SSIS_CDC
SQLServerDays2012_SSIS_CDCSQLServerDays2012_SSIS_CDC
SQLServerDays2012_SSIS_CDCKoenVerbeeck
 
Oracle SPM 12c. IOUG #C15LV
Oracle SPM 12c. IOUG #C15LVOracle SPM 12c. IOUG #C15LV
Oracle SPM 12c. IOUG #C15LVAlfredo Krieg
 
Sql 2012 Upgrade Readiness Guide
Sql 2012 Upgrade Readiness GuideSql 2012 Upgrade Readiness Guide
Sql 2012 Upgrade Readiness GuidePARIKSHIT SAVJANI
 
Oracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracleTrainings
 
Openstack upgrade without_down_time_20141103r1
Openstack upgrade without_down_time_20141103r1Openstack upgrade without_down_time_20141103r1
Openstack upgrade without_down_time_20141103r1Yankai Liu
 
Database and application performance vivek sharma
Database and application performance vivek sharmaDatabase and application performance vivek sharma
Database and application performance vivek sharmaaioughydchapter
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsEnkitec
 

La actualidad más candente (20)

Adapting and adopting spm v04
Adapting and adopting spm v04Adapting and adopting spm v04
Adapting and adopting spm v04
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
Hitchhiker's Guide to free Oracle tuning tools
Hitchhiker's Guide to free Oracle tuning toolsHitchhiker's Guide to free Oracle tuning tools
Hitchhiker's Guide to free Oracle tuning tools
 
Oracle SQL tuning with SQL Plan Management
Oracle SQL tuning with SQL Plan ManagementOracle SQL tuning with SQL Plan Management
Oracle SQL tuning with SQL Plan Management
 
Sql tuning tools of the trade
Sql tuning tools of the tradeSql tuning tools of the trade
Sql tuning tools of the trade
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the Trade
 
Combining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM StabilityCombining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM Stability
 
How to find what is making your Oracle database slow
How to find what is making your Oracle database slowHow to find what is making your Oracle database slow
How to find what is making your Oracle database slow
 
Oem12c patching -OOW13
Oem12c patching -OOW13Oem12c patching -OOW13
Oem12c patching -OOW13
 
OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AAS
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2
 
SQLServerDays2012_SSIS_CDC
SQLServerDays2012_SSIS_CDCSQLServerDays2012_SSIS_CDC
SQLServerDays2012_SSIS_CDC
 
Oracle SPM 12c. IOUG #C15LV
Oracle SPM 12c. IOUG #C15LVOracle SPM 12c. IOUG #C15LV
Oracle SPM 12c. IOUG #C15LV
 
Sql 2012 Upgrade Readiness Guide
Sql 2012 Upgrade Readiness GuideSql 2012 Upgrade Readiness Guide
Sql 2012 Upgrade Readiness Guide
 
Oracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance Tuning
 
Openstack upgrade without_down_time_20141103r1
Openstack upgrade without_down_time_20141103r1Openstack upgrade without_down_time_20141103r1
Openstack upgrade without_down_time_20141103r1
 
OOW13 Exadata and ODI with Parallel
OOW13 Exadata and ODI with ParallelOOW13 Exadata and ODI with Parallel
OOW13 Exadata and ODI with Parallel
 
SQL TUNING 101
SQL TUNING 101SQL TUNING 101
SQL TUNING 101
 
Database and application performance vivek sharma
Database and application performance vivek sharmaDatabase and application performance vivek sharma
Database and application performance vivek sharma
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 

Destacado (19)

Confessions of an APEX Design Geek
Confessions of an APEX Design GeekConfessions of an APEX Design Geek
Confessions of an APEX Design Geek
 
jadiditurbulencemodeling
jadiditurbulencemodelingjadiditurbulencemodeling
jadiditurbulencemodeling
 
HPH profile - PM
HPH profile - PMHPH profile - PM
HPH profile - PM
 
Slideshow
SlideshowSlideshow
Slideshow
 
Fall2016_highres
Fall2016_highresFall2016_highres
Fall2016_highres
 
Mentoring_Brussels_2015
Mentoring_Brussels_2015Mentoring_Brussels_2015
Mentoring_Brussels_2015
 
格安ラルフローレンのシャツ個々のソリューションの保護
格安ラルフローレンのシャツ個々のソリューションの保護格安ラルフローレンのシャツ個々のソリューションの保護
格安ラルフローレンのシャツ個々のソリューションの保護
 
Bab 3-substansi-genetika-perbaikan
Bab 3-substansi-genetika-perbaikanBab 3-substansi-genetika-perbaikan
Bab 3-substansi-genetika-perbaikan
 
ESF1 Piling Vibrator - Operating instructions
ESF1 Piling Vibrator - Operating instructionsESF1 Piling Vibrator - Operating instructions
ESF1 Piling Vibrator - Operating instructions
 
Con cuál me quedo
Con cuál me quedoCon cuál me quedo
Con cuál me quedo
 
AFS Acceptance: Got Culture?
AFS Acceptance: Got Culture? AFS Acceptance: Got Culture?
AFS Acceptance: Got Culture?
 
C12 Replikasi DNA
C12 Replikasi DNAC12 Replikasi DNA
C12 Replikasi DNA
 
Sintesis protein
Sintesis protein Sintesis protein
Sintesis protein
 
Dn aand rna1
Dn aand rna1Dn aand rna1
Dn aand rna1
 
Types and methods of physiotherapy
Types and methods of physiotherapyTypes and methods of physiotherapy
Types and methods of physiotherapy
 
Six Sigma by PresentationLoad
Six Sigma by PresentationLoadSix Sigma by PresentationLoad
Six Sigma by PresentationLoad
 
Mikroskop, lupa i durbin
Mikroskop, lupa i durbinMikroskop, lupa i durbin
Mikroskop, lupa i durbin
 
Company core-values - english templates
Company core-values - english templatesCompany core-values - english templates
Company core-values - english templates
 
8 D – Problem Solving Process
8 D – Problem Solving Process8 D – Problem Solving Process
8 D – Problem Solving Process
 

Similar a Understanding how is that adaptive cursor sharing (acs) produces multiple optimal plans

Dealing with the Three Horrible Problems in Verification
Dealing with the Three Horrible Problems in VerificationDealing with the Three Horrible Problems in Verification
Dealing with the Three Horrible Problems in VerificationDVClub
 
Using adaptive cursor sharing (acs) to produce multiple optimal plans v2
Using adaptive cursor sharing (acs) to produce multiple optimal plans v2Using adaptive cursor sharing (acs) to produce multiple optimal plans v2
Using adaptive cursor sharing (acs) to produce multiple optimal plans v2Enkitec
 
Constraint-Based Fault-Localization
Constraint-Based Fault-LocalizationConstraint-Based Fault-Localization
Constraint-Based Fault-LocalizationMohammed Bekkouche
 
Noha danms13 talk_final
Noha danms13 talk_finalNoha danms13 talk_final
Noha danms13 talk_finalNoha Elprince
 
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan StabilityUsing SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan StabilityEnkitec
 
Performance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and UnderscoresPerformance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and UnderscoresJitendra Singh
 
Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0PMILebanonChapter
 
Macy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightMacy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightDataStax Academy
 
Big Data, Bigger Analytics
Big Data, Bigger AnalyticsBig Data, Bigger Analytics
Big Data, Bigger AnalyticsItzhak Kameli
 
Fast federated SQL with Apache Calcite
Fast federated SQL with Apache CalciteFast federated SQL with Apache Calcite
Fast federated SQL with Apache CalciteChris Baynes
 
Meeting the challenges of OLTP Big Data with Scylla
Meeting the challenges of OLTP Big Data with ScyllaMeeting the challenges of OLTP Big Data with Scylla
Meeting the challenges of OLTP Big Data with ScyllaScyllaDB
 
261197832 8-performance-tuning-part i
261197832 8-performance-tuning-part i261197832 8-performance-tuning-part i
261197832 8-performance-tuning-part iNaviSoft
 
Streaming SQL Foundations: Why I ❤ Streams+Tables
Streaming SQL Foundations: Why I ❤ Streams+TablesStreaming SQL Foundations: Why I ❤ Streams+Tables
Streaming SQL Foundations: Why I ❤ Streams+TablesC4Media
 
Apache Kylin: OLAP Engine on Hadoop - Tech Deep Dive
Apache Kylin: OLAP Engine on Hadoop - Tech Deep DiveApache Kylin: OLAP Engine on Hadoop - Tech Deep Dive
Apache Kylin: OLAP Engine on Hadoop - Tech Deep DiveXu Jiang
 
day 3-2 PMP.pptx
day 3-2 PMP.pptxday 3-2 PMP.pptx
day 3-2 PMP.pptxAhmedKayed6
 

Similar a Understanding how is that adaptive cursor sharing (acs) produces multiple optimal plans (20)

Dealing with the Three Horrible Problems in Verification
Dealing with the Three Horrible Problems in VerificationDealing with the Three Horrible Problems in Verification
Dealing with the Three Horrible Problems in Verification
 
Using adaptive cursor sharing (acs) to produce multiple optimal plans v2
Using adaptive cursor sharing (acs) to produce multiple optimal plans v2Using adaptive cursor sharing (acs) to produce multiple optimal plans v2
Using adaptive cursor sharing (acs) to produce multiple optimal plans v2
 
Constraint-Based Fault-Localization
Constraint-Based Fault-LocalizationConstraint-Based Fault-Localization
Constraint-Based Fault-Localization
 
Noha danms13 talk_final
Noha danms13 talk_finalNoha danms13 talk_final
Noha danms13 talk_final
 
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan StabilityUsing SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
 
Performance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and UnderscoresPerformance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and Underscores
 
Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0
 
Macy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightMacy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-Flight
 
Big Data, Bigger Analytics
Big Data, Bigger AnalyticsBig Data, Bigger Analytics
Big Data, Bigger Analytics
 
Mutant Tests Too: The SQL
Mutant Tests Too: The SQLMutant Tests Too: The SQL
Mutant Tests Too: The SQL
 
sqltuning101-170419021007-2.pdf
sqltuning101-170419021007-2.pdfsqltuning101-170419021007-2.pdf
sqltuning101-170419021007-2.pdf
 
Fast federated SQL with Apache Calcite
Fast federated SQL with Apache CalciteFast federated SQL with Apache Calcite
Fast federated SQL with Apache Calcite
 
seminar100326a.pdf
seminar100326a.pdfseminar100326a.pdf
seminar100326a.pdf
 
Qualificacao acd
Qualificacao acdQualificacao acd
Qualificacao acd
 
Meeting the challenges of OLTP Big Data with Scylla
Meeting the challenges of OLTP Big Data with ScyllaMeeting the challenges of OLTP Big Data with Scylla
Meeting the challenges of OLTP Big Data with Scylla
 
261197832 8-performance-tuning-part i
261197832 8-performance-tuning-part i261197832 8-performance-tuning-part i
261197832 8-performance-tuning-part i
 
Streaming SQL Foundations: Why I ❤ Streams+Tables
Streaming SQL Foundations: Why I ❤ Streams+TablesStreaming SQL Foundations: Why I ❤ Streams+Tables
Streaming SQL Foundations: Why I ❤ Streams+Tables
 
When Should I Use Simulation?
When Should I Use Simulation?When Should I Use Simulation?
When Should I Use Simulation?
 
Apache Kylin: OLAP Engine on Hadoop - Tech Deep Dive
Apache Kylin: OLAP Engine on Hadoop - Tech Deep DiveApache Kylin: OLAP Engine on Hadoop - Tech Deep Dive
Apache Kylin: OLAP Engine on Hadoop - Tech Deep Dive
 
day 3-2 PMP.pptx
day 3-2 PMP.pptxday 3-2 PMP.pptx
day 3-2 PMP.pptx
 

Más de Enkitec

Using Angular JS in APEX
Using Angular JS in APEXUsing Angular JS in APEX
Using Angular JS in APEXEnkitec
 
Controlling execution plans 2014
Controlling execution plans   2014Controlling execution plans   2014
Controlling execution plans 2014Enkitec
 
Engineered Systems: Environment-as-a-Service Demonstration
Engineered Systems: Environment-as-a-Service DemonstrationEngineered Systems: Environment-as-a-Service Demonstration
Engineered Systems: Environment-as-a-Service DemonstrationEnkitec
 
Think Exa!
Think Exa!Think Exa!
Think Exa!Enkitec
 
In Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneIn Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneEnkitec
 
In Search of Plan Stability - Part 1
In Search of Plan Stability - Part 1In Search of Plan Stability - Part 1
In Search of Plan Stability - Part 1Enkitec
 
Mini Session - Using GDB for Profiling
Mini Session - Using GDB for ProfilingMini Session - Using GDB for Profiling
Mini Session - Using GDB for ProfilingEnkitec
 
Profiling Oracle with GDB
Profiling Oracle with GDBProfiling Oracle with GDB
Profiling Oracle with GDBEnkitec
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceEnkitec
 
OGG Architecture Performance
OGG Architecture PerformanceOGG Architecture Performance
OGG Architecture PerformanceEnkitec
 
APEX Security Primer
APEX Security PrimerAPEX Security Primer
APEX Security PrimerEnkitec
 
How Many Ways Can I Manage Oracle GoldenGate?
How Many Ways Can I Manage Oracle GoldenGate?How Many Ways Can I Manage Oracle GoldenGate?
How Many Ways Can I Manage Oracle GoldenGate?Enkitec
 
Sql tuning made easier with sqltxplain (sqlt)
Sql tuning made easier with sqltxplain (sqlt)Sql tuning made easier with sqltxplain (sqlt)
Sql tuning made easier with sqltxplain (sqlt)Enkitec
 
Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writerEnkitec
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014Enkitec
 
Why You May Not Need Offloading
Why You May Not Need OffloadingWhy You May Not Need Offloading
Why You May Not Need OffloadingEnkitec
 
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXLOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXEnkitec
 
Creating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEXCreating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEXEnkitec
 
Colvin RMAN New Features
Colvin RMAN New FeaturesColvin RMAN New Features
Colvin RMAN New FeaturesEnkitec
 
Enkitec Exadata Human Factor
Enkitec Exadata Human FactorEnkitec Exadata Human Factor
Enkitec Exadata Human FactorEnkitec
 

Más de Enkitec (20)

Using Angular JS in APEX
Using Angular JS in APEXUsing Angular JS in APEX
Using Angular JS in APEX
 
Controlling execution plans 2014
Controlling execution plans   2014Controlling execution plans   2014
Controlling execution plans 2014
 
Engineered Systems: Environment-as-a-Service Demonstration
Engineered Systems: Environment-as-a-Service DemonstrationEngineered Systems: Environment-as-a-Service Demonstration
Engineered Systems: Environment-as-a-Service Demonstration
 
Think Exa!
Think Exa!Think Exa!
Think Exa!
 
In Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneIn Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry Osborne
 
In Search of Plan Stability - Part 1
In Search of Plan Stability - Part 1In Search of Plan Stability - Part 1
In Search of Plan Stability - Part 1
 
Mini Session - Using GDB for Profiling
Mini Session - Using GDB for ProfilingMini Session - Using GDB for Profiling
Mini Session - Using GDB for Profiling
 
Profiling Oracle with GDB
Profiling Oracle with GDBProfiling Oracle with GDB
Profiling Oracle with GDB
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture Performance
 
OGG Architecture Performance
OGG Architecture PerformanceOGG Architecture Performance
OGG Architecture Performance
 
APEX Security Primer
APEX Security PrimerAPEX Security Primer
APEX Security Primer
 
How Many Ways Can I Manage Oracle GoldenGate?
How Many Ways Can I Manage Oracle GoldenGate?How Many Ways Can I Manage Oracle GoldenGate?
How Many Ways Can I Manage Oracle GoldenGate?
 
Sql tuning made easier with sqltxplain (sqlt)
Sql tuning made easier with sqltxplain (sqlt)Sql tuning made easier with sqltxplain (sqlt)
Sql tuning made easier with sqltxplain (sqlt)
 
Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writer
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014
 
Why You May Not Need Offloading
Why You May Not Need OffloadingWhy You May Not Need Offloading
Why You May Not Need Offloading
 
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXLOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
 
Creating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEXCreating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEX
 
Colvin RMAN New Features
Colvin RMAN New FeaturesColvin RMAN New Features
Colvin RMAN New Features
 
Enkitec Exadata Human Factor
Enkitec Exadata Human FactorEnkitec Exadata Human Factor
Enkitec Exadata Human Factor
 

Último

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Understanding how is that adaptive cursor sharing (acs) produces multiple optimal plans

  • 1. Understanding  how     Adap1ve  Cursor  Sharing  (ACS)     produces  mul1ple  Op1mal  Plans   Carlos  Sierra  
  • 2. Carlos  Sierra   •  Consultant/Developer/DBA   •  Oracle  Performance   •  SQLTXPLAIN  (SQLT)   •  SQL  Tuning   •  Tools   Enkitec  (c)  2014   2  
  • 3. Topics   •  Adap1ve  Cursor  Sharing  (ACS)   – Mechanics   – Demos   Enkitec  (c)  2014   3  
  • 4. Plan  Flexibility  Allies   •  CBO  Parameters   •  CBO  Sta1s1cs   •  Dynamic  Sampling   •  Cardinality  Feedback   •  Cursor  Sharing   •  Adap%ve  Cursor  Sharing  (ACS)   Enkitec  (c)  2014   4  
  • 5. Plan  Stability  Tools   •  CBO  Hints   •  Stored  Outlines   •  SQL  Profiles   •  SQL  Plan  Management  (SPM)   Enkitec  (c)  2014   5  
  • 6. Cursor  Sharing   •  Use  of  Bind  Variables  instead  of  Literals   – AND  p.prod_category  LIKE  'So[ware%’   – AND  p.prod_category  LIKE  :b5   •  Goal:  Reduce  Hard  Parsing   – Improve  Scalability   •  Reduce  CPU  u1liza1on   •  Reduce  Shared  Memory  footprint   Enkitec  (c)  2014   6  
  • 7. Cursor  Sharing  Shortcomings   •  Flipping  Plans   – Exacerbated  by  Histograms  on  Skewed  Data     – AND  c.cust_marital_status  =  :b2   •  :b2  :=  ‘married’   •  :b2  :=  ‘widow’   – Plan  is  computed  at  hard  parse   •  Plan  becomes  a  long  term  moving  target   Enkitec  (c)  2014   7  
  • 8. Adap1ve  Cursor  Sharing  (ACS)   •  11g+   •  Mul1ple  Op1mal  Plans  per  SQL   – As  per  “Selec1vity”  of  Predicates   •  :b2  :=  ‘married’  (close  to  60%  maybe)   •  :b2  :=  ‘widow’  (this  one  is  more  selec1ve)   Enkitec  (c)  2014   8  
  • 9. ACS  Challenges   •  Minimize  Resources  Impact   – Monitor  only  a  subset  of  SQL  Statements   – Ac1vate  ACS  only  for  a  subset  of  the  monitored  SQL   – Share  Execu1ons  Plans  through  a  “Selec1vity  Profile”   Enkitec  (c)  2014   9   All  Statements   Bind  Sensi1ve   Bind  Aware   ACS  
  • 10. Becoming  Bind  Sensi1ve   1.  SQL  has  Range  Predicates  on  Bind  Variables   –  AND  c.cust_year_of_birth  BETWEEN  :b3  AND  :b4   –  AND  p.prod_category  LIKE  :b5   2.  SQL  has  Equality  Predicates  on  Bind  Variables  and   Column  has  a  Histogram   –  AND  c.cust_marital_status  =  :b2   –  AND  TO_CHAR(s.1me_id,  'YYYY')  =  :b6   Enkitec  (c)  2014   10  
  • 11. Becoming  Bind  Aware   1.  Rows  Processed  change  substan1ally  between   Execu1ons   – Between  a  few  rows  to  millions   2.  Rows  Processed  oscillate  significantly  between   Execu1ons   – Between  a  few  rows  and  a  few  thousand   – Between  a  few  thousand  and  millions   Enkitec  (c)  2014   11  
  • 12. ACS  Monitoring   •  V$SQL  (State)   – is_shareable   – is_bind_sensi1ve   – is_bind_aware   •  V$SQL_CS_STATISTICS  (Rows  Processed)   •  V$SQL_CS_HISTOGRAM  (3  Buckets  S/M/L)   •  V$SQL_CS_SELECTIVITY  (Selec1vity  Profile)   Enkitec  (c)  2014   12  
  • 13. Rows  Processed   •  v$sql_cs_sta1s1cs.rows_processed   •  Updated  only  at  hard  parse   •  A  measure  of  amount  of  work  on  Execu1on  Plan   •  Three  sizes:  S/M/L   – 0:  Small     – 1:  Medium     – 2:  Large   Enkitec  (c)  2014   13  
  • 14. Rows  Processed   •  v$sql_cs_sta1s1cs.rows_processed   •  Updated  only  at  hard  parse   •  A  measure  of  amount  of  work  on  Execu1on  Plan   •  Three  sizes:  S/M/L   – 0:  Small  (less  than  1K  rows)   – 1:  Medium  (between  1k  and  1m  rows)   – 2:  Large  (more  than  1m  rows)   Enkitec  (c)  2014   14  
  • 15. ACS  Buckets   •  v$sql_cs_histogram.bucket_id   – 0:  Small   – 1:  Medium   – 2:  Large   •  v$sql_cs_histogram.count   – Incremented  with  each  Execu1on  as  per   •  v$sql_cs_sta1s1cs.rows_processed   Enkitec  (c)  2014   15  
  • 16. Rows  Processed  and  ACS  Buckets   IF        v$sql_cs_statistics.rows_processed  <  1K  THEN              v$sql_cs_histogram.count(0)++   ELSIF  v$sql_cs_statistics.rows_processed  <  1M  THEN              v$sql_cs_histogram.count(1)++   ELSE                  v$sql_cs_histogram.count(2)++   END  IF         Enkitec  (c)  2014   16  
  • 17. Becoming  Bind  Aware   1.  Small  and  Large  buckets  have  a  value   – bucket_id.count(0)  >  0  AND  bucket_id.count(2)  >  0   2.  Two  adjacent  buckets  have  same  non-­‐zero  value   – bucket_id.count(0)  =  bucket_id.count(1)  >  0   – bucket_id.count(1)  =  bucket_id.count(2)  >  0     Enkitec  (c)  2014   17  
  • 18. Rows  Processed  per  Execu1on   •  10(0)…  50(0)…  3,000,000(2)…  BA   •  30(0)…  3,000(1)…  BA   •  2,000,000(2)…  1(0)…  BA   •  0(0)…  10,000(1)…  BA   •  3,000(1)…  2,000(1)…  200(0)…  300(0)…  BA   •  10…  100…  500…  2,000…  3,000…  5,000…  BA   •  rows_processed(bucket_id)…  Bind  Aware(BA)   Enkitec  (c)  2014   18  
  • 19. WHY  becoming  BA  is  important?   •  Mul1ple  Op1mal  Plans  are  created  a[er  Cursor   becomes  Bind  Aware   Enkitec  (c)  2014   19  
  • 20. Sample  Query  (1)   SELECT  p.prod_subcategory_desc  subcatagory,                SUM(amount_sold)  amount_sold      FROM  sh.customers  c,                sh.products  p,                sh.sales  s    WHERE  c.cust_gender  =  'M'        AND  c.cust_marital_status  =  'single'        AND  c.cust_year_of_birth  BETWEEN  1913  AND  1990        AND  p.prod_category  LIKE  'Software%'        AND  TO_CHAR(s.time_id,  'YYYY')  =  '2001'        AND  s.cust_id  =  c.cust_id        AND  s.prod_id  =  p.prod_id    GROUP  BY                p.prod_subcategory_desc    ORDER  BY                p.prod_subcategory_desc;   Enkitec  (c)  2014   20  
  • 21. Sample  Query  (2)   •  Based  on  Sample  Schema  SH   – With  CBO  Histograms  in  all  Columns   •  Not  a  requirement  for  this  ACS  test   •  3  Tables  with  Filter  Predicates   •  2  Joins   •  6  possible  Join  Orders   •  Several  possible  Execu1on  Plans   Enkitec  (c)  2014   21  
  • 22. Demo  1   •  5  Execu1ons  of  Sample  Query  using  Literals   – Different  values  for  each  Execu1on   •  Sequence  1,  2,  3,  4  and  5   – Each  Execu1on  performs  a  Hard  Parse   – Each  Execu1on  computes  a  “new”  Plan   – Each  seems  to  be  an  “Op1mal”  Plan   Enkitec  (c)  2014   22  
  • 23. Demo  2   •  5  Execu1ons  of  Sample  Query  using  Binds   – Different  values  for  each  Execu1on   •  Sequence  1,  2,  3,  4  and  5   – Each  Execu1on  performs  a  Hard  Parse   •  Forced  with  a  Cursor  Flush  before  the  Execu1on   – Each  computes  a  “new”  Op1mal  Plan   •  Almost  same  as  “with  Literals”   Enkitec  (c)  2014   23  
  • 24. Demo  2  Results   Query   Rows  Processed   ACS  Bucket   Plan  Hash  Value   1   1,483,124   2   2048551027   2   1,272,154   2   3022804314   3   1,014,876   2   2326939410   4   716,168   1   2163719564   5   530   0   2163719564   Enkitec  (c)  2014   24  
  • 25. Demo  3   •  5  Execu1ons  of  Sample  Query  using  Binds   – Different  values  for  each  Execu1on   •  Sequence  1,  2,  3,  4  and  5   – No  Cursor  Flush  between  Execu1ons   – First  Execu1on  computes  a  “new”  Op1mal  Plan   – All  Execu1ons  use  same  Plan…   Enkitec  (c)  2014   25  
  • 26. Demo  3  Results   Query   Rows  Processed   ACS  Bucket   Op%mal  Plan   ACS  Aware   Executed   1   1,483,124   2   2048551027   N   2048551027   2   1,272,154   2   3022804314   N   2048551027   3   1,014,876   2   2326939410   N   2048551027   4   716,168   1   2163719564   N   2048551027   5   530   0   2163719564   N   2048551027   Enkitec  (c)  2014   26  
  • 27. Demo  4   •  5  Execu1ons  of  Sample  Query  using  Binds   – Different  values  for  each  Execu1on   •  Sequence  5,  4,  3,  2  and  1   – No  Cursor  Flush  between  Execu1ons   – Cursor  becomes  Bind  Aware  a[er  2nd  Execu1on   – All  Execu1ons  used  an  Op1mal  Plan   Enkitec  (c)  2014   27  
  • 28. Demo  4  Results   Query   Rows  Processed   ACS  Bucket   Op%mal  Plan   Bind  Aware   Executed   5   530   0   2163719564   N   2163719564   4   716,168   1   2163719564   N   2163719564   3   1,014,876   2   2326939410   Y   2326939410   2   1,272,154   2   3022804314   Y   3022804314   1   1,483,124   2   2048551027   Y   2048551027   Enkitec  (c)  2014   28  
  • 29. Demo  5   •  5  Execu1ons  of  Sample  Query  using  Binds   – Different  values  for  each  Execu1on   •  Sequence  5,  1,  2,  3  and  4   – No  Cursor  Flush  between  Execu1ons   – Cursor  becomes  Bind  Aware  a[er  2nd  Execu1on   – All  but  one  Execu1ons  used  an  Op1mal  Plan   Enkitec  (c)  2014   29  
  • 30. Demo  5  Results   Query   Rows  Processed   ACS  Bucket   Op%mal  Plan   Bind  Aware   Executed   5   530   0   2163719564   N   2163719564   1   1,483,124   2   2048551027   N   2163719564   2   1,272,154   2   3022804314   Y   3022804314   3   1,014,876   2   2326939410   Y   2326939410   4   716,168   1   2163719564   Y   2163719564   Enkitec  (c)  2014   30  
  • 31. Controlling  ACS  with  CBO  Hint   •  /*+  BIND_AWARE  */   – Bypasses  the  monitoring  phase  of  a  Bind  Sensi1ve  SQL   •  /*+  NO_BIND_AWARE  */   – Turns  off  ACS  for  given  SQL   Enkitec  (c)  2014   31  
  • 32. Controlling  ACS  with  SQL  Patch   •  SYS.DBMS_SQLDIAG_INTERNAL.I_CREATE_PATCH   – sql_text   – hint_text  =>  BIND_AWARE   •  Script  sqlpch.sql   Enkitec  (c)  2014   32  
  • 33. ACS  Plan  Selec1on   •  On  every  Execu1on  of  Bind  Aware  Cursor   – Compute  Selec1vity  of  each  qualifying  Predicate   – Search  Selec1vity  within  Range  of  values  on  ACS   Selec1vity  Profile   – If  within  Range,  lookup  Child  Number  and  use  its  Plan   – Else,  Hard  Parse  and  Execute  newly  computed  Plan   •  If  same  as  exis1ng  Plan,  then  update  Selec1vity  Profile   •  Else,  create  Selec1vity  Profile  for  new  Child  Number   Enkitec  (c)  2014   33  
  • 34. Selec1vity  Profile  (1)   •  v$sql_cs_selec1vity   – predicate   – range_id   •  low  and  high  (selec1vi1es)   – child_number   Enkitec  (c)  2014   34  
  • 35. Selec1vity  Profile  (2)              CHILD  PREDICATE          RANGE_ID  LOW                HIGH   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐                      1  <=B4                                  0  0.860941      1.052262                      1  =B1                                    0  0.602369      0.736229                      1  =B2                                    0  0.455337      0.556523                      1  >=B3                                  0  0.182445      0.222988                      1  B5                                      0  0.306250      0.374306                      2  <=B4                                  0  0.892666      1.091036                      2  =B1                                    0  0.297574      0.363702                      2  =B2                                    0  0.455337      0.556523                      2  >=B3                                  0  0.077947      0.095268                      2  B5                                      0  0.306250      0.374306                      3  <=B4                                  0  0.836835      1.022798                      3  =B1                                    0  0.297574      0.363702                      3  =B2                                    0  0.002085      0.002548                      3  >=B3                                  0  0.221447      0.270657                      3  B5                                      0  0.306250      0.374306   Enkitec  (c)  2014   35  
  • 36. ACS  Summary   •  ACS  is  capable  of  producing  mul1ple  Op1mal   Execu1on  Plans  per  SQL   •  During  ramp-­‐up  sub  Op1mal  Plans  may  happen   •  ACS  Metadata  resides  in  Memory  (not  Persistent)   •  ACS  provides  desirable  Plan  Flexibility   •  ACS  does  not  address  the  Plan  Stability  concern   Enkitec  (c)  2014   36  
  • 37. ACS  Suggested  Strategy   •  Use  sys.dbms_sqldiag_internal.i_create_patch  to   SQL  Patch  with  BIND_AWARE  the  SQL  on  Baselines     Enkitec  (c)  2014   37  
  • 38. SPM  Suggested  Strategy   •  Use  dbms_applica1on_info.set_module  in  your   code  to  set  MODULE  and  ACTION   •  Use  dbms_spm.load_plans_from_cursor_cache   filtering  with  MODULE  or  ACTION   •  Use  dbms_spm.evolve_sql_plan_baseline  to  verify   and  evolve  periodically  good  performing  Plans   Enkitec  (c)  2014   38  
  • 39. References  (1)   •  Using  SQL  Patch  to  add  hints  to  a  packaged   applica1on   – hxps://blogs.oracle.com/op1mizer/entry/ how_can_i_hint_a   Enkitec  (c)  2014   39  
  • 40. References  (2)   •  Oracle®  Database  PL/SQL  Packages  and  Types   Reference   – 11g  Release  2  (11.2)   – Part  Number  E25788-­‐04   Enkitec  (c)  2014   40  
  • 41. Contact  Informa1on   •  carlos.sierra@enkitec.com   •  carlos-­‐sierra.net   •  @csierra_usa   Enkitec  (c)  2014   41