agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Andy Fan <zhihuifan1213@163.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: Make printtup a bit faster
Date: Fri, 30 Aug 2024 09:34:34 +0800
Message-ID: <8734mmiyj9.fsf@163.com> (raw)
In-Reply-To: <CAApHDvrQPQsO0FVP+4VC61+F3pqt7gUwnK1_ODmd_JL-GddZ3A@mail.gmail.com>
References: <87wmjzfz0h.fsf@163.com>
	<CAApHDvrBNA-QRsbn-SJyRAsywjHCNenfcbi14c3O3c7=OimQ8Q@mail.gmail.com>
	<87bk1aj2go.fsf@163.com>
	<CAApHDvqHthJb6baDhgTE5T4RLW6nEX=r239EYmpjfg=Wq5CqQA@mail.gmail.com>
	<877cbyizxp.fsf@163.com>
	<CAApHDvrQPQsO0FVP+4VC61+F3pqt7gUwnK1_ODmd_JL-GddZ3A@mail.gmail.com>

David Rowley <dgrowleyml@gmail.com> writes:

> On Fri, 30 Aug 2024 at 13:04, Andy Fan <zhihuifan1213@163.com> wrote:
>>
>> David Rowley <dgrowleyml@gmail.com> writes:
>> > If there's anywhere we call output functions
>> > where the resulting value isn't directly appended to a StringInfo,
>> > then we could just use a temporary StringInfo to obtain the cstring
>> > and its length.
>>
>> I think this is true, but it requests some caller's code change.
>
> Yeah, calling code would need to be changed to take advantage of the
> new API, however, the differences in which types support which API
> could be hidden inside OutputFunctionCall(). That function could just
> fake up a StringInfo for any types that only support the old cstring
> API. That means we don't need to add handling for both cases
> everywhere we need to call the output function.

We can do this, then the printtup case (stands for some performance
crital path) still need to change discard OutputFunctionCall() since it
uses the fake StringInfo then a memcpy is needed again IIUC.

Besides above, my major concerns about your proposal need to change [all
the type's outfunction at once] which is too aggresive for me. In the
fresh setup without any extension is created, "SELECT count(*) FROM
pg_type" returns 627 already, So other piece of my previous reply is 
more important to me.  

It is great that both of us feeling the current stategy is not good for
performance:) 

-- 
Best Regards
Andy Fan






view thread (24+ messages)  latest in thread

Message-ID: <8734mmiyj9.fsf@163.com>
Permalink:  ../8734mmiyj9.fsf@163.com/
Also on:    postgresql.org/message-id/8734mmiyj9.fsf@163.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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: zhihuifan1213@163.com, dgrowleyml@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Make printtup a bit faster
  In-Reply-To: <8734mmiyj9.fsf@163.com>

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

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