MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:[email protected]! Page!4!! 1...

19
File Name: MariaDB_10_final.docx w: www.mariadb.com e: [email protected] Page 1 What’s New in MariaDB 10? Author: Maria Luisa Raviol Last update: 06.10.2014

Transcript of MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:[email protected]! Page!4!! 1...

Page 1: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  1    

   What’s  New  in  MariaDB  10?  

Author:  Maria  Luisa  Raviol  Last  update:  06.10.2014        

Page 2: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  2    

 

1   What’s  New  in  MariaDB  10  ..........................................................................................................  4  1.1   What  is  MariaDB  10?  ....................................................................................................................................................................  4  1.2   MariaDB  10’s  Inheritance  ..........................................................................................................................................................  4  1.3   MySQL  5.6  Backported  and  Reimplemented  Features  ..................................................................................................  5  1.4   MariaDB  10  Only  Features  ........................................................................................................................................................  5  1.5   MariaDB  10  Additions  .................................................................................................................................................................  5  1.6   References  ........................................................................................................................................................................................  5  

2   MariaDB  10  Optimizer  Features  ...................................................................................................  6  2.1   The  Query  Optimizer  ...................................................................................................................................................................  6  2.1.1   EXPLAIN  Statement  Enhanced  .............................................................................................................................................  6  2.1.2   EXPLAIN  FORMAT=JSON  .........................................................................................................................................................  6  2.1.3   ANALYZE  Statement  ..................................................................................................................................................................  6  2.1.4   Engine  independent  statistics  ................................................................................................................................................  6  

2.2   Subquery  Optimization  ...............................................................................................................................................................  7  2.3   Index  Condition  Pushdown  (ICP)  Optimization  ...............................................................................................................  7  2.4   Feature  Comparison  Table  ........................................................................................................................................................  8  2.5   References  ........................................................................................................................................................................................  9  

3   Administration  and  user  features  ...............................................................................................  10  3.1   Progress  Reporting  ....................................................................................................................................................................  10  3.2   SHOW  EXPLAIN  ...........................................................................................................................................................................  10  3.3   SHOW  PLUGIN  SONAME  ..........................................................................................................................................................  10  3.4   SHUTDOWN  ..................................................................................................................................................................................  10  3.5   KILL  QUERY  ID  ............................................................................................................................................................................  11  3.6   Per-­‐connection  memory  usage  .............................................................................................................................................  11  3.7   Roles  .................................................................................................................................................................................................  11  3.8   References  .....................................................................................................................................................................................  11  

4   MariaDB  10  Storage  Engines  ......................................................................................................  12  4.1   CONNECT  Storage  Engine  .......................................................................................................................................................  12  4.1.1   CONNECT  Engine  –  Advantages  ........................................................................................................................................  12  4.1.2   CONNECT  Table  Options  .......................................................................................................................................................  13  4.1.3   CONNECT  Engine  –  Features  ..............................................................................................................................................  13  

4.2   TokuDB  Storage  Engine  ...........................................................................................................................................................  13  4.2.1   Note:  ..............................................................................................................................................................................................  14  

4.3   The  Spider  Storage  Engine  .....................................................................................................................................................  14  4.3.1   Current  Limitations  ................................................................................................................................................................  14  

4.4   The  Cassandra  Storage  Engine  .............................................................................................................................................  14  4.5   References  .....................................................................................................................................................................................  15  

5   MariaDB  10  Replication  Features  ...............................................................................................  16  5.1   MariaDB  GTID  ..............................................................................................................................................................................  16  5.2   Group  Commit  ..............................................................................................................................................................................  16  5.3   Multi—Source  Replication  .....................................................................................................................................................  17  5.4   Parallel  Slave  ................................................................................................................................................................................  17  5.5   Crash  Safe  Slave  ...........................................................................................................................................................................  18  5.6   References  .....................................................................................................................................................................................  18          

Page 3: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  3    

6   MariaDB  Audit  Plugin  .................................................................................................................  18  6.1   Logging  ............................................................................................................................................................................................  18  6.2   References  .....................................................................................................................................................................................  19  

7   Further  readings  .........................................................................................................................  19  7.1   MariaDB  10  and  MySQL  5.6  ...................................................................................................................................................  19      

Page 4: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  4    

1 What’s  New  in  MariaDB  10  MariaDB  10  was  released  on  March  31st  2014  

