SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Using	
  SQL	
  Plan	
  Management	
  (SPM)	
  to	
  
balance	
  Plan	
  Flexibility	
  and	
  Plan	
  Stability	
  
Carlos	
  Sierra	
  
Carlos	
  Sierra	
  
•  SQLTXPLAIN	
  +	
  SQL	
  Health-­‐Check	
  SQLHC	
  +	
  
•  Consultant/Developer/DBA/Design/+	
  
•  Oracle	
  Performance	
  +	
  SQL	
  Tuning	
  
•  Oracle	
  Database	
  Health-­‐Check	
  
•  Tools	
  +	
  Scripts	
  
•  Speaker	
  
Enkitec	
  (c)	
  2014	
   2	
  
Topics	
  
•  MoPvaPon	
  
•  SQL	
  Plan	
  Management	
  (SPM)	
  
– Mechanics	
  
– Demos	
  
Enkitec	
  (c)	
  2014	
   3	
  
Plan	
  Flexibility	
  
•  Cost-­‐based	
  OpPmizer	
  (CBO)	
  
– Introduced	
  in	
  Oracle	
  7	
  
– Computes	
  an	
  OpPmal	
  Plan	
  based	
  on	
  	
  
•  HeurisPcs	
  
•  Query	
  Predicates	
  
•  Schema	
  Object	
  StaPsPcs	
  
•  Several	
  Others	
  
Enkitec	
  (c)	
  2014	
   4	
  
Flexibility:	
  Good	
  or	
  Evil?	
  
•  CBO	
  Mission	
  
– Compute	
  an	
  OpPmal	
  Plan	
  for	
  a	
  given	
  SQL	
  and	
  its	
  Data	
  
•  Plans	
  have	
  many	
  and	
  complex	
  Dependencies	
  
•  CBO	
  Performance	
  
– Successful	
  most	
  of	
  the	
  Pmes	
  
•  Produces	
  a	
  sub-­‐opPmal	
  Plan	
  some,mes	
  
Enkitec	
  (c)	
  2014	
   5	
  
DBA	
  Recurrent	
  Nightmare	
  
•  A	
  business	
  criPcal	
  process	
  experiences	
  an	
  
occasional	
  slow	
  down	
  
– Same	
  SQL	
  usually	
  runs	
  quickly	
  
– Developers	
  claim	
  they	
  haven’t	
  changed	
  anything	
  
– Users	
  claim	
  they	
  do	
  the	
  same	
  every	
  Pme	
  
– Business	
  keeps	
  reporPng	
  this:	
  to	
  YOU!	
  
Enkitec	
  (c)	
  2014	
   6	
  
Why	
  Plans	
  Perform	
  Inconsistently?	
  (1)	
  
•  Concurrency	
  with	
  some	
  other	
  Process	
  
•  State	
  of	
  Buffer	
  Cache	
  
•  RAC	
  Node	
  Affinity	
  
•  CPU	
  StarvaPon	
  
•  Sudden	
  Changes	
  on	
  Data	
  Volume	
  
•  Inconsistent	
  Performance	
  through	
  Database	
  Link	
  
Enkitec	
  (c)	
  2014	
   7	
  
Why	
  Plans	
  Perform	
  Inconsistently?	
  (2)	
  
•  Downgraded	
  Parallel	
  ExecuPon	
  
•  Crossing	
  Small-­‐Table	
  Threshold	
  
•  Resource	
  Manager	
  DirecPve	
  
•  Plan	
  Flips	
  
•  Many	
  Others…	
  
Enkitec	
  (c)	
  2014	
   8	
  
Why	
  a	
  Plan	
  Flips?	
  (1)	
  
•  Bind	
  Variable	
  Peeking	
  with	
  Histograms	
  
•  Outdated	
  Schema	
  Object	
  (SO)	
  StaPsPcs	
  
•  Missing	
  SO	
  StaPsPcs	
  
•  Fresh	
  SO	
  StaPsPcs	
  
•  New	
  Empty	
  ParPPons	
  
Enkitec	
  (c)	
  2014	
   9	
  
Why	
  a	
  Plan	
  Flips?	
  (2)	
  
•  Incomplete	
  set	
  of	
  CBO	
  Hints	
  
– Either	
  on	
  SQL	
  Text	
  or	
  SQL	
  Profile	
  
•  Dropped,	
  Invalid,	
  Invisible	
  or	
  new	
  Indexes	
  
•  Index	
  or	
  Table	
  rebuild	
  
•  Two	
  or	
  more	
  Plans	
  with	
  similar	
  Cost	
  
Enkitec	
  (c)	
  2014	
   10	
  
Why	
  a	
  Plan	
  Flips?	
  (3)	
  
•  Database	
  Parameters	
  Changes	
  
•  CBO	
  System	
  StaPsPcs	
  Changes	
  
•  Asynchronous	
  SO	
  StaPsPcs	
  Gathering	
  
•  Many	
  Others…	
  
Enkitec	
  (c)	
  2014	
   11	
  
How	
  to	
  MiPgate	
  Plan	
  Flipping?	
  
•  Solid	
  CBO	
  StaPsPcs	
  
•  Default	
  CBO	
  Parameters	
  
•  Avoid	
  Global	
  Changes	
  
Enkitec	
  (c)	
  2014	
   12	
  
Plan	
  Flexibility	
  Allies	
  
•  CBO	
  Parameters	
  
•  CBO	
  StaPsPcs	
  
•  Dynamic	
  Sampling	
  
•  Cardinality	
  Feedback	
  
•  Cursor	
  Sharing	
  
•  Adap0ve	
  Cursor	
  Sharing	
  (ACS)	
  
Enkitec	
  (c)	
  2014	
   13	
  
Plan	
  Stability	
  Tools	
  
•  CBO	
  Hints	
  
•  Stored	
  Outlines	
  
•  SQL	
  Profiles	
  
•  SQL	
  Plan	
  Management	
  (SPM)	
  
Enkitec	
  (c)	
  2014	
   14	
  
SQL	
  Plan	
  Management	
  
•  11g+	
  
•  MulPple	
  Persistent	
  OpPmal	
  ExecuPon	
  Plans	
  per	
  
SQL	
  
•  Only	
  “accepted”	
  and	
  “enabled”	
  Plans	
  are	
  Executed	
  
•  New	
  Plans	
  are	
  acknowledged	
  but	
  not	
  Executed	
  
•  Goal:	
  Plan	
  Stability	
  with	
  controlled	
  Flexibility	
  	
  
Enkitec	
  (c)	
  2014	
   15	
  
SQL	
  Plan	
  Baseline	
  
•  A	
  set	
  of	
  Plans	
  available	
  to	
  the	
  CBO	
  for	
  a	
  given	
  SQL	
  
– IdenPfied	
  by	
  SQL	
  Handle	
  and	
  Signature	
  	
  
•  Hash	
  funcPon	
  on	
  SQL	
  Text	
  
•  dbms_sqltune.sqltext_to_signature	
  
– View	
  dba_sql_plan_baselines	
  
•  enabled	
  =	
  YES	
  
•  accepted	
  =	
  YES	
  
•  reproduced	
  =	
  YES	
  
Enkitec	
  (c)	
  2014	
   16	
  
Plan	
  History	
  
•  Content	
  of	
  dba_sql_plan_baselines	
  
•  Includes	
  SQL	
  Plan	
  Baseline	
  	
  
•  Includes	
  Pending	
  Plans	
  
– accepted	
  =	
  NO	
  and	
  last_verified	
  is	
  NULL	
  
•  Includes	
  Rejected	
  Plans	
  
– accepted	
  =	
  NO	
  and	
  last_verified	
  is	
  not	
  NULL	
  
•  Includes	
  Disabled	
  Plans	
  
Enkitec	
  (c)	
  2014	
   17	
  
Methods	
  to	
  Create	
  a	
  Plan	
  Baseline	
  
1.  Capture	
  
2.  Load	
  
a.  Cursor	
  Cache	
  (CUR)	
  
b.  SQL	
  Tuning	
  Set	
  (STS)	
  
c.  Stored	
  Outline	
  
3.  MigraPon	
  
Enkitec	
  (c)	
  2014	
   18	
  
1.  Capture	
  
2.  Load	
  
a.  CUR	
  
b.  STS	
  
c.  AWR	
  
d.  SPA	
  
e.  TRC	
  
3.  MigraPon	
  
Capturing	
  a	
  SQL	
  Plan	
  Baseline	
  (1)	
  
•  Set	
  opPmizer_use_sql_plan_baselines	
  to	
  TRUE	
  
(default)	
  
•  Set	
  opPmizer_capture_sql_plan_baselines	
  to	
  TRUE	
  
(default	
  is	
  FALSE)	
  
– Set	
  this	
  parameter	
  at	
  SESSION	
  level	
  
•  Execute	
  SQL	
  2	
  Pmes	
  
•  Set	
  opPmizer_capture_sql_plan_baselines	
  to	
  
FALSE	
  
