title: Do unused mysql connections slow down scripts?
body: <p>I am in the process of writing an API for my website, along with a pretty large class to process all of the API requests.</p>
  
  <p>Most pages, if not all all the pages on the website will send at least one request to the api on load. The most important priority for this website is efficiency and resultantly, very quick server processing.</p>
  
  <p>I am therefore seeking a little bit of advice when it comes to classes and certain PHP functions.</p>
  
  <p>Firstly, it looks like the class I am writing will probably end up being around 3000 lines of code. If this is initialised on each page, ignoring the fact that only one or two of the functions within the class will be used per page, will this make the API much slower? Should I be looking at separate files with extensions to the class for each class method?</p>
  
  <p>Secondly, I currently have all of my connections to the various databases in separate files within a directory. Within each connection is the function mysql_pconnect(). At the moment, I only require these files when needed. So if the method needs a connection to the x database, then I simply place require(connection...) into the method. Is it bad to include files within a class?</p>
  
  <p>I am asking, because the only other solution is to require all of the connections at the top of the page so that the class can access them without requiring them for each method. This is why I would like to know whether having several connections at once, even if they are not used, is taxing on the server?</p>
  
  <p>So three questions really:</p>
  
  <ol>
  <li>Does initiating a large class at the beginning of each page slow down the script runtime, even if only one class method is being used? Is this why people use 'class extends class'?</li>
  <li>Is it bad to 'require()' files within a class?</li>
  <li>Do unused connections to a mysql database slow down the runtime of a script?</li>
  </ol>