I'm writing an application/website that have a shared MySQL database (local to both). I've abstracted all the mysql queries to their own layer so that my program could easily be switched to another type of backend. In any case, I'm trying to decide how to implement some of the classes that handle queries.
First Decision:
a) maintain one/few connections to the myssql server using keepalive requests
b) open/close connection for every set of queries (ie open at the beginning of every method, close at the end of every method)
Keeping in mind its on localhost, it seems like option a) would be more efficient, but b) seems to be the correct way if I'm following general IO paradigms. For some calls, I could be doing 200 transactions in a second or two so I'm hesitant to choose b).
Second Decision:
What is the best way to store arrays of data? Right now I'm using a varchar that holds a string with space delimitted integers but it seems there has to be a better way.
Third Decision:
a) fewer tables, more columns
b) more tables, fewer columns
does it matter?
Anything other suggestions from mysql design gurus?