Enkitec	
  (c)	
  2014	
   19	
  
Capturing	
  a	
  SQL	
  Plan	
  Baseline	
  (2)	
  
Enkitec	
  (c)	
  2014	
   20	
  
Loading	
  SQL	
  Plan	
  Baseline	
  from	
  Cache	
  
•  dbms_spm.load_plans_from_cursor_cache	
  
– Inputs	
  
•  sql_id	
  
•  plan_hash_value	
  (opt)	
  
– Outputs	
  
•  Number	
  of	
  Plans	
  loaded	
  
Enkitec	
  (c)	
  2014	
   21	
  
22	
  
DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE	
  (	
  
	
  	
  	
  sql_id	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  VARCHAR2,	
  
	
  	
  	
  plan_hash_value	
  	
  	
  IN	
  	
  NUMBER	
  	
  	
  :=	
  NULL,	
  
	
  	
  	
  sql_text	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  CLOB,	
  
	
  	
  	
  fixed	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  VARCHAR2	
  :=	
  'NO',	
  
	
  	
  	
  enabled	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  VARCHAR2	
  :=	
  'YES')	
  
	
  RETURN	
  PLS_INTEGER;	
  
	
  
DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE	
  (	
  
	
  	
  	
  sql_id	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  VARCHAR2,	
  
	
  	
  	
  plan_hash_value	
  	
  	
  IN	
  	
  NUMBER	
  	
  	
  :=	
  NULL,	
  
	
  	
  	
  sql_handle	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  VARCHAR2,	
  
	
  	
  	
  fixed	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  VARCHAR2	
  :=	
  'NO',	
  
	
  	
  	
  enabled	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  VARCHAR2	
  :=	
  'YES')	
  
	
  RETURN	
  PLS_INTEGER;	
  
	
  
DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE	
  (	
  
	
  	
  	
  sql_id	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  VARCHAR2,	
  
	
  	
  	
  plan_hash_value	
  	
  	
  IN	
  	
  NUMBER	
  	
  	
  :=	
  NULL,	
  
	
  	
  	
  fixed	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  VARCHAR2	
  :=	
  'NO',	
  
	
  	
  	
  enabled	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  	
  VARCHAR2	
  :=	
  'YES')	
  
	
  RETURN	
  PLS_INTEGER;	
  
	
  
DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE	
  (	
  
	
  	
  	
  attribute_name	
  	
  	
  IN	
  VARCHAR2,	
  
	
  	
  	
  attribute_value	
  	
  IN	
  VARCHAR2,	
  
	
  	
  	
  fixed	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  VARCHAR2	
  :=	
  'NO',	
  
	
  	
  	
  enabled	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  VARCHAR2	
  :=	
  'YES')	
  
	
  	
  RETURN	
  PLS_INTEGER;	
  
Enkitec	
  (c)	
  2014	
  
One	
  of	
  possible	
  attribute	
  names:	
  
•  'SQL_TEXT'	
  (like)	
  
•  'PARSING_SCHEMA_NAME'	
  (equality)	
  
•  'MODULE'	
  (equality)	
  
•  'ACTION'	
  (equality)	
  
SQL	
  text	
  to	
  use	
  in	
  identifying	
  the	
  SQL	
  plan	
  
baseline	
  into	
  which	
  the	
  plans	
  are	
  loaded.	
  If	
  the	
  
SQL	
  plan	
  baseline	
  does	
  not	
  exist,	
  it	
  is	
  created.	
  
The	
  use	
  of	
  text	
  is	
  crucial	
  when	
  the	
  user	
  tunes	
  a	
  
SQL	
  statement	
  by	
  adding	
  hints	
  to	
  its	
  text	
  and	
  
then	
  wants	
  to	
  load	
  the	
  resulting	
  plan(s)	
  into	
  the	
  
SQL	
  plan	
  baseline	
  of	
  the	
  original	
  SQL	
  statement.	
  
SQL	
  handle	
  to	
  use	
  in	
  identifying	
  the	
  SQL	
  plan	
  
baseline	
  into	
  which	
  the	
  plans	
  are	
  loaded.	
  The	
  
sql_handle	
  must	
  denote	
  an	
  existing	
  SQL	
  plan	
  
baseline.	
  The	
  use	
  of	
  handle	
  is	
  crucial	
  when	
  the	
  
user	
  tunes	
  a	
  SQL	
  statement	
  by	
  adding	
  hints	
  to	
  its	
  
text	
  and	
  then	
  wants	
  to	
  load	
  the	
  resulting	
  plan(s)	
  
into	
  the	
  SQL	
  plan	
  baseline	
  of	
  the	
  original	
  SQL	
  
statement.	
  
Plan	
  identifier.	
  Default	
  NULL	
  means	
  capture	
  all	
  
plans	
  present	
  in	
  the	
  cursor	
  cache	
  for	
  the	
  SQL	
  
statement	
  identified	
  by	
  SQL_ID.	
  
SQL	
  Plan	
  Baseline	
  Loading	
  OpPons	
  
•  Load	
  a	
  Plan	
  from	
  a	
  Hinted	
  version	
  of	
  a	
  SQL	
  into	
  
SQL	
  Baseline	
  of	
  Original	
  SQL	
  
– Use	
  SQL	
  Text	
  if	
  there	
  is	
  no	
  pre-­‐exisPng	
  SQL	
  Baseline	
  
– Use	
  SQL	
  Handle	
  if	
  SQL	
  Baseline	
  already	
  exists	
  
•  Load	
  one	
  or	
  more	
  Cursor	
  Plans	
  (memory)	
  for	
  a	
  SQL	
  
•  Load	
  Plans	
  for	
  Subset	
  of	
  Cursors	
  based	
  on	
  Schema,	
  
SQL	
  Text	
  “like”	
  or	
  ApplicaPon	
  (Module	
  or	
  AcPon)	
  
Enkitec	
  (c)	
  2014	
   23	
  
Demo	
  6	
  
•  Load	
  Plans	
  for	
  Query	
  out	
  of	
  Demo	
  5	
  
– demo5.sql	
  (1st	
  Pme)	
  
– load_plans.sql	
  
•  Execute	
  Demo	
  5	
  again	
  and	
  review	
  Plan	
  History	
  
– demo5.sql	
  (2nd	
  Pme)	
  
– list_plans.sql	
  
•  Execute	
  demo5.sql	
  2x	
  (3rd	
  &	
  4th)	
  and	
  verify	
  results	
  
Enkitec	
  (c)	
  2014	
   24	
  
Demo	
  6	
  Results	
  (aqer	
  3rd	
  demo5.sql)	
  
	
  	
  	
  	
  	
  	
  CHILD	
  	
  EXECUTIONS	
  BUFFER_GETS	
  PLAN_HASH_VALUE	
  SHAR	
  SENS	
  AWRE	
  
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  3	
  	
  	
  	
  	
  	
  	
  	
  9090	
  	
  	
  	
  	
  	
  3600618656	
  	
  	
  	
  Y	
  	
  	
  	
  Y	
  	
  	
  	
  N	
  
	
  
	
  	
  	
  	
  	
  	
  CHILD	
  	
  	
  BUCKET_ID	
  	
  	
  	
  	
  	
  	
  COUNT	
  
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  2	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  2	
  
Note	
  
-­‐-­‐-­‐-­‐-­‐	
  
	
  	
  	
  -­‐	
  SQL	
  plan	
  baseline	
  SQL_PLAN_652hmt7yxthdwc0e59472	
  used	
  for	
  this	
  statement	
  
	
  
CREATED	
   	
   	
  	
  	
  	
  	
  	
  	
  	
  PLAN_NAME 	
   	
  	
  	
  	
  	
  	
  	
  ENA	
  ACC	
  REP	
  FIX	
  
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐	
  -­‐-­‐-­‐	
  -­‐-­‐-­‐	
  -­‐-­‐-­‐	
  
21-­‐JUN-­‐14	
  02.00.10.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdw80508062	
  YES	
  YES	
  YES	
  NO	
  
21-­‐JUN-­‐14	
  02.00.10.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdwc0e59472	
  YES	
  YES	
  YES	
  NO	
  
21-­‐JUN-­‐14	
  02.00.10.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdwe00bee24	
  YES	
  YES	
  YES	
  NO	
  
21-­‐JUN-­‐14	
  02.00.19.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdwc82a6b0c	
  YES	
  NO	
  	
  YES	
  NO	
  
Enkitec	
  (c)	
  2014	
   25	
  
