title: Golang sql database open and close
body: <p>In Go database/sql package it says it is rare to close the database with db.Close because it is meant to be shared by many go routines. Then which one is better when we are given 100 functions that queries from a same data:</p>
  
  <ol>
  <li>Open the database inside each function</li>
  <li>Open the database only one time and use the same connection for every 100 function. </li>
  </ol>
  
  <p>1 is easier because if one fails other 99 can still be working. And no need to pass database connection arguments. But in performance wise which one is better? </p>