On Wed, Nov 25, 2026 at 1:13 PM Tom Lane <[email protected]> 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