Demo	
  6	
  Results	
  (aqer	
  4th	
  demo5.sql)	
  
	
  CHILD	
  	
  	
  	
  	
  	
  	
  EXECUTIONS	
  BUFFER_GETS	
  PLAN_HASH_VALUE	
  SHAR	
  SENS	
  AWRE	
  
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  
	
  	
  	
  0 	
  	
  	
  	
  	
  	
   	
   	
  2	
  	
  	
  	
  	
  	
  723482	
  	
  	
  847574763	
   	
  	
   	
  N 	
  	
  Y	
  	
  	
  	
  N	
  
	
  	
  	
  1 	
  	
  	
  	
   	
   	
   	
  1	
  	
  	
  	
  	
  	
  	
  	
  2404	
  	
  3600618656	
   	
  	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  2 	
  	
  	
  	
  	
  	
   	
   	
  1	
  	
  	
  	
  	
  	
  	
  	
  1977	
  	
  	
  189372815	
   	
  	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  3 	
  	
  	
  	
  	
  	
   	
   	
  1	
   	
   	
  	
  568	
  	
  	
  847574763	
   	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
Note	
  
-­‐-­‐-­‐-­‐-­‐	
  
	
  	
  	
  -­‐	
  SQL	
  plan	
  baseline	
  SQL_PLAN_652hmt7yxthdw80508062	
  used	
  for	
  this	
  statement	
  
	
  
CREATED	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  PLAN_NAME	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ENA	
  ACC	
  REP	
  FIX	
  
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐	
  -­‐-­‐-­‐	
  -­‐-­‐-­‐	
  -­‐-­‐-­‐	
  
28-­‐DEC-­‐13	
  02.03.43.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdw501f1424	
  YES	
  YES	
  YES	
  NO	
  
28-­‐DEC-­‐13	
  02.03.43.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdwb6c39290	
  YES	
  YES	
  YES	
  NO	
  
28-­‐DEC-­‐13	
  02.03.43.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdwd624c0cd	
  YES	
  YES	
  YES	
  NO	
  
28-­‐DEC-­‐13	
  02.03.50.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdwc82a6b0c	
  YES	
  NO	
  	
  YES	
  NO	
  
Enkitec	
  (c)	
  2014	
   26	
  
Demo	
  7	
  
•  Drop	
  SQL	
  Plan	
  Baseline	
  
– drop_plans.sql	
  
•  Create	
  SQL	
  Patch	
  with	
  /*+	
  BIND_AWARE	
  */	
  Hint	
  
– sqlpch.sql	
  for	
  8u0n7w1jug5dg	
  connected	
  as	
  SYS	
  
•  Load	
  Plans	
  for	
  Query	
  out	
  of	
  Demo	
  5	
  
– demo5.sql	
  
– load_plans.sql	
  
Enkitec	
  (c)	
  2014	
   27	
  
Demo	
  7	
  Results	
  
	
  CHILD	
  	
  	
  	
  	
  	
  	
  EXECUTIONS	
  BUFFER_GETS	
  PLAN_HASH_VALUE	
  SHAR	
  SENS	
  AWRE	
  
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  
	
  	
  	
  0 	
  	
  	
  	
  	
  	
  	
   	
   	
  1	
  	
  	
  	
  	
  	
  	
  	
  2191	
  	
  	
  847574763	
  	
  	
  	
   	
  N 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  1 	
  	
  	
  	
  	
  	
  	
   	
   	
  1	
  	
  	
  	
  	
  	
  	
  	
  3030	
  	
  2048551027	
  	
  	
  	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  2 	
  	
  	
  	
  	
  	
  	
   	
   	
  1	
  	
  	
  	
  	
  	
  	
  	
  2404	
  	
  3600618656	
  	
  	
  	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  3 	
  	
  	
  	
  	
  	
  	
   	
   	
  1	
  	
  	
  	
  	
  	
  	
  	
  1977	
  	
  	
  189372815	
  	
  	
  	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  4 	
  	
  	
  	
  	
  	
  	
   	
   	
  1	
   	
   	
  	
  568	
  	
  	
  847574763	
  	
  	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  
	
  
CREATED	
  	
   	
  	
  	
  	
  	
  	
  	
  	
   	
   	
   	
  PLAN_NAME 	
   	
  	
  	
  	
  	
  	
  	
   	
  	
   	
  ENA	
  ACC	
  REP	
  FIX	
  
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐	
  -­‐-­‐-­‐	
  -­‐-­‐-­‐	
  -­‐-­‐-­‐	
  
21-­‐JUN-­‐14	
  02.09.14.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdw80508062	
  YES	
  YES	
  YES	
  NO	
  
21-­‐JUN-­‐14	
  02.09.14.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdwc0e59472	
  YES	
  YES	
  YES	
  NO	
  
21-­‐JUN-­‐14	
  02.09.14.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdwc82a6b0c	
  YES	
  YES	
  YES	
  NO	
  
21-­‐JUN-­‐14	
  02.09.14.000000	
  PM	
  	
  	
  SQL_PLAN_652hmt7yxthdwe00bee24	
  YES	
  YES	
  YES	
  NO	
  
	
  
Enkitec	
  (c)	
  2014	
   28	
  
Demo	
  8	
  
•  Execute	
  queries	
  1-­‐5	
  and	
  observe	
  how	
  number	
  of	
  
ExecuPons	
  increases	
  per	
  Child	
  Cursor	
  
– flush.sql	
  
– demo8.sql	
  
– demo8.sql	
  
– demo8.sql	
  
Enkitec	
  (c)	
  2014	
   29	
  
Demo	
  8	
  Results	
  
	
  CHILD	
  	
   	
  	
  EXECUTIONS	
  BUFFER_GETS	
  PLAN_HASH_VALUE	
  SHAR	
  	
  SENS	
  AWRE	
  
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  	
  -­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  
	
  	
  	
  0 	
   	
  	
  	
  	
  	
  1	
  	
  	
  	
  	
  	
  	
  	
  3030	
  	
  	
  	
  	
  	
  2048551027	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  1 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  	
  	
  	
  	
  	
  	
  	
  2404	
  	
  	
  	
  	
  	
  3600618656	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  2 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  	
  	
  	
  	
  	
  	
  	
  1977	
  	
  	
  	
  	
  	
  	
  189372815	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  3 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  	
   	
  	
  	
  568	
  	
  	
  	
  	
  	
  	
  847574763	
   	
  N 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  4 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1	
  	
  	
  	
   	
  	
  	
  724	
  	
  	
  	
  	
  	
  	
  847574763	
   	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
Note	
  
-­‐-­‐-­‐-­‐-­‐	
  
	
  	
  	
  -­‐	
  SQL	
  patch	
  "sqlpch_8u0n7w1jug5dg"	
  used	
  for	
  this	
  statement	
  
	
  	
  	
  -­‐	
  SQL	
  plan	
  baseline	
  SQL_PLAN_652hmt7yxthdwb6c39290	
  used	
  for	
  this	
  statement	
  
	
  
	
   	
  CHILD	
  	
  EXECUTIONS	
  BUFFER_GETS	
  PLAN_HASH_VALUE	
  SHAR	
  	
  	
  SENS	
  AWRE	
  
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  	
  	
  -­‐-­‐-­‐-­‐	
  -­‐-­‐-­‐-­‐	
  
	
  	
  	
  0 	
  	
  	
  	
  	
  	
  	
  2	
  	
  	
  	
  	
  	
  	
  	
  6060 	
  	
   	
  2048551027	
  	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  1 	
  	
  	
  	
  	
  	
  	
  2	
  	
  	
  	
  	
  	
  	
  	
  4808 	
  	
   	
  3600618656	
  	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  2 	
  	
  	
  	
  	
  	
  	
  2	
  	
  	
  	
  	
  	
  	
  	
  3954 	
  	
   	
  	
  189372815	
  	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  3 	
  	
  	
  	
  	
  	
  	
  1	
   	
  	
  	
  	
  	
  568 	
  	
   	
  	
  847574763	
  	
  N 	
  	
  Y	
  	
  	
  	
  Y	
  
	
  	
  	
  4 	
  	
  	
  	
  	
  	
  	
  3	
  	
  	
  	
  	
  	
  	
  	
  2016 	
  	
   	
  	
  847574763	
  	
  Y 	
  	
  Y	
  	
  	
  	
  Y	
  
Enkitec	
  (c)	
  2014	
   30	
  
Evolving	
  a	
  Plan	
  (1)	
  
•  Evolving	
  a	
  Plan	
  means	
  “accepPng”	
  it	
  
– PromoPng	
  it	
  from	
  Plan	
  History	
  into	
  SQL	
  Plan	
  Baseline	
  
•  dbms_spm.evolve_sql_plan_baseline	
  
– sql_handle	
  (opt)	
  
– plan_name	
  (opt)	
  
– verify	
  (default	
  YES)	
  
– commit	
  (default	
  YES)	
  
Enkitec	
  (c)	
  2014	
   31	
  
Enkitec	
  (c)	
  2014	
   32	
  
DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE	
  (	
  
	
  	
  	
  sql_handle	
  	
  	
  IN	
  VARCHAR2	
  :=	
  NULL,	
  
	
  	
  	
  plan_name	
  	
  	
  	
  IN	
  VARCHAR2	
  :=	
  NULL,	
  
	
  	
  	
  time_limit	
  	
  	
  IN	
  INTEGER	
  	
  :=	
  DBMS_SPM.AUTO_LIMIT,	
  
	
  	
  	
  verify	
  	
  	
  	
  	
  	
  	
  IN	
  VARCHAR2	
  :=	
  'YES',	
  
	
  	
  	
  commit	
  	
  	
  	
  	
  	
  	
  IN	
  VARCHAR2	
  :=	
  'YES')	
  
	
  	
  RETURN	
  CLOB;	
  
	
  
DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE	
  (	
  
	
  	
  	
  plan_list	
  	
  	
  	
  IN	
  DBMS_SPM.NAME_LIST,	
  
	
  	
  	
  time_limit	
  	
  	
  IN	
  INTEGER	
  	
  :=	
  DBMS_SPM.AUTO_LIMIT,	
  
	
  	
  	
  verify	
  	
  	
  	
  	
  	
  	
  IN	
  VARCHAR2	
  :=	
  'YES',	
  
	
  	
  	
  commit	
  	
  	
  	
  	
  	
  	
  IN	
  VARCHAR2	
  :=	
  'YES')	
  
	
  	
  RETURN	
  CLOB;	
  
Evolving	
  a	
  Plan	
  (2)	
  
Demo	
  9	
  
•  Drop	
  SQL	
  Plan	
  Baseline	
  
– drop_plans.sql	
  
•  Capture	
  SQL	
  Plan	
  Baseline	
  with	
  1	
  accepted	
  Plan	
  
– demo9.sql	
  
– list_plans.sql	
  
•  Evolve	
  all	
  Plans	
  on	
  Plan	
  History	
  
– evolve.sql	
  
Enkitec	
  (c)	
  2014	
   33	
  
FIXED	
  Flag	
  
•  When	
  set	
  to	
  YES	
  
– Only	
  FIXED	
  Plans	
  are	
  considered	
  for	
  Plan	
  SelecPon	
  
– No	
  more	
  Plans	
  are	
  Captured	
  into	
  Plan	
  History	
  
Enkitec	
  (c)	
  2014	
   34	
  
Alter	
  SQL	
  Plan	
  Baselines	
  
Enkitec	
  (c)	
  2014	
   35	
  
DBMS_SPM.ALTER_SQL_PLAN_BASELINE	
  (	
  
	
  	
  	
  sql_handle	
  	
  	
  	
  	
  	
  	
  	
  IN	
  VARCHAR2	
  :=	
  NULL,	
  
	
  	
  	
  plan_name	
  	
  	
  	
  	
  	
  	
  	
  	
  IN	
  VARCHAR2	
  :=	
  NULL,	
  
	
  	
  	
  attribute_name	
  	
  	
  	
  IN	
  VARCHAR2,	
  
	
  	
  	
  attribute_value	
  	
  	
  IN	
  VARCHAR2)	
  
	
  RETURN	
  PLS_INTEGER;	
  
Attribute	
  Names	
  &	
  Values:	
  
enabled	
   	
   	
  'YES'	
  or	
  'NO'	
  
fixed	
   	
   	
   	
  'YES'	
  or	
  'NO'	
  
autopurge	
  	
   	
  'YES'	
  or	
  'NO'	
  
plan_name	
  	
   	
  String	
  of	
  up	
  to	
  30-­‐characters	
  
description	
   	
  String	
  of	
  up	
  to	
  500-­‐characters	
  
Plan	
  SelecPon	
  (1)	
  
•  At	
  hard	
  parse	
  when	
  SQL	
  Plan	
  Baseline	
  (SPB)	
  exists	
  
1.  CBO	
  computes	
  an	
  “OpPmal”	
  Plan	
  (OP)	
  
•  AdapPve	
  Cursor	
  Sharing	
  is	
  used	
  if	
  applicable	
  
2.  If	
  OP	
  exists	
  in	
  SPB	
  then	
  execute	
  this	
  OP	
  
3.  If	
  OP	
  does	
  not	
  exist	
  in	
  SPB	
  then	
  store	
  it	
  in	
  Plan	
  History	
  
a.  If	
  there	
  are	
  FIXED	
  Plans	
  in	
  SPB	
  
i.  Re-­‐cost	
  all	
  FIXED	
  Plans	
  using	
  Binds	
  and	
  execute	
  cheapest	
  
b.  If	
  there	
  are	
  no	
  FIXED	
  Plans	
  in	
  SPM	
  
i.  Re-­‐cost	
  all	
  Plans	
  using	
  Binds	
  and	
  execute	
  cheapest	
  
Enkitec	
  (c)	
  2014	
   36	
  
Plan	
  SelecPon	
  (2)	
  
Enkitec	
  (c)	
  2014	
   37	
  
Demo	
  10	
  
•  FIX	
  one	
  Plan	
  from	
  SQL	
  Plan	
  Baseline	
  
– alter_plans.sql	
  
•  Verify	
  only	
  one	
  Plan	
  was	
  Executed	
  
– flush.sql	
  
– demo8.sql	
  
– demo8.sql	
  
Enkitec	
  (c)	
  2014	
   38	
  
SPM	
  Summary	
  
Enkitec	
  (c)	
  2014	
   39	
  
•  SPM	
  provides	
  much	
  desired	
  Plan	
  Stability	
  
– Only	
  “approved”	
  Plans	
  are	
  allowed	
  to	
  Execute	
  
•  ACS	
  can	
  generate	
  a	
  healthy	
  stock	
  of	
  OpPmal	
  Plans	
  
– You	
  can	
  restrict	
  them	
  to	
  work	
  under	
  SPM	
  
•  Combining	
  ACS	
  and	
  SPM	
  you	
  can	
  obtain	
  
– Plan	
  Flexibility	
  and	
  Plan	
  Stability	
  
ACS	
  Suggested	
  Strategy	
  
•  Use	
  sys.dbms_sqldiag_internal.i_create_patch	
  to	
  
SQL	
  Patch	
  with	
  BIND_AWARE	
  the	
  SQL	
  on	
  Baselines	
  	
  
•  Use	
  free	
  script	
  sqlpch.sql	
  
Enkitec	
  (c)	
  2014	
   40	
  
SPM	
  Suggested	
  Strategies	
  
1.  ConservaPve	
  
– One	
  SQL	
  at	
  a	
  Pme	
  
2.  Moderate	
  
– One	
  ApplicaPon	
  at	
  a	
  Pme	
  (Module	
  or	
  AcPon)	
  
– One	
  Schema	
  at	
  a	
  Pme	
  
3.  Aggressive	
  (a.k.a.	
  Cowboy	
  method)	
  
– All	
  ApplicaPon	
  Schemas	
  at	
  once	
  
Enkitec	
  (c)	
  2014	
   41	
  
Oracle	
  Pack	
  Licenses	
  
•  DBMS_SPM	
  
– No	
  Oracle	
  Pack	
  License	
  
•  DBMS_SQLTUNE	
  
– Oracle	
  Tuning	
  Pack	
  
•  AWR	
  
– Oracle	
  DiagnosPcs	
  Pack	
  
Enkitec	
  (c)	
  2014	
   42	
  
References	
  (1)	
  
•  Random	
  Slowdown	
  by	
  Jonathan	
  Lewis	
  
– hvp://jonathanlewis.wordpress.com/2013/12/23/
plan-­‐changes/	
  
•  SQL	
  Plan	
  Management	
  SPM	
  Aware	
  OpPmizer	
  
– hvps://blogs.oracle.com/opPmizer/entry/
sql_plan_management_part_2_of_4_spm_aware_opP
mizer	
  
Enkitec	
  (c)	
  2014	
   43	
  
References	
  (2)	
  
•  Oracle®	
  Database	
  PL/SQL	
  Packages	
  and	
  Types	
  
Reference	
  
– 11g	
  Release	
  2	
  (11.2)	
  
– Part	
  Number	
  E25788-­‐04	
  
Enkitec	
  (c)	
  2014	
   44	
  
Contact	
  InformaPon	
  
•  carlos.sierra@enkitec.com	
  
•  carlos-­‐sierra.net	
  
•  @csierra_usa	
  
Enkitec	
  (c)	
  2014	
   45	
  

Weitere ähnliche Inhalte

Was ist angesagt?

ClickHouse Materialized Views: The Magic Continues
ClickHouse Materialized Views: The Magic ContinuesClickHouse Materialized Views: The Magic Continues
ClickHouse Materialized Views: The Magic ContinuesAltinity Ltd
 
Understanding PostgreSQL LW Locks
Understanding PostgreSQL LW LocksUnderstanding PostgreSQL LW Locks
Understanding PostgreSQL LW LocksJignesh Shah
 
MySQL Fabricでぼっこぼこにされたはなし
MySQL FabricでぼっこぼこにされたはなしMySQL Fabricでぼっこぼこにされたはなし
MySQL Fabricでぼっこぼこにされたはなしyoku0825
 