1.1 What  is  MariaDB  10?  MariaDB  10  is  technically  a  fork  of  MariaDB  5.5  with  a  set  of  extra  features  that  have  been  added  to  fulfill  MariaDB  users’  requests.      MariaDB  10  is  backward  compatible  with  MariaDB  for  everything  that’s  related  to  file  formats,  replication  and  configuration  files  but  nevertheless  it  is  application  and  data  files  compatible  with  MySQL  5.6  as  well.    MariaDB  10  is  100%  GPL  and  thousands  of  lines  of  code  come  from  community  contributors.    

1.2 MariaDB  10’s  Inheritance  MariaDB  10  inherits  all  the  features  already  included  in  MariaDB  5.5  but  to  better  understand  the  complete  inheritance  here’s  a  short  summary  of  the  main  features  of  each  version  of  MariaDB  since  version  5.1  

• MariaDB  5.1  (based  on  MySQL  5.1)  o Table  elimination  o new  storage  engines  o cleanup  o better  tests  o pool  of  threads  

 • MariaDB  5.2  (based  on  MariaDB  5.1)  

o Virtual  columns  o extended  user  statistics  o segmented  MyISAM  keycache  

 • MariaDB  5.3  (based  on  MariaDB  5.2)  

o Biggest  changes  to  optimizer  (faster  subqueries,  joins,  etc.)  o Microsecond  precision  o faster  HANDLER  (HANDLER  RED  50%  faster  w/530,000  qps)  o dynamic  columns  o Better  replication  (group  commit,  etc.)  o HandlerSocket  

 • MariaDB  5.5  (based  on  MariaDB  5.3  +  MySQL  5.5)  

o Opensource,  more  efficient  threadpool  o Non-­‐blocking  client  library  o New  LIMIT  ROWS  EXAMINED  option  o Extended  keys  for  XtraDB/InnoDB  o New  SphinxSE  o Dynamic  replication  settings  

Page 5: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  5    

o Lots  of  security  fixes,  new  status  variables,  etc.  

1.3 MySQL  5.6  Backported  and  Reimplemented  Features  o InnoDB/XtraDB  (5.6.5)  

o Optimised  read  only  transaction,  with  support  for  TRANSACTION  READ  ONLY  o PERFORMANCE_SCHEMA  (5.6.5)  o Online  ALTER  TABLE    o Privileges  on  temporary  tables  

o -­‐-­‐plugin-­‐load-­‐add  o GET  DIAGNOSTIC  statement  o Character  set  extensions  o Temporal  literals  o Filesort  optimisation  for  ORDER  BY...LIMIT  (shows  only  few  rows  of  a  resultset)  o Reimplemented:  

o Errormessages(w/system  error  string)    o CURRENT_TIMESTAMP  as  DEFAULT  for  DATETIMEcolumns    o GlobalTransactionID  o Parallel  replication  o EXISTS-­‐TO-­‐IN  optimisation  

1.4 MariaDB  10  Only  Features  On  top  of  all  the  features  already  listed,  MariaDB  10  has  a  set  of  features  that  are  unique:  

o SHOW  EXPLAIN  for  <thread_id>  o Faster  ALTER  TABLE  with  unique  keys  for  Aria  &  MyISAM  o Per-­‐thread  memory  usage  

o INFORMATION_SCHEMA.PROCESSLIST  with  MEMORY_USAGE  &  EXAMINED_ROWS  now    o SHOW  STATUS  with  memory  usage  

 

1.5 MariaDB  10  Additions  Some  specific  additions  are  part  of  the  new  MariaDB  10  offering  and  these  are  mainly:  

o MariaDB  Galera  Cluster  o Connectors  and  Drivers  

o MariaDB  C  Client  Library  o MariaDB  JDBC  Driver  

o MariaDB  Audit  Plugin  

1.6 References    https://mariadb.com/kb/en/mariadb/mariadb-­‐vs-­‐mysql-­‐features/    http://dev.mysql.com/doc/refman/5.6/en/server-­‐options.html#option_mysqld_plugin-­‐load-­‐add      

Page 6: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  6    

 

2 MariaDB  10  Optimizer  Features  

2.1 The  Query  Optimizer  

2.1.1 EXPLAIN  Statement  Enhanced  The  Query  Optimizer  translates  in  action  an  SQL  query.  It  does  it  through  a  query  execution  plan  -­‐  whilst  a  SQL  statement  specifies  what  needs  to  be  done  a  query  plan  specifies  how  to  do  it  and  hence  how  to  get  the  data  out  of  the  database  according  to  the  SQL  query.  These  plans  can  be  checked  and  analyzed  through  the  EXPLAIN  statement.      Since  MariaDB  10.0.5  it  has  been  possible  to  have  EXPLAIN  output  printed  in  the  slow  query  log.  This  behavior  can  be  switched  on  by  specifying  the  "explain"  keyword  in  the  log_slow_verbosity  system  variable.  Moreover  EXPLAIN  for  UPDATE/DELETE  shows  the  query  plan  for  UPDATE  and  DELETE  statements.  

