Hello,
this might sound strange but I'll try to explain it anyway

I have a program that outputs data from my MySQL-database to the console. Every time the program starts it creates a new connection to the database. Creating that connection costs about 20ms on my machine. The problem is, that the program has to exit after it is finished with the outputting (yes, it really has to because it is kinda a plugin for another program which starts my program automatically each time again). While 20ms doesn't sound like alot for a user, it is quite alot to me because I need the program to go as fast as it can on my slow machine

Now I thought it would be efficient somehow to create the database connection only once and not close it after the program is finished executing and just reuse the exisiting connection (somehow) in the newly started process.

Well, I have absolutely no clue how to realize that. Maybe someone here has a good idea to implement a good solution (maybe create another program that will be started over and over again by the program (the one I write the plugin for) and simply pass the request along to my actual application (which never closes) and return the output from my program to the program (the one I write the plugin for), lol very confusing but thats the best idea i had so far). Maybe there is a much better way?