20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker!...

40
New features of PostgreSQL 9.5 News from a hacker Michael Paquier Moscow, PgConf Russia 2015 2015/02/07 2015/02/07 PgConf Russia 2015, Moscow 1

Transcript of 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker!...

Page 1: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

New  features  of  PostgreSQL  9.5  News  from  a  hacker  

Michael    Paquier  Moscow,  PgConf  Russia  2015      

2015/02/07  

2015/02/07   PgConf  Russia  2015,  Moscow   1  

Page 2: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

About  the  lecturer  

•  Michael  Paquier  – Working  on  Postgres  for  VMware  – Community  hacker  and  blogger  – Based  in  Tokyo  

•  Contacts  – TwiHer:  @michaelpq  – Blog:  hHp://michael.otacoo.com  – email:  [email protected]  

2015/02/07   PgConf  Russia  2015,  Moscow   2  

Page 3: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Resources  

•  Planet  Postgres:  planet.postgresql.org  •  Blogs  – Depesz:  www.depesz.com  – My  stuff:  michael.otacoo.com  – Development  documentaQon:  hHp://www.postgresql.org/docs/devel/staQc/  

2015/02/07   PgConf  Russia  2015,  Moscow   3  

Page 4: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Current  status  

•  Postgres  9.5  development  – Last  Commit  Fest  to  begin  on  15th  Feb  

•  Feature  freeze  soon  •  First  Beta  for  April  •  GA  for  September  (?)  

2015/02/07   PgConf  Russia  2015,  Moscow   4  

Page 5: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Categories  

•  SQL-­‐related  features  •  AdministraQon  and  DBA  •  Infrastructure  and  replicaQon  •  To-­‐be-­‐commiHed  features?  

2015/02/07   PgConf  Russia  2015,  Moscow   5  

Page 6: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

BRIN  indexes  •  Index  entry:  range  of  data  by  scanning  a  number  of  blocs  

•  Entry  match:  check  that  entry  fits  in  a  range  •  Mix  of:  

–  index  scan:  look  in  which  group  of  blocks  value  is  by  scanning  ranges  

–  Seq  scan:  Scan  the  set  of  blocks  for  matches  •  Operators  

–  minmax:  1D-­‐operators  –  Possible  to  get  2D-­‐stuff  like  box  (WIP)  

•  Data  warehouse:  geographical  data,  ordered  data  

2015/02/07   PgConf  Russia  2015,  Moscow   6  

Page 7: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

UPDATE  tab  SET  (col1,  col2)  

•  Nice  with  funcQons!  •  Simplify  UPDATE  …  SET  …  FROM  ()  

2015/02/07   PgConf  Russia  2015,  Moscow   7  

CREATE  TABLE  table1  (a  int,  b  int,  c  int);  CREATE  TABLE  table2  (a  int,  b  int,  c  int);  UPDATE  table1  AS  t1  SET  b  =  t2.b,  c  =  t2.c          FROM  (SELECT  a,  b,  c  FROM  table2)  AS  t2  WHERE  t1.a  =  t2.a;  

UPDATE  table1  SET  (b,  c)  =  (SELECT  b,  c  FROM  table2                                              WHERE  table2.a  =  table1.a);  

Page 8: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

SKIP  LOCKED  for  row-­‐level  locks  

•  New  layer  for  FOR  [SHARE  |  UPDATE  |  …  ]  – Default,  wait  for  lock  – NOWAIT,  error  instead  of  waiQng  – SKIP  LOCKED,  skip  locked  tuples  

•  View  of  data  not  consistent  •  ReducQon  of  lock  contenQon  •  For  queue-­‐like  tables  

2015/02/07   PgConf  Russia  2015,  Moscow   8  

Page 9: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

ALTER  TABLE  SET  LOGGED  /  UNLOGGED  

•  Unlogged  table  (9.1~)  – Permanent  table  storage  – Not  WAL’ed,  not  persistent  on  crash  

•  Change  persistence  of  table  – LOGGED  /  UNLOGGED  switch  – Complete  table  rewrite  – Unlogged  -­‐>  logged  faster  than  logged  -­‐>  unlogged  

2015/02/07   PgConf  Russia  2015,  Moscow   9  

Page 10: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

IMPORT  FOREIGN  SCHEMA  (1)  

•  New  API  hook  for  Foreign  Data  wrappers  – Returns  list  of  CREATE  FOREIGN  TABLE  strings  

•  Query  

2015/02/07   PgConf  Russia  2015,  Moscow   10  

List  *  ImportForeignSchema(ImportForeignSchemaStmt  *stmt,                                                                                    Oid  serverOid);    