2.1.2 EXPLAIN  FORMAT=JSON  This  statement  produces  JSON  output  (WHERE  and  attached  conditions)  to  the  query  plan.  It  shows  whether  “Using  temporary;  using  filesort”  is  done  to  handle  GROUP  BY  or  ORDER  BY.  

2.1.3  ANALYZE  Statement  ANALYZE  statement  is  a  new  feature  of  MariaDB  10.1.0. It  is  similar  to  EXPLAIN  statement.  ANALYZE  statement  will  invoke  the  optimizer,  execute  the  statement,  and  then  produce  EXPLAIN  output  instead  of  the  result  set.  This  lets  one  check  how  close  the  optimizer's  estimates  about  the  query  plan  are  to  the  reality.  

2.1.4 Engine  independent  statistics  Optimizer  statistics  describes  more  details  about  the  database  and  the  objects  in  the  database.    Before  MariaDB  10,  the  storage  engines  supplied  statistics  and  the  quality  of  the  statistics  was  really  not  high,  mainly  because  these  results  came  from  the  storage  engine  interface  with  all  the  restrictions  related  to  that.  As  these  statistics  are  used  by  the  query  optimizer  in  order  to  define  which  is  the  best  execution  plan  for  each  SQL  statement  the  more  accurate  the  statistics  results  the  better  are  the  execution  plans  and  the  retrieval  of  the  requested  data  from  the  database  is  faster    MariaDB  10  provides  now  more  statistics  collected  and  used  at  the  SQL  layer,  not  at  storage  engine  layer:  

o Index  statistics  o Table  statistics  o Column  statistics  

o MIN/MAX  values  o NULL/NON  NULL  values  o Histograms  

 

Page 7: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  7    

2.2 Subquery  Optimization  Subqueries  have  been  significantly  improved  in  the  previous  versions  of  MariaDB.  In  fact  MariaDB  5.3  introduced  improvements  that  could  give  a  substantial  performance  benefit  for  application  that  used  subqueries.  Later,  MariaDB  5.5  introduced  even  more  improvements.    MariaDB  10  has  added  further  extra  features  for  subqueries,  such  as  the  EXIST-­‐to-­‐IN  optimization.  Although  MySQL  5.6  has  covers  part  of  the  gap  that  existed  between  the  MySQL  and  the  MariaDB  optimizers,  as  of  today,  features  like  subquery  caching  and  fast  EXPLAIN  are  still  unique  to  MariaDB.  Subqueries  were  generally  unusable  before  MariaDB  5.3  and  5.5  and  MySQL  5.6.  MariaDB  10  has  additions  including  IN  (SELECT  ...)  FROM  (SELECT  ...)  and  other  cases.  

2.3 Index  Condition  Pushdown  (ICP)  Optimization  Starting  in  MariaDB  5.3.3,  Index  Condition  Pushdown  is  on  by  default.  Index  Condition  Pushdown  is  an  optimization  that  is  applied  for  access  methods  that  access  table  data  through  indexes.    The  idea  is  to  check  part  of  the  WHERE  condition  that  refers  to  index  fields  as  soon  as  the  index  is  accessed.  If  the  Pushed  Index  Condition  is  not  satisfied,  there  is  no  need  to  read  the  whole  table  record.  The  idea  behind  the  ICP  is  to  try  to  cut  down  the  number  of  full  record  reads  by  checking  whether  index  records  satisfy  part  of  the  WHERE  condition  that  can  be  checked  for  them.  How  much  speed  will  be  gained  depends  on  how  many  records  will  be  filtered  out  and  how  expensive  it  was  to  read  them.    To  summarize  

• Without  ICP:  o Read  index  o Read  record  o Check  the  WHERE  condition  

• With  ICP:  o Read  index  o Check  the  WHERE  condition  on  index  o Read  record  o Check  the  WHERE  condition  

 

Page 8: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  8    

2.4 Feature  Comparison  Table  

 

   

Page 9: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  9    

     

2.5 References    https://kb.askmonty.org/en/subquery-­‐optimizations/    https://mariadb.com/kb/en/query-­‐optimizations/    https://mariadb.com/kb/en/mariadb/mariadb-­‐documentation/optimization-­‐and-­‐tuning/query-­‐optimizations/index-­‐condition-­‐pushdown/      

Page 10: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  10    

3 Administration  and  user  features  In  MariaDB  10  a  set  of  new  and  improved  commands  are  available  for  the  users.  

