On Mon, Jun 21, 2010 at 10:44 PM, Sam Carleton <scarle...@miltonstreet.com> wrote: > I have asked this Q a number of times over the last year and NEVER gotten > ANYONE to even comment on it. I am wondering why: > > Am I opening the DB too much?
what is too much? I mean, the computer is not going to get tired. But, are you experiencing speed bottlenecks? > > My usage of SQLite is in an Apache module that opens the DB each time it > needs info from the DB: For authentication it is open/closed, for the > initialization of the request the db is open/closed, for the processing of > the request, the db is opened and closed. If all of the above is happening within one logical transaction (and, I don't mean, a db transaction -- since you mentioned Apache, I mean, a "job," a "click" from the user's point of view), you certainly can and should open a single db connection, do everything you want to do, close the db, and then return the result to the user. At least, that is how I do it. In fact, once the Apache process ends, the db connection should close automatically, although it doesn't hurt to close it explicitly. > > Is this OK, or should I open it once for the whole request and close it when > the whole request is finished? > > Sam > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Puneet Kishor http://www.punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu ----------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science ======================================================================= _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users