model-writtenrun 7315 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Kevin Van proposed a version-prefixed bytea export of JSONB's internal representation to avoid server-side text conversion, reporting substantially faster extraction in a preliminary benchmark #1.
- Tom Lane opposed exposing a complex internal format and suggested optimizing JSONB output or designing proper binary I/O; Stephen Frost supported avoiding binary-to-text round trips, and Andrew Dunstan noted that the existing version byte could distinguish a future wire format #2 #3 #4 #5.
- Andres Freund identified endianness, alignment and numeric-encoding problems with copying internal bytes directly, later showing the alignment-dependent code in fillJsonbValue() #7 #22.
- Christian Ohler defended an explicit bytea function as a way to deliver raw bytes without driver changes, while Tom Lane maintained that compatibility and a suitable interchange format still had to be addressed #8 #9.
- Daniel Gustafsson suggested JIT acceleration, but Tomas Vondra explained that arbitrary JSON documents offered no obvious stable structure for the proposed specialization #11 #12.
- Merlin Moncure and Stephen Frost accepted that a binary format should respect existing portability contracts; Merlin requested benchmarks against text parsing to establish the practical benefit #15 #16 #17.
- David Fetter suggested storing JSONB in wire format, but Andres Freund rejected that direction because storage and transmission have different requirements; the discussion also left the existing per-value version header in place #25 #26 #27.
- After a gap of nearly four years, Jelte Fennema-Nio revived the thread with a CPU-bound COPY BINARY workload involving large JSONB values, reporting that JSON parsing consumed half the CPU time and supplying a flamegraph #28 #29.
- Andres Freund pointed toward parser optimizations, John Naylor proposed SSE2 scanning for JSON strings and UTF-8 validation, and Jelte suggested UBJSON as a possible portable binary interchange format without reaching a format decision #30 #31 #32.
- Andres Freund identified per-character appendStringInfoChar() calls as a major avoidable cost and proposed building strings in larger chunks #33.
- John Naylor's final attachment implemented the separate SSE2 ASCII-validation optimization, with an estimated 40–50% reduction in that portion of the profile; the supplied thread ends without a revised raw-JSONB export patch or a resolution of the binary-format proposal #34.
- John Naylor subsequently committed batched JSON string construction in 3838fa269c, crediting Jelte's proof of concept and reworking by Andres and himself; although related to the chunking discussion here #33, the committed patches came from the later submission #509981 in thread #46137, and this commit does not establish that the SSE2 attachment landed #34.