3.1 Progress  Reporting  MariaDB  5.3  and  later  supports  progress  reporting  for  some  long  running  commands.    INFORMATION_SCHEMA.PROCESSLIST  has  three  new  columns  for  progress  reporting:  STAGE,  MAX_STAGE,  and  PROGRESS    The  new  column  named  PROGRESS  in  SHOW  PROCESSLIST  shows  the  total  progress  (0-­‐100  %)  of  the  commands  that’s  is  executing.    The  client  receives  progress  messages  that  can  be  used  by  the  user  to  indicate  how  long  the  command  will  take  to  complete.    It  is  valid  for:  

o ALTER  TABLE,  ADD/DROP  INDEX,  LOAD  DATA  INFILE  o CHECK/REPAIR/ANALYZE/OPTIMIZE  TABLE  

3.2 SHOW  EXPLAIN  SHOW  EXPLAIN  command  is  a  new  feature  of  MariaDB  10,  it  allows  to  get  an  EXPLAIN  (that  is,  a  printout  of  a  query  plan)  of  a  query  running  in  a  certain  thread:  in  practice  it  examines  a  running  SELECT.    

3.3 SHOW  PLUGIN  SONAME  SHOW  PLUGIN  SONAME  displays  information  about  compiled-­‐in  and  all  server  plugins  in  the  @@plugin_dir  directory,  including  not  installed  ones.  

 

3.4 SHUTDOWN  SHUTDOWN  is  a  SQL  statement  to  shut  the  server  down.  It  is  pretty  much  the  same  as  mysqladmin  shutdown.  It  requires  SHUTDOWN  privilege.      

Page 11: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  11    

 

3.5 KILL  QUERY  ID  It  has  been  introduced  in  MariaDB  10.0.5.  This  command  terminates  the  query  by  query_id,  leaving  the  connection  intact.  It  uses  the  query  id  instead  of  the  thread  id.    

3.6 Per-­‐connection  memory  usage  Monitor  memory  usage  per  connection:  

 

3.7 Roles  Roles  were  introduced  in  MariaDB  10.0.5.  A  role  bundles  a  number  of  privileges  together.  It  assists  larger  organizations  where,  typically,  a  number  of  users  would  have  the  same  privileges,  and,  previously,  the  only  way  to  change  the  privileges  for  a  group  of  users  was  by  changing  each  user's  privileges  individually.    On  the  other  side  multiple  external  users  could  have  been  assigned  the  same  user,  and  there  would  have  been  no  way  to  see  which  actual  user  was  responsible  for  which  action.    With  roles,  managing  this  is  easy.  For  example,  there  could  be  a  number  of  users  assigned  to  a  same  role,  with  identical  privileges.  Changing  the  privileges  for  all  the  individuals  with  the  same  role  is  a  matter  of  simply  changing  the  role's  privileges.    

3.8 References  https://mariadb.com/kb/en/mariadb/development/mariadb-­‐internals-­‐documentation/using-­‐mariadb-­‐with-­‐your-­‐programs-­‐api/progress-­‐reporting/    https://mariadb.com/kb/en/mariadb/mariadb-­‐documentation/user-­‐account-­‐management/roles/roles-­‐overview/  

Page 12: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  12    

4 MariaDB  10  Storage  Engines  

4.1 CONNECT  Storage  Engine  CONNECT  is  a  storage  engine  that  enables  MariaDB  10  to  use  external  data  as  they  were  standard  tables  in  the  server.  Note  that  data  is  not  loaded  into  MariaDB.    The  CONNECT  engine  has  been  mainly  developed  by  Olivier  Bertrand,  an  ex  IBM  database  researcher,  with  the  intent  to  have  a  more  versatile  way  to  access  external  data  sources  in  various  formats  Today  CONNECT  is  a  standard  engine  in  MariaDB  10.      The  CONNECT  engine  integrates/access  data  directly  in  many  non-­‐MariaDB  formats.  It  simplifies  the  ETL  procedures  in  Business  Intelligence  and  Business  Analytics,  it  simplifies  the  export/import  of  data  from/to  MariaDB,  to/from  other  data  sources.    There  are  strong  similarities  with  the  CSV  engine  and  some  similarities  with  FederatedX  and  Merge  but  the  CSV  engine  does  not  allow  indexing  and  block  reading  whilst  the  FederateX  engine  imposes  several  restrictions  and  performance  limitations.    

4.1.1 CONNECT  Engine  –  Advantages  1. No  need  for  additional  SQL  language  extensions.    2. Embedded  wrappers  for  many  external  data  types  (files,  data  sources,  virtual).    3. Read/Write  access  to  external  files  and  most  data  sources.    4. Only  used  columns  are  retrieved  from  external  scan.    5. Push-­‐down  WHERE  clauses  when  appropriate.    6. Support  indexing,  special  and  virtual  columns.    7. Parallel  execution  of  partition  tables.    8. Can  execute  complex  queries  on  remote  servers.    9. Provides  an  API  that  allows  writing  additional  FDW  in  C++.    

 With  CONNECT,  MariaDB  has  one  of  the  most  advanced  implementations  of  MED  (Management  of  External  Data) enabling  the  handling  of  data  not  stored  in  a  DBMS  database  as  if  it  were  stored  in  tables  and  without  the  need  of  complex  additions  to  the  SQL  syntax  (foreign  tables  are  "normal"  tables  using  the  CONNECT  engine).    

Page 13: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  13    

4.1.2 CONNECT  Table  Options  

   

 

4.1.3 CONNECT  Engine  –  Features  This  storage  engine  supports  MariaDB  virtual  columns  and  also  permits  defining  special  columns  such  as  ROWID,  FILEID,  and  SERVID.    

4.2 TokuDB  Storage  Engine  From  MariaDB  5.5.34  and  MariaDB  10.0.6,  the  TokuDB  storage  engine  is  included  in  the  MariaDB-­‐server  package.  It  is  enough  to  install  MariaDB  and  then  enable  the  TokuDB. The  TokuDB  storage  engine  is  for  use  in  high-­‐performance  and  write-­‐intensive  environments,  offering  increased  compression  and  better  performance.  It  allows  fast  inserts/increased  performance,  increased  Compression,  online  administration,  it  does  not  require  index  rebuild.  

Type Descrip*on

DOS

The$table$is$contained$in$one$or$several$files.$The$file$format$can$be$refined$by$some$other$op7ons$of$the$command$or$more$o8en$using$a$specific$type$as$many$of$those$described$below.$Otherwise,$it$is$a$flat$text$file$where$columns$are$placed$at$a$fixed$offset$within$each$record,$the$last$column$being$of$variable$length.

FIX Text$file$arranged$like$DOS$but$with$fixed$length$records.

BIN Binary$file$with$numeric$values$in$plaEorm$representa7on,$also$with$columns$at$fixed$offset$within$records.

VEC Binary$file$organized$in$vectors,$in$which$column$values$are$grouped$consecu7vely,$either$split$in$separate$files$or$in$a$unique$file.

DBF* File$having$the$dBASE$format.

CSV*"Comma$Separated$Values"$file$in$which$each$variable$length$record$contains$column$values$separated$by$a$specific$character$(defaul7ng$to$the$comma)

FMTFile$in$which$each$record$contains$the$column$values$in$a$nonQstandard$format$(the$same$for$each$record)$This$format$is$specified$in$the$column$defini7on.

INI File$having$the$format$of$the$ini7aliza7on$or$configura7on$files$used$by$many$applica7ons.

Type Descrip*on

XML File$having$the$XML$or$HTML$format

ODBC* Table$extracted$from$an$applica7on$accessible$via$ODBC$or$unixODBC.$For$example$from$another$DBMS$or$from$an$Excel$spreadsheet.

MYSQL* Table$accessed$using$the$MySQL$API$like$the$FEDERATED$engine.

PROXY* A$table$based$on$another$table$exis7ng$on$the$current$server.

TBL* Accessing$a$collec7on$of$tables$as$one$table$(like$the$MERGE$engine$does$for$MyIsam$tables)

XCOL* A$table$based$on$another$table$exis7ng$on$the$current$server$with$one$of$its$column$containing$of$comma$separated$values.

OCCURA$table$based$on$another$table$exis7ng$on$the$current$server,$several$columns$of$the$object$table$containing$values$that$can$be$grouped$in$only$one$column.

DIR Virtual$table$that$returns$a$file$list$like$the$Unix$ls$or$DOS$dir$command.

WMI*Windows$Management$Instrumenta7on$table$displaying$informa7on$coming$from$a$WMI$provider.$This$type$enables$to$get$in$tabular$format$all$sort$of$informa7on$about$the$machine$hardware$and$opera7ng$system$(Windows$only).

MAC Virtual$table$returning$informa7on$about$the$machine$and$network$cards$(Windows$only).

OEM Table$of$any$other$formats$not$directly$handled$by$CONNECT$but$whose$access$is$implemented$by$an$external$plugin$module$(DLL$or$Shared$Library).

Type Descrip*on

TABLE_TYPE