How to Build a Scylla Database Cluster that Fits Your Needs
How to Build a Scylla Database Cluster that Fits Your NeedsHow to Build a Scylla Database Cluster that Fits Your Needs
How to Build a Scylla Database Cluster that Fits Your NeedsScyllaDB
 
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...Altinity Ltd
 
Deep Dive: Maximizing EC2 and EBS Performance
Deep Dive: Maximizing EC2 and EBS PerformanceDeep Dive: Maximizing EC2 and EBS Performance
Deep Dive: Maximizing EC2 and EBS PerformanceAmazon Web Services
 
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEOTricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEOAltinity Ltd
 
High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniHigh Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniZalando Technology
 
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdfDeep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdfAltinity Ltd
 
A Fast Intro to Fast Query with ClickHouse, by Robert Hodges
A Fast Intro to Fast Query with ClickHouse, by Robert HodgesA Fast Intro to Fast Query with ClickHouse, by Robert Hodges
A Fast Intro to Fast Query with ClickHouse, by Robert HodgesAltinity Ltd
 
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEOClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEOAltinity Ltd
 
New Tools for a More Functional C++
New Tools for a More Functional C++New Tools for a More Functional C++
New Tools for a More Functional C++Sumant Tambe
 
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevAltinity Ltd
 
Cilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDPCilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDPThomas Graf
 
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...confluent
 
A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides Altinity Ltd
 
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEOClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEOAltinity Ltd
 
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...Altinity Ltd
 
Materialize: a platform for changing data
Materialize: a platform for changing dataMaterialize: a platform for changing data
Materialize: a platform for changing dataAltinity Ltd
 

Was ist angesagt? (20)

ClickHouse Materialized Views: The Magic Continues
ClickHouse Materialized Views: The Magic ContinuesClickHouse Materialized Views: The Magic Continues
ClickHouse Materialized Views: The Magic Continues
 
Understanding PostgreSQL LW Locks
Understanding PostgreSQL LW LocksUnderstanding PostgreSQL LW Locks
Understanding PostgreSQL LW Locks
 
MySQL Fabricでぼっこぼこにされたはなし
MySQL FabricでぼっこぼこにされたはなしMySQL Fabricでぼっこぼこにされたはなし
MySQL Fabricでぼっこぼこにされたはなし
 
How to Build a Scylla Database Cluster that Fits Your Needs
How to Build a Scylla Database Cluster that Fits Your NeedsHow to Build a Scylla Database Cluster that Fits Your Needs
How to Build a Scylla Database Cluster that Fits Your Needs
 
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
 
Deep Dive: Maximizing EC2 and EBS Performance
Deep Dive: Maximizing EC2 and EBS PerformanceDeep Dive: Maximizing EC2 and EBS Performance
Deep Dive: Maximizing EC2 and EBS Performance
 
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEOTricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
 
High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniHigh Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando Patroni
 
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdfDeep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
 
TiDB Introduction
TiDB IntroductionTiDB Introduction
TiDB Introduction
 
A Fast Intro to Fast Query with ClickHouse, by Robert Hodges
A Fast Intro to Fast Query with ClickHouse, by Robert HodgesA Fast Intro to Fast Query with ClickHouse, by Robert Hodges
A Fast Intro to Fast Query with ClickHouse, by Robert Hodges
 
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEOClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
 
New Tools for a More Functional C++
New Tools for a More Functional C++New Tools for a More Functional C++
New Tools for a More Functional C++
 
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
 
Cilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDPCilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDP
 
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
 
A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides
 
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEOClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
 
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
 
Materialize: a platform for changing data
Materialize: a platform for changing dataMaterialize: a platform for changing data
Materialize: a platform for changing data
 

Andere mochten auch

CPL Why women are your future
CPL Why women are your futureCPL Why women are your future
CPL Why women are your futureAvril McHugh
 
Газета "Хвиля NEW", листопад 2016
Газета "Хвиля NEW", листопад  2016Газета "Хвиля NEW", листопад  2016
Газета "Хвиля NEW", листопад 2016Ольга Катеринич
 
Project Portfolio Management 2015
Project Portfolio Management 2015Project Portfolio Management 2015
Project Portfolio Management 2015Peter Schellinck
 
How to overcome shyness
How to overcome shynessHow to overcome shyness
How to overcome shynessyramirez23
 
Substansi genetika & hereditas
Substansi genetika & hereditasSubstansi genetika & hereditas
Substansi genetika & hereditasRosyid Amrulloh
 
Biosel pembelahan sell
Biosel pembelahan sellBiosel pembelahan sell
Biosel pembelahan sellDewi lestari
 
Oracle Text in APEX
Oracle Text in APEXOracle Text in APEX
Oracle Text in APEXScott Wesley
 
Baroque art in the Hispanic Kingdoms
Baroque art in the Hispanic KingdomsBaroque art in the Hispanic Kingdoms
Baroque art in the Hispanic Kingdomspapefons Fons
 
Ariba and Fieldglass Integration
Ariba and Fieldglass IntegrationAriba and Fieldglass Integration
Ariba and Fieldglass IntegrationSAP Ariba
 
Therese Mathers, Speech and Language Therapist: Ideas and Inspirations to Hav...
Therese Mathers, Speech and Language Therapist: Ideas and Inspirations to Hav...Therese Mathers, Speech and Language Therapist: Ideas and Inspirations to Hav...
Therese Mathers, Speech and Language Therapist: Ideas and Inspirations to Hav...Rowan Adams
 
materi tentang Dna,rna,metabolisme purin,pirimidin
materi tentang Dna,rna,metabolisme purin,pirimidinmateri tentang Dna,rna,metabolisme purin,pirimidin
materi tentang Dna,rna,metabolisme purin,pirimidinyohanes meor
 

Andere mochten auch (18)

CPL Why women are your future
CPL Why women are your futureCPL Why women are your future
CPL Why women are your future
 
Газета "Хвиля NEW", листопад 2016
Газета "Хвиля NEW", листопад  2016Газета "Хвиля NEW", листопад  2016
Газета "Хвиля NEW", листопад 2016
 
Project Portfolio Management 2015
Project Portfolio Management 2015Project Portfolio Management 2015
Project Portfolio Management 2015
 
2016 Congressional Calendar
2016 Congressional Calendar2016 Congressional Calendar
2016 Congressional Calendar
 
Los hemisferios cerebrales
Los hemisferios cerebralesLos hemisferios cerebrales
Los hemisferios cerebrales
 
Хвиля NEW- жовтень 2016
Хвиля NEW- жовтень 2016Хвиля NEW- жовтень 2016
Хвиля NEW- жовтень 2016
 
Overcoming shyness
Overcoming shynessOvercoming shyness
Overcoming shyness
 
Sintesis protein
Sintesis proteinSintesis protein
Sintesis protein
 
Genetika razvoja
Genetika razvoja Genetika razvoja
Genetika razvoja
 
Bab 3: Substansi Genetika
Bab 3: Substansi GenetikaBab 3: Substansi Genetika
Bab 3: Substansi Genetika
 
How to overcome shyness
How to overcome shynessHow to overcome shyness
How to overcome shyness
 
Substansi genetika & hereditas
Substansi genetika & hereditasSubstansi genetika & hereditas
Substansi genetika & hereditas
 
Biosel pembelahan sell
Biosel pembelahan sellBiosel pembelahan sell
Biosel pembelahan sell
 
Oracle Text in APEX
Oracle Text in APEXOracle Text in APEX
Oracle Text in APEX
 
Baroque art in the Hispanic Kingdoms
Baroque art in the Hispanic KingdomsBaroque art in the Hispanic Kingdoms
Baroque art in the Hispanic Kingdoms
 
Ariba and Fieldglass Integration
Ariba and Fieldglass IntegrationAriba and Fieldglass Integration
Ariba and Fieldglass Integration
 
Therese Mathers, Speech and Language Therapist: Ideas and Inspirations to Hav...
Therese Mathers, Speech and Language Therapist: Ideas and Inspirations to Hav...Therese Mathers, Speech and Language Therapist: Ideas and Inspirations to Hav...
Therese Mathers, Speech and Language Therapist: Ideas and Inspirations to Hav...
 
materi tentang Dna,rna,metabolisme purin,pirimidin
materi tentang Dna,rna,metabolisme purin,pirimidinmateri tentang Dna,rna,metabolisme purin,pirimidin
materi tentang Dna,rna,metabolisme purin,pirimidin
 

Ähnlich wie Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability

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 StabilityCarlos Sierra
 
Fast federated SQL with Apache Calcite
Fast federated SQL with Apache CalciteFast federated SQL with Apache Calcite
Fast federated SQL with Apache CalciteChris Baynes
 
Performance Management in Oracle 12c
Performance Management in Oracle 12cPerformance Management in Oracle 12c
Performance Management in Oracle 12cAlfredo Krieg
 
Combining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM StabilityCombining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM 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
 
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...Carlos Sierra
 
Deep Dive of ADBMS Migration to Apache Spark—Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Spark—Use Cases SharingDeep Dive of ADBMS Migration to Apache Spark—Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Spark—Use Cases SharingDatabricks
 
