Do not call connect() for each executed query

Bug #604821 reported by wouter bolsterlee
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Anewt
Fix Released
Medium
wouter bolsterlee

Bug Description

AnewtDatabasePreparedQuery::executev() calls AnewtDatabaseConnection::connect(), which calls AnewtDatabaseConnection::is_connected(). This results in needless database roundtrips and hence a performance penalty for (at least) MySQL connections, since the is_connected() call results in a MySQL::ping() call.

A better approach is described here:
http://www.mysqlperformanceblog.com/2010/05/05/checking-for-a-live-database-connection-considered-harmful/

Tags: database
Revision history for this message
wouter bolsterlee (wbolster) wrote :

 1789 Wouter Bolsterlee 2010-10-02
      [database] Don't try to connect before each query

      Avoid checking for a valid connection for each executed
      query. It adds extra server roundtrips for at least the
      MySQL backends and does not work reliably anyway.

      This also means that disconnected connections do not
      automatically try to (re)connect anymore, but relying on
      this was bad practice and couldn't possibly work reliably
      with transactions anyway.

Changed in anewt:
assignee: nobody → Wouter Bolsterlee (uws) (uws)
status: Triaged → In Progress
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.