The$type$of$the$external$table:$DOS,$FIX,$BIN,$CSV,$FMT,$XML,$INI,$DBF,$VEC,$ODBC,$MYSQL,$TBL,$DIR,$WMI,$MAC$and$EOM.$Defaults$to$DOS.

FILE_NAMEThe/file/(path)/name/for/all/table/types/based/on/files./Can/be/absolute/or/

relaCve/to/the/current/data/directory.

XFILE_NAMEThe/file/(path)/base/name/for/a/table/index/files./Can/be/absolute/or/relaCve/to/

the/data/directory./Defaults/to/the/file/name.

TABNAME The/target/table/or/node/for/ODBC,/MYSQL,/XML/or/catalog/tables.

TABLE_LIST The/comma/separated/list/of/a/TBL/table/subOtables.

DBNAME The/target/database/for/ODBC,/MYSQL/or/catalog/tables.

DATA_CHARSET The$character$set$used$in$the$external$file$or$data$source.

SEP_CHAR Specifies$the$field$separator$character$of$a$CSV$tables.

QCHARSpecifies/the/character/used/for/quoCng/some/fields/of/a/CSV/table/or/

the/idenCfiers/of/an/ODBC/tables.

MODULEThe/(path)/name/of/the/DLL/or/shared/lib/implemenCng/the/access/of/

a/nonOstandard/(OEM)/table/type.

SUBTYPE The/subtype/of/an/OEM/table/type.

CATFUNC The/catalog/funcCon/used/by/a/catalog/table.

Type Descrip*on

OPTION_LIST Used/to/specify/all/other/opCons/not/yet/directly/defined.

MAPPED Specifies/whether/“file/mapping”/is/used/to/handle/the/table/file.

HUGE To/specify/that/a/table/file/can/be/larger/than/2GB.

COMPRESS True/if/the/data/file/is/compressed./Defaults/to/NO.

SPLIT True/for/a/VEC/table/when/each/columns/are/in/separate/files.

READONLY True/if/the/data/file/must/not/be/modified/or/erased.

SEPINDEX When/true,/indexes/are/saved/in/separate/files.

LRECL The/file/record/size/(o\en/calculated/by/default).

BLOCK_SIZEThe/number/of/rows/each/block/of/FIX,/BIN,/DBF/OR/VEC/tables/contains./

For/an/ODBC/table/this/is/the/RowSet/size/opCon.

MULTIPLE Used/to/specify/mulCple/file/tables.

HEADERApplies/to/CSV,/VEC/and/HTML/files./Its/meaning/depends/on/the/table/

type.

QUOTED The/level/of/quoCng/used/in/CSV/table/files.

ENDING End/of/line/length./Default/to/1/for/Unix/Linux/and/2/for/Windows.

Page 14: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  14    

4.2.1 Note:    The  TokuDB  version  that  comes  from  MariaDB.org  differs  slightly  from  the  TokuDB  version  from  Tokutek.    

4.3 The  Spider  Storage  Engine  Spider  is  a  storage  engine  developed  by  Kentoku  Shiba,  available  on  Launchpad,  first  introduced  in  2008  and  now  available  in  MariaDB  10.  It  is  based  on  the  MySQL  partitioning  features,  with  built-­‐in  sharding  capabilities    Tables  of  different  MariaDB  instances  are  handled  as  if  they  are  on  the  same  instance.  It  supports  XA  transactions  and  multiple  storage  engines  (InnoDB,  MyISAM  etc.).    Spider  expands  local  partitioning  linking  each  partition  to  remote  MariaDB  tables.  The  links  are  stored  into  Spider  systems  tables  (created  during  the  installation).  XA  Transactions  guarantee  the  atomicity  within  the  cluster.  

 

4.3.1 Current  Limitations  The  Query  cache  must  be  disabled.  The  efficiency  is  expected  in  the  same  way  partition  pruning  is  effective  on  partitioning.  If  partition  pruning  is  not  effective,  Spider  will  access  all  the  remote  servers,  with  significant  overhead.  Data  can  be  also  partitioned  in  each  shard.  Even  if  it  has  already  used  in  production  it  is  still  experimental.  

4.4 The  Cassandra  Storage  Engine  Cassandra  is  a  storage  engine  that  makes  the  Cassandra  column  family  appear  as  a  table  in  MariaDB  The  engine  acts  as  a  “window”  from  MariaDB  to  look  into  Cassandra.    

ServerA

ServerBServerC

ServerD

Table&ColorsTable&ColorsTable&ColorsPar,,on&1 color&=&‘red’ ServerAPar,,on&2 color&=&‘black’ ServerBPar,,on&3 color&=‘white’ ServerCPar,,on&4 color&=&‘yellow’ ServerD

Page 15: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  15    

Possible  operations  are:INSERT,  UPDATE,  SELECT.  It  is  possible  to  execute  joins  between  Cassandra  tables  and  other  storage  engines.  

 

4.5 References    https://mariadb.com/kb/en/mariadb/mariadb-­‐documentation/mariadb-­‐storage-­‐engines/connect/    https://mariadb.com/kb/en/tokudb-­‐differences/    https://mariadb.com/kb/en/mariadb/mariadb-­‐documentation/mariadb-­‐storage-­‐engines/spider/    https://mariadb.com/kb/en/mariadb/mariadb-­‐documentation/mariadb-­‐storage-­‐engines/storage-­‐engines-­‐cassandra-­‐storage-­‐engine/cassandra-­‐storage-­‐engine-­‐overview/    

Page 16: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  16    

5 MariaDB  10  Replication  Features  MariaDB  10  introduces  a  new  set  of  replication  features.  GTID  allows  safe  failover  or  switchover  as  GTIDs  are  unique  and  replication  can  be  safely  resumed  when  a  master  changes  from  one  node  to  another.  The  new  replication  features  allow  more  sophisticated  topologies.  

5.1  MariaDB  GTID  Since  version  10.0.2,  MariaDB  supports  Global  Transaction  IDs  for  replication  and  this  is  automatically  enabled.  A  Global  Transaction  ID,  or  GTID,  consists  of  three  numbers  separated  with  dashes  '-­‐':  the  first  number  0  is  the  domain  ID,  which  is  specific  for  global  transaction  ID,  the  second  number  is  the  server  ID  (the  same  used  in  old-­‐style  replication),  the  third  number  is  the  sequence  number.    The  Global  Transaction  ID  introduces  a  new  event  attached  to  each  event  group  in  the  binlog  (an  event  group  is  a  collection  of  events  that  are  always  applied  as  a  unit):  as  an  event  group  is  replicated  from  master  server  to  slave  server,  the  global  transaction  ID  is  preserved.      Since  the  ID  is  globally  unique  across  the  entire  group  of  servers,  this  makes  it  easy  to  uniquely  identify  the  same  binlog  events  on  different  servers  that  replicate  each  other  (this  was  not  easily  possible  before  MariaDB  10.0.2).  

 

5.2 Group  Commit  Group  commit  for  the  binary  log  was  first  introduced  in  MariaDB  5.3:  it  is  an  important  optimisation  when  the  server  is  run  with  sync_binlog=1.  These  settings  are  needed  to  ensure  that,  if  a  server  crashes,  any  transaction  that  was  reported  as  committed  prior  to  the  time  of  crash  will  still  be  present  in  the  database  after  crash  recovery.      The  idea  with  Group  Commit  is  to  amortize  the  costs  of  each  fsync()  over  multiple  commits  from  multiple  parallel  transactions.  If  there  are  10  transactions  in  parallel  trying  to  commit,  we  can  force  all  of  them  to  disk  at  once  with  a  single  fsync(),  rather  than  do  one  fsync()  for  each.  This  can  greatly  

#131109 14:59:59 server id 1 end_log_pos 4151 GTID XXX-YYY-ZZZ/*!100001 SET @@session.gtid_seq_no=ZZZ*//*!*/;

Sequence'Number64bit'unsigned

It'increases'monotonically'at'each'commitIt'is'applied'for'each'Event'Group,'i.e.,'for'each'BEGIN/COMMIT'

or'for'groups'that'have'no'BEGIN/COMMIT(for'example'DDL'commands,'TRUNCATE'and'others)

Server'ID32bit'unsigned

The'server_id'value'for'the'MariaDB'instance

Domain'ID32bit'unsigned

The'domain_id'value'for'the'Replication'stream

Page 17: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  17    

reduce  the  need  for  fsync()  calls,  and  consequently  greatly  improve  the  commits-­‐per-­‐second  throughput.  Group  commit  works  automatically:  there  are  no  options  needed  to  enable  it.  

 

 

5.3 Multi—Source  Replication  A  common  replication  topology  is  the  one  where  there  is  a  single  source  server  and  several  slave  servers.  Multi-­‐source  replication  is  a  replication  topology  where  there  are  many  source  servers  replicating  to  a  single  target.  Setting  it  up  is  very  similar  to  setting  up  traditional  replication,  but  with  a  few  key  differences.  With  multi-­‐source  replication  data  partitioned  over  many  masters  can  be  pulled  together  onto  one  slave  for  analytical  queries  or  to  perform  a  complete  backup  on  that  slave.  It  is  compatible  with  the  GTID  and  it  is  possible  to  replicate  up  to  64  masters  on  one  slave.  

5.4 Parallel  Slave  Google  sponsored  this  new  feature  of  MariaDB  10.    Transactions  are  applied  in  parallel  if  they  have  been  executed  in  parallel  on  the  master.  Independent  transactions  are  automatically  detected.  It  works  beyond  the  boundaries  of  MySQL  5.6  parallel  slave.      Parallel  threads  apply  to:  

o queries  that  are  run  on  the  master  in  one  group  commit  o queries  that  are  from  different  domains  o queries  from  different  masters  (when  using  multi-­‐source  replication)  

 Parallel  Slave  adapts  to  master  load  and  preserves  the  commit  order.  

COMMIT&

Page 18: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  18    

5.5 Crash  Safe  Slave  The  new  MariaDB  10    GTIDs  are  saved  in  an  InnoDB  (transactional)  system  table.  This  allows  slaves  to  be  Crash  Safe.  

5.6 References    http://www.skysql.com/blogs/maria-­‐luisaraviol/mariadb-­‐10-­‐gtid-­‐explained    https://mariadb.com/kb/en/mariadb/mariadb-­‐documentation/replication-­‐cluster-­‐multi-­‐master/replication/multi-­‐source-­‐replication/    https://mariadb.com/kb/en/mariadb/mariadb-­‐documentation/replication-­‐cluster-­‐multi-­‐master/replication/parallel-­‐replication/    https://mariadb.com/kb/en/mariadb/mariadb-­‐documentation/log-­‐files/binary-­‐log/group-­‐commit-­‐for-­‐the-­‐binary-­‐log/    

6 MariaDB  Audit  Plugin  The  MariaDB  Audit  Plugin  is  included  by  default  from  versions  5.5.37  and  10.0.10.  The  MariaDB  Audit  Plugin  tracks  user  access  to  server  and  data  and  specifically  it  tracks  all  type  of  access  to  data  in  tables.  It  records  who  connected  to  the  server,  what  queries  ran  and  what  tables  were  touched.  The  data  collected  by  the  plugin  can  be  stored  either  to  the  rotating  log  file  or  sent  to  the  local  syslogd.    It  works  for  MariaDB,  MySQL  and  Percona  Server.    The  activity  of  the  plugin  can  be  monitored  with  the  status  variables.  

6.1 Logging  The  Audit  Plugin  has  been  designed  to  log:  

• Connect  event  o It  logs  connects,  disconnects,  and  failed  connects  +  error  code  

• Query  events  o Executed  queries  will  be  logged  with  user  information  o Queries  are  logged  exactly  as  executed  and  might  reveal  sensitive  data  in  the  logs  o Queries  that  cannot  be  executed  will  be  logged  too    (e.g.  user  doesn’t  have  the  rights  or  a  

syntax  fault)  • Table  events  

o Only  available  in  MariaDB  5.5.31  or  newer  (not  available  in  MySQL)  o Views,  Stored  Procedures,  Functions  and  Triggers  can  access  table  data  without  showing  it  

in  the  executed  query  https://mariadb.com/kb/en/mariadb-vs-mysql-features/  

 Here’s  the  list  of  the  main  logged  information:  

• Timestamp  • Server-­‐Host  • User  Client-­‐Host  • Connection-­‐ID  • Query-­‐ID  

Page 19: MariaDB 10 final · FileName:!MariaDB_10_final.docx! w:!!! e:!info@mariadb.com! Page!4!! 1 What’s!New!in!MariaDB!10! MariaDB!10!was!released!on!March!31st!2014! 1.1 What ...

 

File  Name:  MariaDB_10_final.docx  

w:  www.mariadb.com    e:  [email protected]  

Page  19    

• Operation  • Database  Table  • Error-­‐Code  • ...and  more…  

 

6.2 References  https://mariadb.com/kb/en/mariadb-­‐audit-­‐plugin/  

7 Further  readings  

7.1 MariaDB  10  and  MySQL  5.6  There  are  many  interesting  differences  between  MariaDB  10  and  MySQL  5.6.  We  suggest  to  download  the  whitepaper  “MariaDB  vs  MySQL”  from  the  MariaDB  website:  https://mariadb.com/resources/guides-­‐whitepapers  and  also  to  refer  to  the  MariaDB  Knowledge  Base:    https://mariadb.com/kb/en/mariadb-­‐vs-­‐mysql-­‐features/    https://mariadb.com/kb/en/mariadb-­‐versus-­‐mysql-­‐compatibility/