Thread: parameter limit

parameter limit

From
Scott Ribe
Date:
In libpq, PQexecParams has nParams as type int. So on any reasonable platform, that's at least 4 bytes. My question
thenis: when I see documented limits of 65535 params in various drivers and libraries, that is NOT a restriction of
libpqnor of the protocol, but rather an arbitrary limit of the driver/library, correct? 

--
Scott Ribe
scott_ribe@elevated-dev.com
https://www.linkedin.com/in/scottribe/






Re: parameter limit

From
Adrian Klaver
Date:
On 4/23/20 7:33 AM, Scott Ribe wrote:
> In libpq, PQexecParams has nParams as type int. So on any reasonable platform, that's at least 4 bytes. My question
thenis: when I see documented limits of 65535 params in various drivers and libraries, that is NOT a restriction of
libpqnor of the protocol, but rather an arbitrary limit of the driver/library, correct?
 

No.

From:

src/interfaces/libpq/fe-exec.c

if (nParams < 0 || nParams > 65535)
         {
                 printfPQExpBuffer(&conn->errorMessage,
                                                   libpq_gettext("number 
of parameters must be between 0 and 65535\n"));
                 return 0;
         }

> 
> --
> Scott Ribe
> scott_ribe@elevated-dev.com
> https://www.linkedin.com/in/scottribe/
> 
> 
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: parameter limit

From
"David G. Johnston"
Date:
On Thursday, April 23, 2020, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 4/23/20 7:33 AM, Scott Ribe wrote:
In libpq, PQexecParams has nParams as type int. So on any reasonable platform, that's at least 4 bytes. My question then is: when I see documented limits of 65535 params in various drivers and libraries, that is NOT a restriction of libpq nor of the protocol, but rather an arbitrary limit of the driver/library, correct?

No.

From:

src/interfaces/libpq/fe-exec.c

if (nParams < 0 || nParams > 65535)
        {
                printfPQExpBuffer(&conn->errorMessage,
                                                  libpq_gettext("number of parameters must be between 0 and 65535\n"));
                return 0;
        }

Or, from the specification for the Bind Message in the documentation:


 Int16

The number of parameter values that follow

David J.

Re: parameter limit

From
Scott Ribe
Date:
> On Apr 23, 2020, at 8:48 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>
> No.

Ah, thanks a lot for that info.

It's not that I really normally want to have bazillions of params.

But we have some moderately large inserts, that are showing a sudden non-linear dropoff when scaling up, and a
suspicionthat the performance dropoff is NOT actually in PG. So, lots of spelunking...