My Experience Using Oracle SQL Plan Baselines 11g/12c
My Experience Using Oracle SQL Plan Baselines 11g/12cMy Experience Using Oracle SQL Plan Baselines 11g/12c
My Experience Using Oracle SQL Plan Baselines 11g/12cNelson Calero
 
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...Understanding how is that adaptive cursor sharing (acs) produces multiple opt...
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...Enkitec
 
SQLServerDays2012_SSIS_CDC
SQLServerDays2012_SSIS_CDCSQLServerDays2012_SSIS_CDC
SQLServerDays2012_SSIS_CDCKoenVerbeeck
 
Meetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDTMeetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDTSolidify
 
Some Iceberg Basics for Beginners (CDP).pdf
Some Iceberg Basics for Beginners (CDP).pdfSome Iceberg Basics for Beginners (CDP).pdf
Some Iceberg Basics for Beginners (CDP).pdfMichael Kogan
 
SQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceSQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceVinod Kumar
 
Adapting and adopting spm v04
Adapting and adopting spm v04Adapting and adopting spm v04
Adapting and adopting spm v04Carlos Sierra
 
Flink Forward SF 2017: Timo Walther - Table & SQL API – unified APIs for bat...
Flink Forward SF 2017: Timo Walther -  Table & SQL API – unified APIs for bat...Flink Forward SF 2017: Timo Walther -  Table & SQL API – unified APIs for bat...
Flink Forward SF 2017: Timo Walther - Table & SQL API – unified APIs for bat...Flink Forward
 
An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1Navneet Upneja
 
PgConf US 2015 - ALTER DATABASE ADD more SANITY
PgConf US 2015  - ALTER DATABASE ADD more SANITYPgConf US 2015  - ALTER DATABASE ADD more SANITY
PgConf US 2015 - ALTER DATABASE ADD more SANITYOleksii Kliukin
 

Ähnlich wie Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability (20)

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
 
Fast federated SQL with Apache Calcite
Fast federated SQL with Apache CalciteFast federated SQL with Apache Calcite
Fast federated SQL with Apache Calcite
 
Performance Management in Oracle 12c
Performance Management in Oracle 12cPerformance Management in Oracle 12c
Performance Management in Oracle 12c
 
Combining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM StabilityCombining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM 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
 
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...
 
Deep Dive of ADBMS Migration to Apache Spark—Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Spark—Use Cases SharingDeep Dive of ADBMS Migration to Apache Spark—Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Spark—Use Cases Sharing
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
My Experience Using Oracle SQL Plan Baselines 11g/12c
My Experience Using Oracle SQL Plan Baselines 11g/12cMy Experience Using Oracle SQL Plan Baselines 11g/12c
My Experience Using Oracle SQL Plan Baselines 11g/12c
 
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...Understanding how is that adaptive cursor sharing (acs) produces multiple opt...
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...
 
SQLServerDays2012_SSIS_CDC
SQLServerDays2012_SSIS_CDCSQLServerDays2012_SSIS_CDC
SQLServerDays2012_SSIS_CDC
 
Meetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDTMeetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDT
 
Some Iceberg Basics for Beginners (CDP).pdf
Some Iceberg Basics for Beginners (CDP).pdfSome Iceberg Basics for Beginners (CDP).pdf
Some Iceberg Basics for Beginners (CDP).pdf
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
SQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceSQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query Performance
 
Adapting and adopting spm v04
Adapting and adopting spm v04Adapting and adopting spm v04
Adapting and adopting spm v04
 
Flink Forward SF 2017: Timo Walther - Table & SQL API – unified APIs for bat...
Flink Forward SF 2017: Timo Walther -  Table & SQL API – unified APIs for bat...Flink Forward SF 2017: Timo Walther -  Table & SQL API – unified APIs for bat...
Flink Forward SF 2017: Timo Walther - Table & SQL API – unified APIs for bat...
 
An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1
 
PgConf US 2015 - ALTER DATABASE ADD more SANITY
PgConf US 2015  - ALTER DATABASE ADD more SANITYPgConf US 2015  - ALTER DATABASE ADD more SANITY
PgConf US 2015 - ALTER DATABASE ADD more SANITY
 
11gR2 Upgrade.pdf
11gR2 Upgrade.pdf11gR2 Upgrade.pdf
11gR2 Upgrade.pdf
 

Mehr von 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 Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the TradeEnkitec
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsEnkitec
 
SQL Tuning Tools of the Trade
SQL Tuning Tools of the TradeSQL Tuning Tools of the Trade
SQL Tuning Tools of the TradeEnkitec
 
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
 

Mehr von 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 Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the Trade
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
SQL Tuning Tools of the Trade
SQL Tuning Tools of the TradeSQL Tuning Tools of the Trade
SQL Tuning Tools of the Trade
 
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
 

