I’m currently using ruby-postgres (the compiled interface to
PostgreSQL), and I’m seeing a huge performance hit with larger :binary
fields in ActiveRecord subclasses owing, it appears, to the use of the
bytea field type and the fact that using that datatype necessitates an
in-memory “unescape” conversion. The best I can tell from looking at the
Postgres Active Record adapter code, however, it doesn’t look like
switching to ruby-postgres (the native Ruby interface) will help this
problem, so I’m thinking of trying to create an adaptor that uses
PostgreSQL’s large object support to allow binary fields to be streamed
into and out of the database without the necessity of
escaping/unescaping a binary string.
Has anyone attempted this, or have any insight into the :binary
performance issue on PostgreSQL?