Skip site navigation (1) Skip section navigation (2)

Re: Optimize postgres protocol for fixed size arrays

From: "ktm(at)rice(dot)edu" <ktm(at)rice(dot)edu>
To: Mikko Tiihonen <mikko(dot)tiihonen(at)nitorcreations(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimize postgres protocol for fixed size arrays
Date: 2011-11-22 21:58:06
Message-ID: 20111122215806.GP27589@staff-mud-56-27.rice.edu (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-jdbc
On Tue, Nov 22, 2011 at 11:47:22PM +0200, Mikko Tiihonen wrote:
> Hi,
> 
> During conversion of the jdbc driver to use binary encoding when receiving array objects from postgres it was noticed
> that for example for int[] arrays the binary encoding is normally 30% to 200% larger in bytes than the text encoding.
> 
> This was of concern to some users with slower links to database. Even though the encoded size was larger the binary
> encoding was still constantly faster (with 50% speed up for float[]).
> 
> Here is a patch that adds a new flag to the protocol that is set when all elements of the array are of same fixed size.
> When the bit is set the 4 byte length is only sent once and not for each element. Another restriction is that the flag
> can only be set when there are no NULLs in the array.
> 

Cool. This would be very useful with the DSPAM binary array driver. Although
the binary is shorter because the values are 8 byte integers, they would be
much shorter without the redundant sizing information. Barring issues:

+1

Regards,
Ken

In response to

pgsql-hackers by date

Next:From: Kevin GrittnerDate: 2011-11-22 22:35:51
Subject: Re: FlexLocks
Previous:From: Peter EisentrautDate: 2011-11-22 21:56:55
Subject: Re: pg_upgrade relation OID mismatches

pgsql-jdbc by date

Next:From: Merlin MoncureDate: 2011-11-22 22:46:24
Subject: Re: Optimize postgres protocol for fixed size arrays
Previous:From: Mikko TiihonenDate: 2011-11-22 21:47:22
Subject: Optimize postgres protocol for fixed size arrays

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group