=#  IMPORT  FOREIGN  SCHEMA  public            FROM  SERVER  postgres_server  INTO  public;                                                                                                                                                                                                  IMPORT  FOREIGN  SCHEMA  

Page 11: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

IMPORT  FOREIGN  SCHEMA  (2)  

•  postgres_fdw  –  import_collate  –  import_default  –  import_not_null  

•  Use  in-­‐core  example  for  your  own  FDW  

2015/02/07   PgConf  Russia  2015,  Moscow   11  

Page 12: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

width_bucket()  

•  Find  to  which  bucket  operand  would  be  assigned  in  a  list  – Actual  number  to  place  – Boundaries  of  bucket  – Number  of  buckets  

•  Available  with  array  defining  the  lower  bounds  of  buckets  

2015/02/07   PgConf  Russia  2015,  Moscow   12  

width_bucket(1.5,  0,  10,  20)  =>  4  width_bucket(1.5,  array[0,  1,  2,  3]::numeric[])  =>  2  

Page 13: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

generate_series(numeric)  

•  Now  for  numeric  •  Already  here  for:  – Timestamps  –  Integers  

2015/02/07   PgConf  Russia  2015,  Moscow   13  

=#  SELECT  generate_series(-­‐4.9,  5.5,  2.2);    generate_series    -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐                          -­‐4.9                          -­‐2.7                          -­‐0.5                            1.7                            3.9  (5  rows)  

Page 14: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Categories  

•  SQL-­‐related  features  •  Administra;on  and  DBA  •  Infrastructure  and  replicaQon  •  To-­‐be-­‐commiHed  features?  

2015/02/07   PgConf  Russia  2015,  Moscow   14  

Page 15: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Row-­‐level  security  (1)  

•  Horizontal  control  of  tuple  access  •  ALTER  TABLE  ENABLE  ROW  LEVEL  SECURITY  – Control  switch  – Default  is  off  

•  CREATE  POLICY  – USING  for  check  on  exisQng  rows  – WITH  CHECK  for  new  rows  – MulQple  policies  apply  with  OR,  not  AND  

2015/02/07   PgConf  Russia  2015,  Moscow   15  

Page 16: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Row-­‐level  security  –  Example  (2)  

•  Data  set  

2015/02/07   PgConf  Russia  2015,  Moscow   16  

-­‐-­‐  Create  data  CREATE  ROLE  admin  SUPERUSER;  CREATE  ROLE  alice  LOGIN;  CREATE  TABLE  employee  (name  text,  salary  int);  ALTER  TABLE  employee  ENABLE  ROW  LEVEL  SECURITY;  INSERT  INTO  employee  VALUES  ('CEO',  10000000);  INSERT  INTO  employee  VALUES  ('alice',  1000);  -­‐-­‐  Allow  SELECT  access  to  a  normal  employee  GRANT  SELECT  ON  employee  TO  alice;  

Page 17: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Row-­‐level  security  –  Example  (3)  

•  And  no  data  for  Alice  

2015/02/07   PgConf  Russia  2015,  Moscow   17  

-­‐-­‐  Admin  view  CREATE  POLICY  admin_view  ON  employee  TO  admin              USING  (true)  WITH  CHECK  (true);  -­‐-­‐  Only  allow  a  vanilla  user  to  view  its  own  stuff  CREATE  POLICY  own_view  ON  employee  FOR  SELECT            USING  (current_user  =  name);    -­‐-­‐  And  Alice…  $  psql  -­‐At  -­‐c  "SELECT  *  FROM  employee;"  -­‐U  alice  postgres  alice|1000  

Page 18: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

REINDEX  SCHEMA  

•  Reindex  all  relaQons  on  a  single  schema  •  Including  toast  relaQons  •  Good  for  maintenance  of  mulQ-­‐schema  environments  

•  Notes:  – One  transacQon  per  relaQon  – Exclusive  lock    – REINDEX  SCHEMA  pg_catalog  <=>  REINDEX  SYSTEM  

2015/02/07   PgConf  Russia  2015,  Moscow   18  

Page 19: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Event  triggers  –  table_rewrite  

•  New  event:  table_rewrite  •  Kicked  for  some  flavors  of  ALTER  TABLE  •  Define  rewrite  policies  – Schema,  user  control  – Scheduling  – Table  size  – Etc.  

2015/02/07   PgConf  Russia  2015,  Moscow   19  

Page 20: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Parallel  VACUUM  with  vacuumdb  

•  Defined  by  jobs  -­‐j  •  Support  for  custom  list  of  tables  •  Support  for  ANALYZE-­‐related  opQons  •  Largest  tables  first  •  Risk  of  deadlocks  with  FULL  on  catalogs  – Low  number  of  applicaQon  tables  – High  number  of  jobs  