Kürzlich hochgeladen

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
[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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
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
 

Kürzlich hochgeladen (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
[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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
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...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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...
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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...
 

Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability

  • 1. Using  SQL  Plan  Management  (SPM)  to   balance  Plan  Flexibility  and  Plan  Stability   Carlos  Sierra  
  • 2. Carlos  Sierra   •  SQLTXPLAIN  +  SQL  Health-­‐Check  SQLHC  +   •  Consultant/Developer/DBA/Design/+   •  Oracle  Performance  +  SQL  Tuning   •  Oracle  Database  Health-­‐Check   •  Tools  +  Scripts   •  Speaker   Enkitec  (c)  2014   2  
  • 3. Topics   •  MoPvaPon   •  SQL  Plan  Management  (SPM)   – Mechanics   – Demos   Enkitec  (c)  2014   3  
  • 4. Plan  Flexibility   •  Cost-­‐based  OpPmizer  (CBO)   – Introduced  in  Oracle  7   – Computes  an  OpPmal  Plan  based  on     •  HeurisPcs   •  Query  Predicates   •  Schema  Object  StaPsPcs   •  Several  Others   Enkitec  (c)  2014   4  
  • 5. Flexibility:  Good  or  Evil?   •  CBO  Mission   – Compute  an  OpPmal  Plan  for  a  given  SQL  and  its  Data   •  Plans  have  many  and  complex  Dependencies   •  CBO  Performance   – Successful  most  of  the  Pmes   •  Produces  a  sub-­‐opPmal  Plan  some,mes   Enkitec  (c)  2014   5  
  • 6. DBA  Recurrent  Nightmare   •  A  business  criPcal  process  experiences  an   occasional  slow  down   – Same  SQL  usually  runs  quickly   – Developers  claim  they  haven’t  changed  anything   – Users  claim  they  do  the  same  every  Pme   – Business  keeps  reporPng  this:  to  YOU!   Enkitec  (c)  2014   6  
  • 7. Why  Plans  Perform  Inconsistently?  (1)   •  Concurrency  with  some  other  Process   •  State  of  Buffer  Cache   •  RAC  Node  Affinity   •  CPU  StarvaPon   •  Sudden  Changes  on  Data  Volume   •  Inconsistent  Performance  through  Database  Link   Enkitec  (c)  2014   7  
  • 8. Why  Plans  Perform  Inconsistently?  (2)   •  Downgraded  Parallel  ExecuPon   •  Crossing  Small-­‐Table  Threshold   •  Resource  Manager  DirecPve   •  Plan  Flips   •  Many  Others…   Enkitec  (c)  2014   8  
  • 9. Why  a  Plan  Flips?  (1)   •  Bind  Variable  Peeking  with  Histograms   •  Outdated  Schema  Object  (SO)  StaPsPcs   •  Missing  SO  StaPsPcs   •  Fresh  SO  StaPsPcs   •  New  Empty  ParPPons   Enkitec  (c)  2014   9  
  • 10. Why  a  Plan  Flips?  (2)   •  Incomplete  set  of  CBO  Hints   – Either  on  SQL  Text  or  SQL  Profile   •  Dropped,  Invalid,  Invisible  or  new  Indexes   •  Index  or  Table  rebuild   •  Two  or  more  Plans  with  similar  Cost   Enkitec  (c)  2014   10  
  • 11. Why  a  Plan  Flips?  (3)   •  Database  Parameters  Changes   •  CBO  System  StaPsPcs  Changes   •  Asynchronous  SO  StaPsPcs  Gathering   •  Many  Others…   Enkitec  (c)  2014   11  
  • 12. How  to  MiPgate  Plan  Flipping?   •  Solid  CBO  StaPsPcs   •  Default  CBO  Parameters   •  Avoid  Global  Changes   Enkitec  (c)  2014   12  
  • 13. Plan  Flexibility  Allies   •  CBO  Parameters   •  CBO  StaPsPcs   •  Dynamic  Sampling   •  Cardinality  Feedback   •  Cursor  Sharing   •  Adap0ve  Cursor  Sharing  (ACS)   Enkitec  (c)  2014   13  
  • 14. Plan  Stability  Tools   •  CBO  Hints   •  Stored  Outlines   •  SQL  Profiles   •  SQL  Plan  Management  (SPM)   Enkitec  (c)  2014   14  
  • 15. SQL  Plan  Management   •  11g+   •  MulPple  Persistent  OpPmal  ExecuPon  Plans  per   SQL   •  Only  “accepted”  and  “enabled”  Plans  are  Executed   •  New  Plans  are  acknowledged  but  not  Executed   •  Goal:  Plan  Stability  with  controlled  Flexibility     Enkitec  (c)  2014   15  
  • 16. SQL  Plan  Baseline   •  A  set  of  Plans  available  to  the  CBO  for  a  given  SQL   – IdenPfied  by  SQL  Handle  and  Signature     •  Hash  funcPon  on  SQL  Text   •  dbms_sqltune.sqltext_to_signature   – View  dba_sql_plan_baselines   •  enabled  =  YES   •  accepted  =  YES   •  reproduced  =  YES   Enkitec  (c)  2014   16  
  • 17. Plan  History   •  Content  of  dba_sql_plan_baselines   •  Includes  SQL  Plan  Baseline     •  Includes  Pending  Plans   – accepted  =  NO  and  last_verified  is  NULL   •  Includes  Rejected  Plans   – accepted  =  NO  and  last_verified  is  not  NULL   •  Includes  Disabled  Plans   Enkitec  (c)  2014   17  
  • 18. Methods  to  Create  a  Plan  Baseline   1.  Capture   2.  Load   a.  Cursor  Cache  (CUR)   b.  SQL  Tuning  Set  (STS)   c.  Stored  Outline   3.  MigraPon   Enkitec  (c)  2014   18   1.  Capture   2.  Load   a.  CUR   b.  STS   c.  AWR   d.  SPA   e.  TRC   3.  MigraPon  
  • 19. Capturing  a  SQL  Plan  Baseline  (1)   •  Set  opPmizer_use_sql_plan_baselines  to  TRUE   (default)   •  Set  opPmizer_capture_sql_plan_baselines  to  TRUE   (default  is  FALSE)   – Set  this  parameter  at  SESSION  level   •  Execute  SQL  2  Pmes   •  Set  opPmizer_capture_sql_plan_baselines  to   FALSE   Enkitec  (c)  2014   19  
  • 20. Capturing  a  SQL  Plan  Baseline  (2)   Enkitec  (c)  2014   20  
  • 21. Loading  SQL  Plan  Baseline  from  Cache   •  dbms_spm.load_plans_from_cursor_cache   – Inputs   •  sql_id   •  plan_hash_value  (opt)   – Outputs   •  Number  of  Plans  loaded   Enkitec  (c)  2014   21  
  • 22. 22   DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE  (        sql_id                        IN    VARCHAR2,        plan_hash_value      IN    NUMBER      :=  NULL,        sql_text                    IN    CLOB,        fixed                          IN    VARCHAR2  :=  'NO',        enabled                      IN    VARCHAR2  :=  'YES')    RETURN  PLS_INTEGER;     DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE  (        sql_id                        IN    VARCHAR2,        plan_hash_value      IN    NUMBER      :=  NULL,        sql_handle                IN    VARCHAR2,        fixed                          IN    VARCHAR2  :=  'NO',        enabled                      IN    VARCHAR2  :=  'YES')    RETURN  PLS_INTEGER;     DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE  (        sql_id                        IN    VARCHAR2,        plan_hash_value      IN    NUMBER      :=  NULL,        fixed                          IN    VARCHAR2  :=  'NO',        enabled                      IN    VARCHAR2  :=  'YES')    RETURN  PLS_INTEGER;     DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE  (        attribute_name      IN  VARCHAR2,        attribute_value    IN  VARCHAR2,        fixed                        IN  VARCHAR2  :=  'NO',        enabled                    IN  VARCHAR2  :=  'YES')      RETURN  PLS_INTEGER;   Enkitec  (c)  2014   One  of  possible  attribute  names:   •  'SQL_TEXT'  (like)   •  'PARSING_SCHEMA_NAME'  (equality)   •  'MODULE'  (equality)   •  'ACTION'  (equality)   SQL  text  to  use  in  identifying  the  SQL  plan   baseline  into  which  the  plans  are  loaded.  If  the   SQL  plan  baseline  does  not  exist,  it  is  created.   The  use  of  text  is  crucial  when  the  user  tunes  a   SQL  statement  by  adding  hints  to  its  text  and   then  wants  to  load  the  resulting  plan(s)  into  the   SQL  plan  baseline  of  the  original  SQL  statement.   SQL  handle  to  use  in  identifying  the  SQL  plan   baseline  into  which  the  plans  are  loaded.  The   sql_handle  must  denote  an  existing  SQL  plan   baseline.  The  use  of  handle  is  crucial  when  the   user  tunes  a  SQL  statement  by  adding  hints  to  its   text  and  then  wants  to  load  the  resulting  plan(s)   into  the  SQL  plan  baseline  of  the  original  SQL   statement.   Plan  identifier.  Default  NULL  means  capture  all   plans  present  in  the  cursor  cache  for  the  SQL   statement  identified  by  SQL_ID.  
  • 23. SQL  Plan  Baseline  Loading  OpPons   •  Load  a  Plan  from  a  Hinted  version  of  a  SQL  into   SQL  Baseline  of  Original  SQL   – Use  SQL  Text  if  there  is  no  pre-­‐exisPng  SQL  Baseline   – Use  SQL  Handle  if  SQL  Baseline  already  exists   •  Load  one  or  more  Cursor  Plans  (memory)  for  a  SQL   •  Load  Plans  for  Subset  of  Cursors  based  on  Schema,   SQL  Text  “like”  or  ApplicaPon  (Module  or  AcPon)   Enkitec  (c)  2014   23  
  • 24. Demo  6   •  Load  Plans  for  Query  out  of  Demo  5   – demo5.sql  (1st  Pme)   – load_plans.sql   •  Execute  Demo  5  again  and  review  Plan  History   – demo5.sql  (2nd  Pme)   – list_plans.sql   •  Execute  demo5.sql  2x  (3rd  &  4th)  and  verify  results   Enkitec  (c)  2014   24  
  • 25. Demo  6  Results  (aqer  3rd  demo5.sql)              CHILD    EXECUTIONS  BUFFER_GETS  PLAN_HASH_VALUE  SHAR  SENS  AWRE   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐                      0                      3                9090            3600618656        Y        Y        N                CHILD      BUCKET_ID              COUNT   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐                      0                      0                      0                      0                      1                      1                      0                      2                      2   Note   -­‐-­‐-­‐-­‐-­‐        -­‐  SQL  plan  baseline  SQL_PLAN_652hmt7yxthdwc0e59472  used  for  this  statement     CREATED                    PLAN_NAME                ENA  ACC  REP  FIX   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐  -­‐-­‐-­‐  -­‐-­‐-­‐  -­‐-­‐-­‐   21-­‐JUN-­‐14  02.00.10.000000  PM      SQL_PLAN_652hmt7yxthdw80508062  YES  YES  YES  NO   21-­‐JUN-­‐14  02.00.10.000000  PM      SQL_PLAN_652hmt7yxthdwc0e59472  YES  YES  YES  NO   21-­‐JUN-­‐14  02.00.10.000000  PM      SQL_PLAN_652hmt7yxthdwe00bee24  YES  YES  YES  NO   21-­‐JUN-­‐14  02.00.19.000000  PM      SQL_PLAN_652hmt7yxthdwc82a6b0c  YES  NO    YES  NO   Enkitec  (c)  2014   25  
  • 26. Demo  6  Results  (aqer  4th  demo5.sql)    CHILD              EXECUTIONS  BUFFER_GETS  PLAN_HASH_VALUE  SHAR  SENS  AWRE   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐        0                2            723482      847574763        N    Y        N        1              1                2404    3600618656        Y    Y        Y        2                1                1977      189372815        Y    Y        Y        3                1        568      847574763      Y    Y        Y   Note   -­‐-­‐-­‐-­‐-­‐        -­‐  SQL  plan  baseline  SQL_PLAN_652hmt7yxthdw80508062  used  for  this  statement     CREATED                                                PLAN_NAME                                            ENA  ACC  REP  FIX   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐  -­‐-­‐-­‐  -­‐-­‐-­‐  -­‐-­‐-­‐   28-­‐DEC-­‐13  02.03.43.000000  PM      SQL_PLAN_652hmt7yxthdw501f1424  YES  YES  YES  NO   28-­‐DEC-­‐13  02.03.43.000000  PM      SQL_PLAN_652hmt7yxthdwb6c39290  YES  YES  YES  NO   28-­‐DEC-­‐13  02.03.43.000000  PM      SQL_PLAN_652hmt7yxthdwd624c0cd  YES  YES  YES  NO   28-­‐DEC-­‐13  02.03.50.000000  PM      SQL_PLAN_652hmt7yxthdwc82a6b0c  YES  NO    YES  NO   Enkitec  (c)  2014   26  
  • 27. Demo  7   •  Drop  SQL  Plan  Baseline   – drop_plans.sql   •  Create  SQL  Patch  with  /*+  BIND_AWARE  */  Hint   – sqlpch.sql  for  8u0n7w1jug5dg  connected  as  SYS   •  Load  Plans  for  Query  out  of  Demo  5   – demo5.sql   – load_plans.sql   Enkitec  (c)  2014   27  
  • 28. Demo  7  Results    CHILD              EXECUTIONS  BUFFER_GETS  PLAN_HASH_VALUE  SHAR  SENS  AWRE   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐        0                  1                2191      847574763          N    Y        Y        1                  1                3030    2048551027          Y    Y        Y        2                  1                2404    3600618656          Y    Y        Y        3                  1                1977      189372815          Y    Y        Y        4                  1        568      847574763        Y    Y        Y       CREATED                          PLAN_NAME                      ENA  ACC  REP  FIX   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐  -­‐-­‐-­‐  -­‐-­‐-­‐  -­‐-­‐-­‐   21-­‐JUN-­‐14  02.09.14.000000  PM      SQL_PLAN_652hmt7yxthdw80508062  YES  YES  YES  NO   21-­‐JUN-­‐14  02.09.14.000000  PM      SQL_PLAN_652hmt7yxthdwc0e59472  YES  YES  YES  NO   21-­‐JUN-­‐14  02.09.14.000000  PM      SQL_PLAN_652hmt7yxthdwc82a6b0c  YES  YES  YES  NO   21-­‐JUN-­‐14  02.09.14.000000  PM      SQL_PLAN_652hmt7yxthdwe00bee24  YES  YES  YES  NO     Enkitec  (c)  2014   28  
  • 29. Demo  8   •  Execute  queries  1-­‐5  and  observe  how  number  of   ExecuPons  increases  per  Child  Cursor   – flush.sql   – demo8.sql   – demo8.sql   – demo8.sql   Enkitec  (c)  2014   29  
  • 30. Demo  8  Results    CHILD        EXECUTIONS  BUFFER_GETS  PLAN_HASH_VALUE  SHAR    SENS  AWRE   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐    -­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐        0            1                3030            2048551027    Y    Y        Y        1                        1                2404            3600618656    Y    Y        Y        2                        1                1977              189372815    Y    Y        Y        3                      1          568              847574763    N    Y        Y        4                        1              724              847574763    Y    Y        Y   Note   -­‐-­‐-­‐-­‐-­‐        -­‐  SQL  patch  "sqlpch_8u0n7w1jug5dg"  used  for  this  statement        -­‐  SQL  plan  baseline  SQL_PLAN_652hmt7yxthdwb6c39290  used  for  this  statement        CHILD    EXECUTIONS  BUFFER_GETS  PLAN_HASH_VALUE  SHAR      SENS  AWRE   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐      -­‐-­‐-­‐-­‐  -­‐-­‐-­‐-­‐        0              2                6060      2048551027    Y    Y        Y        1              2                4808      3600618656    Y    Y        Y        2              2                3954        189372815    Y    Y        Y        3              1            568        847574763    N    Y        Y        4              3                2016        847574763    Y    Y        Y   Enkitec  (c)  2014   30  
  • 31. Evolving  a  Plan  (1)   •  Evolving  a  Plan  means  “accepPng”  it   – PromoPng  it  from  Plan  History  into  SQL  Plan  Baseline   •  dbms_spm.evolve_sql_plan_baseline   – sql_handle  (opt)   – plan_name  (opt)   – verify  (default  YES)   – commit  (default  YES)   Enkitec  (c)  2014   31  
  • 32. Enkitec  (c)  2014   32   DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE  (        sql_handle      IN  VARCHAR2  :=  NULL,        plan_name        IN  VARCHAR2  :=  NULL,        time_limit      IN  INTEGER    :=  DBMS_SPM.AUTO_LIMIT,        verify              IN  VARCHAR2  :=  'YES',        commit              IN  VARCHAR2  :=  'YES')      RETURN  CLOB;     DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE  (        plan_list        IN  DBMS_SPM.NAME_LIST,        time_limit      IN  INTEGER    :=  DBMS_SPM.AUTO_LIMIT,        verify              IN  VARCHAR2  :=  'YES',        commit              IN  VARCHAR2  :=  'YES')      RETURN  CLOB;   Evolving  a  Plan  (2)  
  • 33. Demo  9   •  Drop  SQL  Plan  Baseline   – drop_plans.sql   •  Capture  SQL  Plan  Baseline  with  1  accepted  Plan   – demo9.sql   – list_plans.sql   •  Evolve  all  Plans  on  Plan  History   – evolve.sql   Enkitec  (c)  2014   33  
  • 34. FIXED  Flag   •  When  set  to  YES   – Only  FIXED  Plans  are  considered  for  Plan  SelecPon   – No  more  Plans  are  Captured  into  Plan  History   Enkitec  (c)  2014   34  
  • 35. Alter  SQL  Plan  Baselines   Enkitec  (c)  2014   35   DBMS_SPM.ALTER_SQL_PLAN_BASELINE  (        sql_handle                IN  VARCHAR2  :=  NULL,        plan_name                  IN  VARCHAR2  :=  NULL,        attribute_name        IN  VARCHAR2,        attribute_value      IN  VARCHAR2)    RETURN  PLS_INTEGER;   Attribute  Names  &  Values:   enabled      'YES'  or  'NO'   fixed        'YES'  or  'NO'   autopurge      'YES'  or  'NO'   plan_name      String  of  up  to  30-­‐characters   description    String  of  up  to  500-­‐characters  
  • 36. Plan  SelecPon  (1)   •  At  hard  parse  when  SQL  Plan  Baseline  (SPB)  exists   1.  CBO  computes  an  “OpPmal”  Plan  (OP)   •  AdapPve  Cursor  Sharing  is  used  if  applicable   2.  If  OP  exists  in  SPB  then  execute  this  OP   3.  If  OP  does  not  exist  in  SPB  then  store  it  in  Plan  History   a.  If  there  are  FIXED  Plans  in  SPB   i.  Re-­‐cost  all  FIXED  Plans  using  Binds  and  execute  cheapest   b.  If  there  are  no  FIXED  Plans  in  SPM   i.  Re-­‐cost  all  Plans  using  Binds  and  execute  cheapest   Enkitec  (c)  2014   36  
  • 37. Plan  SelecPon  (2)   Enkitec  (c)  2014   37  
  • 38. Demo  10   •  FIX  one  Plan  from  SQL  Plan  Baseline   – alter_plans.sql   •  Verify  only  one  Plan  was  Executed   – flush.sql   – demo8.sql   – demo8.sql   Enkitec  (c)  2014   38  
  • 39. SPM  Summary   Enkitec  (c)  2014   39   •  SPM  provides  much  desired  Plan  Stability   – Only  “approved”  Plans  are  allowed  to  Execute   •  ACS  can  generate  a  healthy  stock  of  OpPmal  Plans   – You  can  restrict  them  to  work  under  SPM   •  Combining  ACS  and  SPM  you  can  obtain   – Plan  Flexibility  and  Plan  Stability  
  • 40. ACS  Suggested  Strategy   •  Use  sys.dbms_sqldiag_internal.i_create_patch  to   SQL  Patch  with  BIND_AWARE  the  SQL  on  Baselines     •  Use  free  script  sqlpch.sql   Enkitec  (c)  2014   40  
  • 41. SPM  Suggested  Strategies   1.  ConservaPve   – One  SQL  at  a  Pme   2.  Moderate   – One  ApplicaPon  at  a  Pme  (Module  or  AcPon)   – One  Schema  at  a  Pme   3.  Aggressive  (a.k.a.  Cowboy  method)   – All  ApplicaPon  Schemas  at  once   Enkitec  (c)  2014   41  
  • 42. Oracle  Pack  Licenses   •  DBMS_SPM   – No  Oracle  Pack  License   •  DBMS_SQLTUNE   – Oracle  Tuning  Pack   •  AWR   – Oracle  DiagnosPcs  Pack   Enkitec  (c)  2014   42  
  • 43. References  (1)   •  Random  Slowdown  by  Jonathan  Lewis   – hvp://jonathanlewis.wordpress.com/2013/12/23/ plan-­‐changes/   •  SQL  Plan  Management  SPM  Aware  OpPmizer   – hvps://blogs.oracle.com/opPmizer/entry/ sql_plan_management_part_2_of_4_spm_aware_opP mizer   Enkitec  (c)  2014   43  
  • 44. References  (2)   •  Oracle®  Database  PL/SQL  Packages  and  Types   Reference   – 11g  Release  2  (11.2)   – Part  Number  E25788-­‐04   Enkitec  (c)  2014   44  
  • 45. Contact  InformaPon   •  carlos.sierra@enkitec.com   •  carlos-­‐sierra.net   •  @csierra_usa   Enkitec  (c)  2014   45