pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jerry Sievers <gsievers19@comcast.net>
To: pgsql-general@postgresql.org
Subject: Gratuitous use of savepoint considered silly, if not harmful
Date: Fri, 13 Apr 2018 13:32:22 -0500
Message-ID: <87k1tbrm89.fsf@jsievers.enova.com> (raw)

So I'm (was) puzzled here when a big warehouse system just upgraded to
9.6 which I knew does only a few 100k *real* transactions/day was
wrapping txid_current() so fast, in turn causing some big, nasty tablesl
to age and then require painful long-running vacuums...

Got the brilliant idea to full statement log for just 20 minutes or so
and then do some digging.

OMG my DW team's Pentaho/Kettle driver gizmo emulates single-line
autocommit inserts using savepoints.

It racked up ~1.8M txids meanwhile actually doing only ~900
transactions.

Symptomatic of this also is that your pg_stat_database.(xact_commit +
xact_rollback) counter over time will be wildly smaller then the
advancement of txid_current() perhaps helping in the confusion.

This was csvlogged and field #8 is command-tag which we're pulling out

and summarizing as seen below.

tmp$ grep ^2018 $log-file | grep silly_etl_user | cut -d, -f8 | sort | uniq -c | sort -k1,1bnr -k2

1880283 "INSERT"
1879931 "RELEASE"
1879931 "SAVEPOINT"
 314838 "SELECT"
 314298 "UPDATE"
   2681 "idle"
   2677 "authentication"
   1967 "SET"
    898 "COMMIT"
    897 "BEGIN"
    160 "DELETE"
     83 "TRUNCATE TABLE"
      6 "DROP TABLE"
      2 "CREATE INDEX"
      2 "CREATE TABLE AS"

Anyway, I felt this was worth sharing :-)

Thx

-- 
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 312.241.7800




view thread (2+ messages)  latest in thread

Message-ID: <87k1tbrm89.fsf@jsievers.enova.com>
Permalink:  ../87k1tbrm89.fsf@jsievers.enova.com/
Also on:    postgresql.org/message-id/87k1tbrm89.fsf@jsievers.enova.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: gsievers19@comcast.net
  Subject: Re: Gratuitous use of savepoint considered silly, if not harmful
  In-Reply-To: <87k1tbrm89.fsf@jsievers.enova.com>
  References: <87k1tbrm89.fsf@jsievers.enova.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox