How long is it ok to keep a connection to a MySql db open?
<p>I have a python which has to work 24/7 on a server. It constantly receives data and it inserts it into a MySql db. The 
frequency can vary, and in general it's approximately:</p>

<pre><code>1 write / 1 second minimun and 

1 write / 30 minutes maximum.
</code></pre>

<p>There're other clients who can read from the same db and tables but those are separate applications.</p>

<p>Given this, should I ever close a connection from my python script to the MySql db? Maybe I should have a timer, so I have no data to insert within 10 minutes, I should close the connection? And then open it again when data comes.</p>