On 7/5/06, Jeff LaMarche <jeff_lamarche@mac.com>
wrote:> 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?
>
This was discussed on ruby-core about a month ago, see
<http://www.ruby-forum.com/topic/67087>.
The idea is rewriting AR to pass queries around as ["query string",
bunch, of, parameters], rather than escaping the query right away and
passing it around as a string which i understand is done today.
Not sure what is being done atm, but would love to see proper support
for prepared statements in Rails soon. Add in decimal support and
better constraint handling as well, and Rails does everything I could
wish for.
Isak