2015/02/07   PgConf  Russia  2015,  Moscow   20  

Page 21: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

ALTER  SYSTEM  RESET  

•  Reset  value  of  one  parameter  in  postgresql.conf.auto  

•  RESET  ALL  for  all  parameters  

2015/02/07   PgConf  Russia  2015,  Moscow   21  

=#  ALTER  SYSTEM  SET  shared_buffers  =  '100GB’;  ALTER  SYSTEM  =#  ALTER  SYSTEM  SET  work_mem  =  '1TB’;  ALTER  SYSTEM  =#  ALTER  SYSTEM  RESET  work_mem;  ALTER  SYSTEM  =#  \!  cat  $PGDATA/postgresql.auto.conf  #  Do  not  edit  this  file  manually!  #  It  will  be  overwriHen  by  ALTER  SYSTEM  command.  shared_buffers  =  '100GB'  

Page 22: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Categories  

•  SQL-­‐related  features  •  AdministraQon  and  DBA  •  Infrastructure  and  replica;on  •  To-­‐be-­‐commiHed  features?  

2015/02/07   PgConf  Russia  2015,  Moscow   22  

Page 23: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Abbreviated  keys  

•  Improve  sort  of  text  Datum  – Use  first  bytes  of  strxfrm  – Fallback  to  old  method  if  8-­‐first  bytes  idenQcal  

•  Performance  – CREATE  INDEX  Qme  3x  faster  – Slower  for  8-­‐first  bytes  idenQcal  – Good  for  raw  dumps  

•  Available  on  Windows  as  well  

2015/02/07   PgConf  Russia  2015,  Moscow   23  

Page 24: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

New  WAL  format  

•  Improve  detecQon  of  relaQon  blocks  touched  by  a  WAL  record  

•  Stats:  –  93  files  changed  –  3945  inserQons(+)  –  4366  deleQons(-­‐)  

•  New  API  for  redo  and  WAL  record  construcQon  •  xlog.c  split  a  bit  more  •  Useful  for  tools  =>  pg_rewind  

2015/02/07   PgConf  Russia  2015,  Moscow   24  

Page 25: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

AcQons  at  the  end  of  recovery  

•  New  parameter  recovery_target_acQon  •  In  recovery.conf  •  Values  when  recovery  target  is  reached  – pause,  same  as  pause_at_recovery_target  – promote,  perform  promoQon  to  next  Qmeline  – Shutdown,  stop  the  node  

•  Work  for  target  XID,  Qmestamp,  name  

2015/02/07   PgConf  Russia  2015,  Moscow   25  

Page 26: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Improvements  of  Windows  build  

•  AddiQon  of  file  versioning  – 4-­‐digit  number  – File  informaQon  – All  libs  and  bins  covered  – Useful  for  packagers  and  upgrade  processes  

•  -­‐-­‐extra-­‐version  support  in  MSVC  •  Shared  Libraries  installed  in  bin/  and  lib/  (MSVC  pending)  

2015/02/07   PgConf  Russia  2015,  Moscow   26  

Page 27: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Logging  of  replicaQon  commands  

•  Control  with  GUC  log_replicaQon_commands  •  Default  =  off  – Log  messages  as  DEBUG1  – Same  as  prior  releases  

•  When  on,  wriHen  as  LOG  

2015/02/07   PgConf  Russia  2015,  Moscow   27  

LOG:  received  replicaQon  command:  IDENTIFY_SYSTEM  LOG:  received  replicaQon  command:  START_REPLICATION  0/3000000  TIMELINE  1  

Page 28: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

cluster_name  

•  Set  custom  string  in  process  Qtle  •  IdenQfy  instances  on  same  host  

2015/02/07   PgConf  Russia  2015,  Moscow   28  

35839      ??    Ss          0:00.04  postgres:  pg_5432:  checkpointer  process            35873      ??    Ss          0:00.02  postgres:  pg_5433:  checkpointer  process            35909      ??    Ss          0:00.02  postgres:  pg_5434:  checkpointer  process            35956      ??    Ss          0:00.03  postgres:  pg_5435:  checkpointer  process            36001      ??    Ss          0:00.02  postgres:  pg_5436:  checkpointer  process            36044      ??    Ss          0:00.02  postgres:  pg_5437:  checkpointer  process            36095      ??    Ss          0:00.03  postgres:  pg_5438:  checkpointer  process            36223      ??    Ss          0:00.00  postgres:  pg_5439:  checkpointer  process            36353      ??    Ss          0:00.00  postgres:  pg_5440:  checkpointer  process  

