Thread: How to avoid intstantiating multiple JVM instances across different sessions to use FDW?

How to avoid intstantiating multiple JVM instances across different sessions to use FDW?

From
ganggewang(王刚)
Date:

Hi there,

 

I am recently implementing a new FDW, which would internally instantiate a JVM instance to invoke JNI calls, and the JVM instance would be created in a session when a new query that hit the foreign table comes.

I notice for each session, PG would fork a new process. While the JVM instance is available only in the same process. Do you have any suggestion to reuse the same JVM instance across different sessions to reduce memory usage?

 

Thanks in advance.