Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(820)

Issue 116930043: code review 116930043: database/sql: Avoid re-preparing statements when all co...

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 9 months ago by johto
Modified:
9 years, 7 months ago
Reviewers:
bradfitz
CC:
golang-codereviews, gobot, bradfitz
Visibility:
Public.

Description

database/sql: Avoid re-preparing statements when all connections are busy Previously, if all connections were busy, we would always re-prepare the statement on the connection we were assigned from the pool. That meant that if all connections were busy most of the time, the number of prepared statements for each connection would keep increasing over time. Instead, after getting a free connection, check to see if the statement has already been prepared on it, and reuse the statement handle if so.

Patch Set 1 #

Patch Set 2 : diff -r f749e3111252 https://code.google.com/p/go #

Patch Set 3 : diff -r f749e3111252 https://code.google.com/p/go #

Patch Set 4 : diff -r e1d0077340e8 https://code.google.com/p/go #

Total comments: 4

Patch Set 5 : diff -r 277f98d885558a00e899f6e89958e97470fd8ab4 https://code.google.com/p/go #

Patch Set 6 : diff -r c31e69cab80bd1ef8dd17b8269a8c108c167b516 https://code.google.com/p/go #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -31 lines) Patch
M src/pkg/database/sql/sql.go View 1 2 3 4 5 2 chunks +40 lines, -25 lines 1 comment Download
M src/pkg/database/sql/sql_test.go View 1 2 3 4 3 chunks +7 lines, -6 lines 0 comments Download

Messages

Total messages: 13
johto
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
9 years, 9 months ago (2014-07-19 11:28:24 UTC) #1
johto
I've updated this patch set to improve an existing comment and to simplify the changes ...
9 years, 9 months ago (2014-07-20 12:22:48 UTC) #2
gobot
R=bradfitz@golang.org (assigned by r@golang.org)
9 years, 8 months ago (2014-08-03 17:21:25 UTC) #3
johto
Ping?
9 years, 8 months ago (2014-08-16 11:53:25 UTC) #4
bradfitz
You touched the test file but it doesn't look like there's necessarily a new test, ...
9 years, 8 months ago (2014-08-18 17:59:58 UTC) #5
johto
On 2014-08-18 7:59 PM, bradfitz@golang.org wrote: > You touched the test file but it doesn't ...
9 years, 8 months ago (2014-08-18 18:44:15 UTC) #6
bradfitz
Status on this? The tree closes in 3 days.
9 years, 8 months ago (2014-08-28 15:27:14 UTC) #7
johto
On 2014-08-28 5:27 PM, bradfitz@golang.org wrote: > Status on this? The tree closes in 3 ...
9 years, 8 months ago (2014-08-28 15:47:27 UTC) #8
johto
On 8/28/14, 5:47 PM, I wrote: > On 2014-08-28 5:27 PM, bradfitz@golang.org wrote: >> Status ...
9 years, 8 months ago (2014-08-29 00:31:59 UTC) #9
bradfitz
On Thu, Aug 28, 2014 at 5:32 PM, Marko Tiikkaja <marko@joh.to> wrote: > On 8/28/14, ...
9 years, 7 months ago (2014-08-30 17:38:37 UTC) #10
johto
On 8/30/14 7:38 PM, Brad Fitzpatrick wrote: > It's so easy to avoid goto here. ...
9 years, 7 months ago (2014-08-30 20:56:00 UTC) #11
bradfitz
LGTM https://codereview.appspot.com/116930043/diff/100001/src/pkg/database/sql/sql.go File src/pkg/database/sql/sql.go (right): https://codereview.appspot.com/116930043/diff/100001/src/pkg/database/sql/sql.go#newcode1329 src/pkg/database/sql/sql.go:1329: connStmtInfo := func(cs connStmt) (ci *driverConn, releaseConn func(error), ...
9 years, 7 months ago (2014-09-02 16:08:06 UTC) #12
bradfitz
9 years, 7 months ago (2014-09-02 16:08:49 UTC) #13
*** Submitted as https://code.google.com/p/go/source/detail?r=fdb52a28028a ***

database/sql: Avoid re-preparing statements when all connections are busy

Previously, if all connections were busy, we would always
re-prepare the statement on the connection we were assigned from
the pool.  That meant that if all connections were busy most of the
time, the number of prepared statements for each connection would
keep increasing over time.

Instead, after getting a free connection, check to see if the
statement has already been prepared on it, and reuse the statement
handle if so.

LGTM=bradfitz
R=golang-codereviews, gobot, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/116930043

Committer: Brad Fitzpatrick <bradfitz@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b