I have a an app composed of multiple classes. In most of these classes I need to access the data located in an SQLite3 DB of words that contains 60,000 rows (Note: each row is composed of a word, it's POS tag, and frequency).
I don't know whether it is better to populate a list of tuples and pass it to my classes(as a parameter or a global) or just pass the connection to them, knowing that I will be doing very little filtering like: (SELCT * WHERE pos = 'N' ORDER BY frequency DESC
). Which one would be more efficient as my app uses this data frequently.
If I use the DB connection: Is not closing a DB connection and reopening it frequently, resource consuming? or I should keep the connection open? which leads to the problem of knowing where to close the connection. could somebody please suggest a proper place to close the DB connection? or a connection gets closed when the app terminates.
PS: It is apparent from my question that I am a total newbie, so excuse me if I am asking a lot of question.