Re: automating RangeTblEntry node support

Поиск
Список
Период
Сортировка
От Matthias van de Meent
Тема Re: automating RangeTblEntry node support
Дата
Msg-id CAEze2Wi3LmpJvnv94YK5n4Zhi3aaWad2MiyRrCmt4Ev8dmW1iQ@mail.gmail.com
обсуждение исходный текст
Ответ на automating RangeTblEntry node support  (Peter Eisentraut <peter@eisentraut.org>)
Список pgsql-hackers
On Wed, 6 Dec 2023 at 21:02, Peter Eisentraut <peter@eisentraut.org> wrote:
>
> I have been looking into what it would take to get rid of the
> custom_read_write and custom_query_jumble for the RangeTblEntry node
> type.  This is one of the larger and more complex exceptions left.
> [...]
> Now one could probably rightfully complain that having all these unused
> fields dumped would make the RangeTblEntry serialization bigger.  I'm
> not sure who big of a problem that actually is, considering how many
> often-unset fields other node types have.  But it deserves some
> consideration.  I think the best way to work around that would be to
> have a mode that omits fields that have their default value (zero).
> This would be more generally useful; for example Query also has a bunch
> of fields that are not often set.  I think this would be pretty easy to
> implement, for example like

Actually, I've worked on this last weekend, and got some good results.
It did need some fine-tuning and field annotations, but got raw
nodeToString sizes down 50%+ for the pg_rewrite table's ev_action
column, and compressed-with-pglz size of pg_rewrite total down 30%+.

> #define WRITE_INT_FIELD(fldname) \
>      if (full_mode || node->fldname) \
>          appendStringInfo(str, " :" CppAsString(fldname) " %d",
> node->fldname)
>
> There is also the discussion over at [0] about larger redesigns of the
> node serialization format.  I'm also interested in that, but here I'm
> mainly trying to remove more special cases to make that kind of work
> easier in the future.
>
> Any thoughts about the direction?

I've created a new thread [0] with my patch. It actually didn't need
_that_ many manual changes - most of it was just updating the
gen_node_support.pl code generation, and making the macros do a good
job.

In general I'm all for reducing special cases, so +1 on the idea. I'll
have to check the specifics of the patches at a later point in time.

Kind regards,

Matthias van de Meent
Neon (https://neon.tech)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Matthias van de Meent
Дата:
Сообщение: Reducing output size of nodeToString
Следующее
От: Joe Conway
Дата:
Сообщение: Re: Emitting JSON to file using COPY TO