From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | patch: add get/setPrepareThreshold to PGStatement, PGConnection, datasources |
Date: | 2003-12-02 08:18:49 |
Message-ID: | 20031202081849.GK19205@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
This patch adds setPrepareThreshold() and getPrepareThreshold() to
PGStatement, PGConnection, and the myriad Datasource implementations. It
also supports setting the threshold via a connection URL (this needs
testing).
The prepare threshold controls automatic use of server-side prepared
statements without the need for a postgresql-specific interface (at least if
you do it via reflection at the datasource level, or via a URL parameter). A
threshold is stored at each level of the datasource/connection/statement
hierarchy; the threshold on datasources and connections controls the initial
threshold of connections and statements (respectively) created from them.
If the prepare threshold of a Statement is 0 (the default) then server-side
prepared statements are not used (equivalent to the current default).
If the prepare threshold of a Statement is some value N > 0, server-side
prepare will be used for that statement on its Nth reuse, assuming the query
is suitable for server-side preparation. This means if N = 1, server-side
prepare is always used (equivalent to PGStatement.setUseServerPrepare(true)
in the current code).
The threshold only really makes sense for PreparedStatements and
CallableStatements as plain Statements can't actually be "reused" -- each
query is independent. Currently, though, no distinction is made i.e. with a
threshold of 1 everything does PREPARE/EXECUTE including queries via the
plain Statement methods.
-O
Attachment | Content-Type | Size |
---|---|---|
preparethreshold.txt | text/plain | 15.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ethan Perry | 2003-12-02 18:57:37 | string character corruption problem and broken connection problem |
Previous Message | Oliver Jowett | 2003-12-02 07:31:54 | Re: autocommit trouble with jdbc on Postgres 7.4 |