pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Schmitz <schmitz@occamlabs.de>
To: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: bytea performance tweak
Date: Wed, 22 Jun 2011 16:17:12 +0200
Message-ID: <20110622141711.GA2652@summalogicae.occamlabs.local> (raw)
In-Reply-To: <BANLkTimryw=Sm5q4v53PQNkdi+RjAfgJBA@mail.gmail.com>
References: <20110621130713.GB3919@summalogicae.occamlabs.local>
	<BANLkTimryw=Sm5q4v53PQNkdi+RjAfgJBA@mail.gmail.com>

Oliver Jowett wrote:

Hi,

> On 22 June 2011 01:08, Andreas Schmitz <schmitz@occamlabs.de> wrote:
> > I've noticed that fetching a bytea field produces a lot of overhead when
> > converting into a byte[] or InputStream. Looking at the code, I've
> > produced a small patch (a lookup table for the hex codes) which makes
> > the conversion faster. What do you think?
> 
> Surprising. How did you benchmark it?

I did some local tests using a main function, with a static array. I've
seen times like ~1900ms for decoding using the unpatched version, and
~1600ms for the patched version. I've also benchmarked my application
(which makes heavy use of bytea), and have seen some speedup there as
well (around 2-300ms faster when decoding ~23000 bytea rows with ~30MB
of data in total).

I was wondering why the protocol uses such an encoding anyway. Wouldn't
it be a lot faster just sending the bytes as they are?

Best regards, Andreas

Attachments:

  signature.asc (application/pgp-signature, 197B) download

view thread (17+ messages)  latest in thread

Message-ID: <20110622141711.GA2652@summalogicae.occamlabs.local>
Permalink:  ../20110622141711.GA2652@summalogicae.occamlabs.local/
Also on:    postgresql.org/message-id/20110622141711.GA2652@summalogicae.occamlabs.local

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: schmitz@occamlabs.de, oliver@opencloud.com
  Subject: Re: bytea performance tweak
  In-Reply-To: <20110622141711.GA2652@summalogicae.occamlabs.local>
  References: <20110621130713.GB3919@summalogicae.occamlabs.local> <BANLkTimryw=Sm5q4v53PQNkdi+RjAfgJBA@mail.gmail.com> <20110622141711.GA2652@summalogicae.occamlabs.local>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox