1. 12 Nov, 2019 1 commit
  2. 11 Nov, 2019 8 commits
  3. 09 Nov, 2019 6 commits
  4. 08 Nov, 2019 6 commits
  5. 07 Nov, 2019 9 commits
  6. 06 Nov, 2019 10 commits
    • Tomas Vondra's avatar
      Allow sampling of statements depending on duration · 6e3e6cc0
      Tomas Vondra authored
      This allows logging a sample of statements, without incurring excessive
      log traffic (which may impact performance).  This can be useful when
      analyzing workloads with lots of short queries.
      
      The sampling is configured using two new GUC parameters:
      
       * log_min_duration_sample - minimum required statement duration
      
       * log_statement_sample_rate - sample rate (0.0 - 1.0)
      
      Only statements with duration exceeding log_min_duration_sample are
      considered for sampling. To enable sampling, both those GUCs have to
      be set correctly.
      
      The existing log_min_duration_statement GUC has a higher priority, i.e.
      statements with duration exceeding log_min_duration_statement will be
      always logged, irrespectedly of how the sampling is configured. This
      means only configurations
      
        log_min_duration_sample < log_min_duration_statement
      
      do actually sample the statements, instead of logging everything.
      
      Author: Adrien Nayrat
      Reviewed-by: David Rowley, Vik Fearing, Tomas Vondra
      Discussion: https://postgr.es/m/bbe0a1a8-a8f7-3be2-155a-888e661cc06c@anayrat.info
      6e3e6cc0
    • Tomas Vondra's avatar
      Document log_transaction_sample_rate as superuser-only · 11d9ac28
      Tomas Vondra authored
      The docs do say which GUCs can be changed only by superusers, but we
      forgot to mention this for the new log_transaction_sample_rate. This
      GUC was introduced in PostgreSQL 12, so backpatch accordingly.
      
      Author: Adrien Nayrat
      Backpatch-through: 12
      11d9ac28
    • Tom Lane's avatar
      Minor code review for tuple slot rewrite. · 22e44e8d
      Tom Lane authored
      Avoid creating transiently-inconsistent slot states where possible,
      by not setting TTS_FLAG_SHOULDFREE until after the slot actually has
      a free'able tuple pointer, and by making sure that we reset tts_nvalid
      and related derived state before we replace the tuple contents.  This
      would only matter if something were to examine the slot after we'd
      suffered some kind of error (e.g. out of memory) while manipulating
      the slot.  We typically don't do that, so these changes might just be
      cosmetic --- but even if so, it seems like good future-proofing.
      
      Also remove some redundant Asserts, and add a couple for consistency.
      
      Back-patch to v12 where all this code was rewritten.
      
      Discussion: https://postgr.es/m/16095-c3ff2e5283b8dba5@postgresql.org
      22e44e8d
    • Tom Lane's avatar
      Sync our DTrace infrastructure with c.h's definition of type bool. · ff43b3e8
      Tom Lane authored
      Since commit d26a810e, we've defined bool as being either _Bool from
      <stdbool.h>, or "unsigned char"; but that commit overlooked the fact
      that probes.d has "#define bool char".  For consistency, make it say
      "unsigned char" instead.  This should be strictly a cosmetic change,
      but it seems best to be in sync.
      
      Formally, in the now-normal case where we're using <stdbool.h>, it'd
      be better to write "#define bool _Bool".  However, then we'd need
      some build infrastructure to inject that configuration choice into
      probes.d, and it doesn't seem worth the trouble.  We only use
      <stdbool.h> if sizeof(_Bool) is 1, so having DTrace think that
      bool parameters are "unsigned char" should be close enough.
      
      Back-patch to v12 where d26a810e came in.
      
      Discussion: https://postgr.es/m/CAA4eK1LmaKO7Du9M9Lo=kxGU8sB6aL8fa3sF6z6d5yYYVe3BuQ@mail.gmail.com
      ff43b3e8
    • Peter Eisentraut's avatar
      Fix memory allocation mistake · d40abd5f
      Peter Eisentraut authored
      The previous code was allocating more memory than necessary because
      the formula used the wrong data type.
      Reported-by: default avatarJehan-Guillaume de Rorthais <jgdr@dalibo.com>
      Discussion: https://www.postgresql.org/message-id/20191105172918.3e32a446@firost
      d40abd5f
    • Peter Eisentraut's avatar
      Remove unused function argument · 5b7ba75f
      Peter Eisentraut authored
      The cache_plan argument to ri_PlanCheck has not been used since
      e8c9fd5f.
      Reviewed-by: default avatarvignesh C <vignesh21@gmail.com>
      Discussion: https://www.postgresql.org/message-id/flat/ec8a8b45-a30b-9193-cd4b-985d60d1497e%402ndquadrant.com
      5b7ba75f
    • Michael Paquier's avatar
      Fix timestamp of sent message for write context in logical decoding · 5f6b1eb0
      Michael Paquier authored
      When sending data for logical decoding using the streaming replication
      protocol via a WAL sender, the timestamp of the sent write message is
      allocated at the beginning of the message when preparing for the write,
      and actually computed when the write message is ready to be sent.
      
      The timestamp was getting computed after sending the message.  This
      impacts anything using logical decoding, causing for example logical
      replication to report mostly NULL for last_msg_send_time in
      pg_stat_subscription.
      
      This commit makes sure that the timestamp is computed before sending the
      message.  This is wrong since 5a991ef8, so backpatch down to 9.4.
      
      Author: Jeff Janes
      Discussion: https://postgr.es/m/CAMkU=1z=WMn8jt7iEdC5sYNaPgAgOASb_OW5JYv-vMdYaJSL-w@mail.gmail.com
      Backpatch-through: 9.4
      5f6b1eb0
    • Andrew Gierth's avatar
      Request small targetlist for input to WindowAgg. · a9056cc6
      Andrew Gierth authored
      WindowAgg will potentially store large numbers of input rows into
      tuplestores to allow access to other rows in the frame. If the input
      is coming via an explicit Sort node, then unneeded columns will
      already have been discarded (since Sort requests a small tlist); but
      there are idioms like COUNT(*) OVER () that result in the input not
      being sorted at all, and cases where the input is being sorted by some
      means other than a Sort; if we don't request a small tlist, then
      WindowAgg's storage requirement is inflated by the unneeded columns.
      
      Backpatch back to 9.6, where the current tlist handling was added.
      (Prior to that, WindowAgg would always use a small tlist.)
      
      Discussion: https://postgr.es/m/87a7ator8n.fsf@news-spur.riddles.org.uk
      a9056cc6
    • Fujii Masao's avatar
      Correct the command tags for ALTER ... RENAME COLUMN. · 979766c0
      Fujii Masao authored
      Previously ALTER MATERIALIZED VIEW / FOREIGN TABLE ... RENAME COLUMN ...
      returned "ALTER TABLE" as a command tag. This commit fixes them so that
      they return "ALTER MATERIALIZED VIEW" and "ALTER FOREIGN TABLE" as
      command tags, respectively.
      
      This issue exists in all supported versions, but we don't back-patch this
      because it's not enough of a bug to justify taking any compatibility risks for.
      Otherwise, the back-patch would cause minor version update to break,
      for example, the existing event trigger functions using TG_TAG.
      
      Author: Fujii Masao
      Reviewed-by: Ibrar Ahmed
      Discussion: https://postgr.es/m/CAHGQGwGUaC03FFdTFoHsCuDrrNvFvNVQ6xyd40==P25WvuBJjg@mail.gmail.com
      979766c0
    • Fujii Masao's avatar
      Add "G" (server-side data generation) as an initialization step in pgbench. · a386942b
      Fujii Masao authored
      This commit allows --init-steps option in pgbench to accept "G" character
      meaning server-side data generation as an initialization step.
      With "G", only limited queries are sent from pgbench client and
      then data is actually generated in the server. This might make
      the initialization phase faster if the bandwidth between pgbench client
      and the server is low.
      
      Author: Fabien Coelho
      Reviewed-by: Anna Endo, Ibrar Ahmed, Fujii Masao
      Discussion: https://postgr.es/m/alpine.DEB.2.21.1904061826420.3678@lancre
      a386942b