Subject: Re: request for database identifier in the startup packet

From: Dave Cramer <[email-masked]>
Date: Thu, 9 May 2024 14:20:49 -0400

Dave Cramer

On Thu, 9 May 2024 at 12:22, Robert Haas <[email-masked]> wrote:

> On Thu, May 9, 2024 at 8:06 AM Dave Cramer <[email-masked]> wrote:
> > The JDBC driver is currently keeping a per connection cache of types in
> the driver. We are seeing cases where the number of columns is quite high.
> In one case Prevent fetchFieldMetaData() from being run when unnecessary. ·
> Issue #3241 · pgjdbc/pgjdbc (github.com) 2.6 Million columns.
> >
> > If we knew that we were connecting to the same database we could use a
> single cache across connections.
> >
> > I think we would require a server/database identifier in the startup
> message.
>
> I understand the desire to share the cache, but not why that would
> require any kind of change to the wire protocol.
>
> The server identity is actually useful for many things such as knowing
which instance of a cluster you are connected to.
For the cache however we can't use the IP address to determine which server
we are connected to as we could be connected to a pooler.
Knowing exactly which server/database makes it relatively easy to have a
common cache across connections. Getting that in the startup message seems
like a good place

Dave

---

From: Andres Freund <[email-masked]>
Date: Thu, 9 May 2024 12:14:55 -0700

Hi,

> common cache across connections. Getting that in the startup message seems

ISTM that you could just as well query the information you'd like after
connecting. And that's going to be a lot more flexible than having to have
precisely the right information in the startup message, and most clients not
needing it.

Greetings,

Andres Freund

---

From: Robert Haas <[email-masked]>
Date: Thu, 9 May 2024 15:19:00 -0400

> precisely the right information in the startup message, and most clients not

I agree with this.

-- 
Robert Haas
EDB: http://www.enterprisedb.com

---

From: Dave Cramer <[email-masked]>
Date: Thu, 9 May 2024 15:33:40 -0400

On Thu, 9 May 2024 at 15:19, Robert Haas <[email-masked]> wrote:

> Well other than the extra round trip.

Thanks,
Dave