Avoid attach & deploy phase while closing the client connection
Hi Team, I found an optimisation opportunity in the odyssey code while closing a client connection. It is seen odyssey calls attach and deploy phase before parsing/interpreting the client query. Therefore whenever a client sends even TERMINATE ('X') packet as part of postgres protocol to close the client connection, odyssey treats it like any other query packet and calls attach & deploy. If there is no existing backend process to do execute attach & deploy, then odyssey will create one. Post that, odyssey interprets it's a TERMINATE('X) message and close the client connection without forwarding anything to the server.
Drawback is if there are lot of client connections and all of them try to close themselves together, we see a spike in the number of backend process created in order to execute attach & deploy phase for each closing connection.
The suggestion is can we avoid calling attach and deploy phase for unrequired scenarios like closing client connection.