From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, David Steele <david(at)pgmasters(dot)net>, Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: pgbench - refactor init functions with buffers |
Date: | 2020-03-28 19:04:11 |
Message-ID: | 20200328190411.nw4b4any2hgj7pmm@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2020-03-28 14:49:31 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2020-03-27 19:57:12 -0400, Tom Lane wrote:
> >> That being the case, I'd think a better design principle is "make your
> >> new code look like the code around it", which would tend to weigh against
> >> introducing StringInfo uses into pgbench when there's none there now and
> >> a bunch of PQExpBuffer instead. So I can't help thinking the advice
> >> you're being given here is suspect.
>
> > I don't agree with this. This is a "fresh" usage of StringInfo. That's
> > different to adding one new printed line among others built with
> > pqexpbuffer. If we continue adding large numbers of new uses of both
> > pieces of infrastructure, we're just making things more confusing.
>
> Why? I'm not aware of any intention to deprecate/remove PQExpBuffer,
> and I doubt it'd be a good thing to try. It does some things that
> StringInfo won't, notably cope with OOM without crashing.
- code using it cannot easily be shared between frontend/backend (no
memory context integration etc)
- most code does *not* want to deal with the potential for OOM without
erroring out
- it's naming is even more confusing than StringInfo
- it introduces dependencies to libpq even when not needed
- both stringinfo and pqexpbuffer are performance relevant in some uses,
needing to optimize both is wasted effort
- we shouldn't expose everyone to both APIs except where needed - it's
stuff one has to learn
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-03-28 19:07:55 | Re: pg11+: pg_ls_*dir LIMIT 1: temporary files .. not closed at end-of-transaction |
Previous Message | Nikolay Shaplov | 2020-03-28 18:57:33 | Re: [PATCH] Finally split StdRdOptions into HeapOptions and ToastOptions |