Repository navigation
Conversation
Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolved (Question 1): Is binary the default, and how is it switched?Design doc, lines 38–60 and 126–143 Binary transport is chosen per result: binary when every column has a binary decoder, text otherwise, so ineligible types behave exactly as today. Eligible types change in the few ways listed under "Behavior changes" (mainly
Generated by Claude Code |
Question 2: What happens with
|
Question 3: Does
|
Question 4: Is the
|
Question 5: Are parameters sent in binary format too?Parameters are formatted as text in R today, except
Generated by Claude Code |
Question 6: Does
|
Question 7: How is binary
|
Agreed with the ALTREP and Arrow sessions. Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Benchmark: text vs binary result transportSetup. A throwaway prototype ( Binary/text ratio of the median time (below 1 means binary is faster):
Memory allocation is identical in both formats. Timings at 1e6 rows rest on 5 iterations and vary by about 10% between runs. Differential check (output): identical results for bool, int2, int4, oid (including the wrap above 2^31), int8, float8, numeric, text types, "char", json, jsonb, bytea, uuid, void, time, timetz, and dates and timestamps between years 1 and 9999 in UTC, on edge values and on 1e5 random values for float8, numeric and timestamptz. Differences: float4 widens (90% of random values, up to 6e-8 relative; question 4); infinities, BC dates and years beyond 9999 are correct only in binary (#655, fixed for text by #660); offsets with seconds (local mean time before about 1900) are off by up to 59 s in text on My reading.
Generated by Claude Code |
Follow the points agreed with the binary transport design in #667: the result format is chosen once per result at prepare time and passed to begin(), fixed-width binary columns are stored densely at native width, and the shared decoders of phase 1 are owned by that effort. Update the chunk layout, memory estimates, phase plan, and the open questions on copying, user-defined type storage, and unknown types, citing the #667 benchmark. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4c819TffvkRZJ1V2T
Narrow the eligibility rule, the differential claims and the benchmark reading, detect the server before defaulting to binary, and keep oid and pre-15 "char" on text. Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Accepted limitationsThese remain after three rounds of clean review of the design and its experiment record.
Generated by Claude Code |
Claude-Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Force text results on ALTREP connections in phase 2, and make phase 2b depend on both ALTREP phase 2 and the binary switch of #667. Decode numeric at copy in both formats, and legacy text timetz into seconds as today. State the binary blob fallback as the one exception to OID-based storage, give the legacy mismatch its own error, and list the stored widths per type. Qualify the exactness of pq_text() under the legacy mapping, and attach pq_format to the blob that pq_raw() returns. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4c819TffvkRZJ1V2T
|
The binary format has too many drawbacks to be useful at this stage. We won't be able to fully switch:
|
|
Two small points from the ALTREP design (#632) for line 221 of
Also, on open question 6 here: #632 treats binary Generated by Claude Code |
Compare identity runs in the same result format and name the accepted binary behavior changes of #667 for text-versus-binary tests. Describe oid as today on each platform and binary oid as pending #667, name the "binary allowed" flag, move legacy timetz to the date and time phase, complete the width lists, and attribute the legacy error and the v2 blob to their phases. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4c819TffvkRZJ1V2T
This PR records the design for fetching query results in libpq's binary format instead of text, following the discussion of
moneyin #659, with a benchmark of text versus binary transport. The design is indesign/binary-transport.md, the experiment record (prototype patch, scripts, raw results, differential check) indesign/binary-transport-bench/. Implementation follows in separate PRs.What the design proposes:
dbBind()groups.immediate = TRUE(simple query protocol) stays text.integer_datetimes = on), and "char" on servers from PostgreSQL 15. Each reproduces today's R value; the exceptions are listed under "Behavior changes".begin()(which gains aformatsvector on top of refactor: Fetch rows through a pluggable row sink #638), returning a status instead of warning, used by the legacy column sources, the ALTREP columns of docs: Design ALTREP-backed result columns #632 and an Arrow sink. This work owns docs: Design ALTREP-backed result columns #632's phase 1, after fix: Readmoneycolumns as numbers instead of 0 #659 and fix: Parseinfinity, BC dates, and years beyond 9999 in dates and timestamps #660 merge.dbConnect()argument whose"auto"default requests binary only for servers detected as PostgreSQL 10 or later from values libpq has at connection time; Redshift and other recognizable compatible servers stay on text. Parameters stay text.float4widens to the exact stored value (0.1 → 0.100000001490116);float8from servers before PostgreSQL 12 becomes exact; infinite and BC dates and timestamps and historical offsets with seconds become correct; rare one-ulp rounding differences fortimestamptzin non-UTC sessions.Benchmark (comment): binary fetches are 20–40% faster for timestamptz, float8, bytea, int8 and a wide mixed table, with no measurable difference for int4, date, bool, text, numeric and uuid. The per-row overhead of single-row mode likely caps the gain. A prototype differential check found only the behavior changes above.
Relation to other PRs: #659 (money) stays needed, since results with money stay text under the recommended option. #660 (dates) stays needed for text results (
immediate = TRUE, Redshift, fallback), but binary results don't depend on it. #638 stays as it is. #632 decides its chunk layout itself;altrep = TRUEconnections get text results until ALTREP phase 2b, through a per-connection "binary allowed" flag added in this work's phase 2.The design went through three rounds of clean review. Resolved: 1 default and switch. Open questions (one comment each): 2
immediate = TRUE, 3 money, 4 float4, 5 parameters, 6 oid, 7 numeric.Accepted limitations: #667 (comment)
Session: https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3
https://claude.ai/code/session_01Hr1rd4DRzYu5618pRoCxJ3
Generated by Claude Code