Skip to content

Look into binary encoding for certain data types #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sfackler opened this issue Aug 26, 2013 · 2 comments
Closed

Look into binary encoding for certain data types #7

sfackler opened this issue Aug 26, 2013 · 2 comments

Comments

@sfackler
Copy link
Owner

At least for primitive numeric types and byte arrays, this should help avoid a lot of allocations.

sfackler added a commit that referenced this issue Sep 1, 2013
sfackler added a commit that referenced this issue Sep 1, 2013
sfackler added a commit that referenced this issue Sep 1, 2013
It looks like Postgres doesn't guarantee that its floats are IEEE754,
but I don't know if there are any reasonable platforms on which the
format is actually different.

Work towards #7.
@sfackler
Copy link
Owner Author

sfackler commented Sep 1, 2013

REAL and DOUBLE PRECISION values are interesting here. On one hand, we want to send them in binary formats since lossless conversion between floating point numbers and strings is notoriously hard and most implementations are subtly broken. On the other hand, it appears that Postgres does not guarantee that its floats are IEEE754 internally. It's unclear if non-IEEE754 platforms translate to and from IEEE754 when sending over the network. Integral types are sent big-endian, so the binary format is slightly abstracted from the underlying implementation. It's also unclear if there are any non-IEEE754 platforms that anyone actually wants to run a Postgres server on.

@sfackler
Copy link
Owner Author

sfackler commented Sep 1, 2013

Handling binary data in FromSql will be more complicated than ToSql since we have to specify if we want binary or text data at Bind time. If we decide in #14 to be extremely strict matching types, this is fine since we can ask for binary data for all of the types the driver knows about at least. Unknown types may be forced to use the text format or we could support some system to register binary types with a connection for programs that have implementations of FromSql for things like PostGIS types.

sfackler added a commit that referenced this issue Sep 1, 2013
Will be useful for FromSql binary formats. CC #7
sfackler added a commit that referenced this issue Sep 2, 2013
The set of types the driver asks for in binary format is currently hard
coded.

cc #7
sfackler added a commit that referenced this issue Sep 2, 2013
The set of types the driver asks for in binary format is currently hard
coded.

cc #7, #14
@sfackler sfackler closed this as completed Sep 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant