| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com> |
| Subject: | Re: Reducing output size of nodeToString |
| Date: | 2026-11-26 03:01:09 |
| Message-ID: | CA+TgmoZ-BMs7L0n=BmgpvFc+jg4a=203YoeaSRtKrt3mHKvMrw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Nov 25, 2026 at 1:13 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I agree that this is an area that could use some work. But I think
> that if we're going to touch it, we should go considerably further
> than making marginal tweaks to the textual representation of node
> trees. I'd like to see us using a binary-oriented representation
> in stored catalogs, which I think could be both a lot more compact
> and a lot faster to read than what we have now. This would entail
> changing pg_node_tree into a real data type instead of a thin
> wrapper over text, but that doesn't seem like a problem. To the
> extent that we still want the existing text representation anywhere,
> that could be produced by an output function.
That's basically what I thought the last time I posted to this thread
back in January of 2024, but I no longer think so. Poking at a
somewhat-arbitrary test case with an LLM today suggests that we could
get about a 2x size reduction from just compactifying the output
format, and about another 2x from switching to a binary
representation. Obviously, 4x is better than 2x, but 2x is not bad at
all given that (1) it improves readability at the same time and (2)
Matthias has already written patches for most of what seems worth
doing. Just omitting default-valued fields is a massive improvement
for both readability and output size.
That said, if we do go to a binary format, we ought to think hard
about making it protobuf-compatible -- not using their library, but
their wire format. That would let people easily use tools not written
by us to decode our binary blobs, if they want.
--
Robert Haas
Databricks
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-11-26 03:06:57 | Re: Fix assert failure in composite type dependency check for index expr |
| Previous Message | vignesh C | 2026-11-26 02:56:57 | Re: Proposal: Conflict log history table for Logical Replication |