Re: When does Postgres use binary I/O?

From: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: When does Postgres use binary I/O?
Date: 2019-09-18 19:28:06
Message-ID: a98a96b7-ccb6-1c9f-43ec-e477a9e642be@illuminatedcomputing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/18/19 7:26 AM, Tom Lane wrote:
> The core regression tests don't systematically exercise binary I/O,
> and they certainly wouldn't magically cover a new type they didn't
> use to. You'd need to add test case(s).

Thanks! I thought psql might use binary IO internally when available, or
at least pg_dump with its custom format, but it looks like neither of
those are true---and now that I think about it I suppose the code in adt
isn't something they would be able to use, so it makes sense.

So I guess my choices are to use COPY WITH (FORMAT BINARY) or write
something that calls PQexecParams. Does anything else use binary I/O?

> Likely it'd be good to have some more consistent approach to
> testing that ... right now it's not even very obvious where
> is a good place to add such tests. I do see a small test in
> src/test/regress/input/misc.source (COPY BINARY stud_emp),
> but that solution doesn't scale easily because of its
> dependence on absolute file pathnames.

I'm not sure how hard this would be, but we could add a new schema to
the regression db and then do something like this:

psql -d regression -c 'COPY public.t TO STDOUT WITH (FORMAT BINARY)' \
| psql -d regression -c 'COPY binaryio.t FROM STDIN WITH (FORMAT BINARY)'

and then verify that `SELECT *` looks the same for the two tables. I can
think of several complications already though. :-)

But even if that's not an automated test at least it gives me an easy
way to manually exercise my own multirange_{send,recv} functions.

Thanks!

--
Paul ~{:-)
pj(at)illuminatedcomputing(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Corey Taylor 2019-09-18 21:00:40 postgres 9.6: insert into select finishes only in pgadmin not psql
Previous Message Adrian Klaver 2019-09-18 19:12:26 Re: Backup PostgreSQL from RDS straight to S3