Patch for binary receive of basic array types - Mailing list pgsql-jdbc

From Mikko Tiihonen
Subject Patch for binary receive of basic array types
Date
Msg-id 4E7CFAAC.9000507@nitorcreations.com
Whole thread Raw
Responses Re: Patch for binary receive of basic array types  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-jdbc
Hi,

I coded a patch that allows to receive binary coded int2,int4,int8,float4,float8,text arrays.


I tried a small read-only benchmark that loads repeatedly same rows from database and records the speed.
The test uses the resultSet.getArray(1).getArray() API, not the resultSet.getArray(1).getResultSet() which is slower.
I tried with 4 different types of data to better observe the speed differences.

column   data                            bytes     speed               bytes     speed            data inc  speed inc
int[]    '{1,2,3}'                 text: rowlen=7  4338.39 ops/s, bin: rowlen=44 4477.75 ops/s => 528.57%    3.21%
ops/s
int[][]  '{{1000,2},{NULL,-4000}}' text: rowlen=23 3315.53 ops/s, bin: rowlen=56 4149.75 ops/s => 143.48%   25.16%
ops/s
float4[] '{3.141,-523.23,1e5,0}'   text: rowlen=32 2803.35 ops/s, bin: rowlen=52 4410.70 ops/s =>  62.50%   57.34%
ops/s
text[]   '{abba,\"fa\\\"b\"}'      text: rowlen=14 3987.68 ops/s, bin: rowlen=36 4462.47 ops/s => 157.14%   11.91%
ops/s

summary: speed-up 3-57%, row-length on the wire increases typically between 50% and 200% (smaller increases for larger
arraysor complex types) 


I think the speed-up is enough to justify using of binary transfers for arrays by default even though the data amount
onthe wire is increased. 

-Mikko

Attachment

pgsql-jdbc by date:

Previous
From: Bodor Andras
Date:
Subject: Re: Prepared statement with function as argument: how to bind values?
Next
From: "Kevin Grittner"
Date:
Subject: Re: Patch for binary receive of basic array types