Page 29: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Exported  snapshots  with  pg_dump  

•  Get  database  at  state  of  slot  creaQon  

•  Base  image  to  consume  changes  

2015/02/07   PgConf  Russia  2015,  Moscow   29  

$  psql  "replicaQon=database  dbname=mpaquier"  [...]  =#  CREATE_REPLICATION_SLOT  foo3  LOGICAL  test_decoding;  slot_name  |  consistent_point  |  snapshot_name  |  output_plugin  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐+-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐+-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐+-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐                            foo  |                      0/16ED738  |                000003E9-­‐1  |  test_decoding  (1  row)  […  hold  on  replicaQon  connecQon  …]  pg_dump  -­‐-­‐snapshot  000003E9-­‐1  

Page 30: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

And  more…  

•  Features  for  replicaQon  – Niche  use-­‐cases:  Slony,  BDR,  UDR…  – Commit  Qmestamp  – Textual  representaQon  of  objects  

•  pageinspect  for  GIN  and  BRIN  indexes  •  Scalability  work  •  etc.  

2015/02/07   PgConf  Russia  2015,  Moscow   30  

Page 31: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Categories  

•  SQL-­‐related  features  •  AdministraQon  and  DBA  •  Infrastructure  and  replicaQon  •  To-­‐be-­‐commiUed  features?  

2015/02/07   PgConf  Russia  2015,  Moscow   31  

Page 32: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

UPSERT  

•  If  fully-­‐baked,  number  #1  for  9.5  •  Grammar:  – Agreement  (!)  – ON  CONFLICT  [  UPDATE  |  IGNORE  ]  

•  SQll  development  work  going  on…  •  Commit  forecast:  cloudy  

2015/02/07   PgConf  Russia  2015,  Moscow   32  

Page 33: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

WAL  compression  

•  Reduce  WAL  I/O  with  some  CPU  cost  •  Move  of  pglz  in  src/common  •  Patches  advanced  •  Agreement  on  spec  – Session  switch  wal_compression  

•  Commit  forecast:  sunny  

2015/02/07   PgConf  Russia  2015,  Moscow   33  

Page 34: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

ALTER  TABLE  log_min_vacuum_duraQon  

•  log_min_vacuum_duraQon  at  relaQon  level  •  Filter  autovacuum  report  spams  in  logs  •  Anyone  caring  about  that?  •  Commit  forecast:  rainy-­‐cloudy  

2015/02/07   PgConf  Russia  2015,  Moscow   34  

Page 35: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

File-­‐level  incremental  backup  

•  Get  file-­‐level  differenQal  backups  from  LSN  posiQon  

•  Targets  niche  use-­‐case  applicaQons,  like:  – Set  of  relaQons  with  few  updates  – Set  of  relaQons  with  a  lot  of  updates  

•  pg_rman  does  it,  at  block  level.  •  Commit  forecast:  rainy  

2015/02/07   PgConf  Russia  2015,  Moscow   35  

Page 36: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

New  types  for  abbreviated  keys  

•  For  Datum  sorts  •  And  numeric  sorts  •  Infrastructure  already  in  place  •  Forecast  for  9.5:  sunny  

2015/02/07   PgConf  Russia  2015,  Moscow   36  

Page 37: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

CRC  improvements  

•  Slice-­‐by-­‐8  algorithm  (?)  •  Cool  CPU  improvements  for  WAL  generaQon  •  Commit  forecast:  sunny  

2015/02/07   PgConf  Russia  2015,  Moscow   37  

Page 38: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Redesign  of  checkpoint_segments  

•  GUC  checkpoint_wal_size  – Set  directly  disk  space  needed  by  WAL  – Hard  limit,  visibly  –  IntuiQve  – No  more  formula  needed  

•  Commit  forecast:  sunny  

2015/02/07   PgConf  Russia  2015,  Moscow   38  

Page 39: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

pgaudit  

•  Audit  capabiliQes:  – At  user  level  – At  table  level  

•  Spec  sQll  unsure  – AUDIT  in-­‐core  clause  – Simple  contrib  module  (?)  

•  Feature  has  been  asked  for  years  •  Commit  forecast:  rainy-­‐cloudy  

2015/02/07   PgConf  Russia  2015,  Moscow   39  

Page 40: 20150207 postgres 95 new · 2020. 3. 18. · Newfeaturesof$ PostgreSQL9.5! News!from!ahacker! Michael!!Paquier! Moscow,!PgConf!Russia2015!!! 2015/02/07 2015/02/07 PgConf!Russia2015,!Moscow!

Ques;ons?  

2015/02/07   PgConf  Russia  2015,  Moscow   40