Showing posts with label performance. Show all posts
Showing posts with label performance. Show all posts

Thursday, August 27, 2015

PostgreSQL JDBC Driver Version 9_4_1202 released


Lots of bug fixes and some awesome performance enhancements, including statement caching

Version 9.4-1201 (2015-02-25)

Author: Alexis Meneses
  • ResultSet positioning methods in some particular cases PR #296 (282536b)
Author: Craig Ringer
  • Disable binary xfer on batches returning generated keys PR #273 (763ae84)
  • Add a new test case demonstrating a bug in returning support PR #273 (4d2b046)
  • Always Describe a query in a batch that returns generated keys PR #273 (a6bd36f)
Author: Dave Cramer
  • chore: fix build.xml to allow releasing to maven PR #262 (34f9361)
  • fix: BlobInputStream ignores constructor parameters #263 PR #273 (c1c6edc)
  • don't reset forceBinary transfer if we setPreparedThreshold (937a11c)
  • Revert "perf: Remove expensive finalize methods from Statement and Connection" PR #293 (a0d3997)
  • updated copyright PR #312 (263375c)
  • Revert "Issue 250 -- Adding setURL/getURL to BaseDataSource.java" PR #312 (a1ac380)
  • fixed mailing list href PR #326 (c3e86a6)
  • increment driver version PR #346 (b8ee75d)
Author: David R. Bild:
  • feat: add equality support to PSQLState PR #277 (7698cd9)
  • Improve version checking PR #355 (f7a84db)
Author: Eugene Koontz
  • Add support within "private Object buildArray (PgArrayList input, int index, int count)" for array elements whose type is jsonb PR #349 (d313138)
Author: Jeremy Whiting
  • Added setter method for logging level. The method exactly matches property name in documentation. PR #282 (d9595d1)
  • Added getter method. PR #282 (65759f0)
  • Adding XML catalog to help unit tests not remote entity resolution. PR #284 (cb87067)
  • Added support to locally resolve dtd or entity files. PR #284 (017970d)
  • Disable verbose logging of the catalog resolver. PR #284 (fcc34f5)
Author: Kris Jurka
  • Improve error message for failure to update multicolumn primary key RSs. PR #284 (05ff811)
  • Remove all JDBC3 code as JDK 1.4/1.5 are no longer supported. PR #284 (f9a956b)
  • Add preliminary support for JDBC4.2. PR #284 (bd05fd2)
Author: Lonny Jacobson
  • Added setURL/getURL methods. (fcc8f75)
  • Added a unit test for setURL PR #309 (5fa405b)
Author: Markus KARG
  • perf: use shared PGBoolean instances PR #321 (159fed6)
  • docs: parameter "database" is optional PR #332 (9a9d03f)
  • refactor: binary transfer for setObject(int, Object, int) PR #351 (3ff2129)
Author: Michael Paquier:
  • Update entries in lib/.gitignore PR #262 (8cd15a9)
Author: Phillip Ross
  • Fix for issue https://github.com/pgjdbc/pgjdbc/issues/342 - Modifications to PGline to store coefficients and constant value for linear equation representations used by postgresql for native line datatype. PR #343 (0565416)
  • Fix for issue https://github.com/pgjdbc/pgjdbc/issues/342 - Removed extra copyright comments. PR #343 (5f21a18)
  • Fix for issue https://github.com/pgjdbc/pgjdbc/issues/342 - Handle vertical lines. PR #343 (3918b24)
  • Fix for issue https://github.com/pgjdbc/pgjdbc/issues/342 - Added test method for testing PGline PR #343 (1a50585)
  • Fix for issue https://github.com/pgjdbc/pgjdbc/issues/342 - Modifications to PGline test method to only attempt database access if the postgresql version supports it (v9.4+). PR #343 (15eedb5)
Author: Rikard Pavelic
  • feat: Improved composite/array type support and type naming changes. PR #333 (cddcd18)
  • Deadlock after IO exception during copy cancel PR #363 (d535c13)
Author: Sehrope Sarkuni
  • style: clean up newline whitespace PR #273 (1b77b4c)
  • style: clean up whitespace in .travis.yml PR #274 (3ee5bbf)
  • fix: correct incorrect PG database version in .travis.yml matrix PR #274 (74b88c6)
  • style: reorder jdk versions in .travis.yml PR #274 (21289e7)
  • feat: add PostgreSQL 9.4 to .travis.yml matrix PR #274 (9e94f35)
  • feat: add escapeLiteral(...) and escapeIdentifier(...) to PGConnection PR #275 (096241f)
Author: Stephen Nelson
  • Replace for loops with Java 5-style for loops. Replace String.indexOf with String.contains. Replace StringBuffer with StringBuilder. Remove boxing/unboxing of primitives. PR #245 (206a542)
  • feat: Customize default fetchSize for statements PR #287 (093a4bc)
  • feat: Customize default fetchSize for statements PR #287 (519bfe1)
  • perf: Read test only property "org.postgresql.forceBinary" spend many time when creating statements PR #291 (e185a48)
  • perf: Remove expensive finalize method from Statement Finalize method on Statement is moved to a separate class that is lazily created if user sets "autoCloseUnclosedConnections"="true". This dramatically improves performance of statement instantiation and reduces garbage collection overhead on several wildly used JMVs. PR #290 (eb83210)
  • docs: fix misleading statement on "can't use jdk5 features" in README.md PR #298 (5b91aed)
  • feat: implement micro-benchmark module for performance testing PR #297 (48b79a3)
  • feat: add benchmark for Parser.unmarkDoubleQuestion PR #297 (e5a7e4e)
  • feat: improve sql parsing performance PR #301 (fdd9249)
  • perf: Remove AbstractJdbc2Statement.finalize() PR #299 (b3a2f80)
  • test: add test for prepare-fetch-execute performance PR #303 (d23306c)
  • perf: improve performance of preparing statements PR #303 (7c0655b)
  • test: add test for utf8-encoder performance PR #307 (6345ab1)
  • perf: improve performance of UTF-8 encoding PR #307 (f2c175f)
  • perf: skip instantiation of testReturn and functionReturnType for non-callable statements PR #323 (8eacd06)
  • perf: parse SQL to a single string, not a array of fragments PR #319 (4797114)
  • perf: cache parsed statement across .prepareStatement calls PR #319 (5642abc)
  • refactor: cleanup constructors of JDBC4 and JDBC42 connections/statements PR #318 (a4789c0)
  • refactor: use Dequeue<...> instead of raw ArrayList in v3.QueryExecutorImpl PR #314 (787d775)
  • perf: SimpleParameterList.flags int[] -> byte[] PR #325 (f5bceda)
  • perf: cut new byte[1] from QueryExecutorImpl.receiveCommandStatus PR #326 (0ae1968)
  • perf: avoid useBinary(field) check for each sendBind PR #324 (45269b8)
  • refactor: cleanup Parser and NativeQuery after #311 PR #346 (a1029df)
  • refactor: cleanup Parser and CallableQueryKey after #319 PR #346 (5ec7dea)
  • perf: skip caching of very large queries to prevent statement cache pollution PR #346 (126b60c)
  • use current_schema() for Connection#getSchema PR #356 (ffda429)
  • chore: simple script to compose release notes PR #357 (341ff8e)
  • chore: teach release_notes.sh to identify PR ids out of merge commits PR #358 (f3214b1)

Thursday, August 28, 2008

groovy scripting for postgres

I've been playing around with reindexing based on index fragmentation. Wrote the following code

package com.postgresintl;

import groovy.sql.Sql
import org.apache.log4j.Logger


class Reindex
{
private static final Logger logger = Logger.getLogger(Reindex.class)

def sql,host,database,threads

public getIndexes( int fragmentation )
{
def indexes = []
def sql1 = new Sql(sql.getConnection())

sql.eachRow('select indexrelname from pg_stat_user_indexes') { row ->
println "checking ${row.indexrelname}"
sql1.eachRow("select * from pgstatindex(${row.indexrelname}) where leaf_fragmentation >= ${fragmentation}") { stats ->
println "adding $stats"
indexes << row.indexrelname

}
}
// sql1.close()
return indexes
}

def reindex = {indexes->
println "starting thread"
def index
def sqlInstance = Sql.newInstance("jdbc:postgresql://$host/$database",'postgres','','org.postgresql.Driver')
try
{
while (indexes.size() > 0)
{
synchronized(indexes)
{
def last = indexes.size
if ( last > 0)
index = indexes.remove(last-1)
}
def reindexCommand = 'reindex index ' + index
println reindexCommand
try
{
sqlInstance.execute(reindexCommand)
}
catch( Exception ex)
{
ex.printStackTrace()
println "error reindexing $index"
}

}
}
finally
{
sqlInstance.close()
}
}

public reindex( List indexes )
{

indexes.each(){ index ->
try {
println "reindexing $index"

def reindexCommand = 'reindex index ' + index
println reindexCommand
sql.execute(reindexCommand)
}
catch( Exception ex )
{
println "error indexing $index"
}
}

}

public emailReindex()
{
def ant = new AntBuilder()
ant.mail( mailhost:'beaver.fastcrypt.com', mailport:25,
subject:'Reindex Job'){
from(address:'davec@postgresintl.com')
to(address:'davec@postgresintl.com')
message("Reindexed ")
}
}
public Reindex()
{}

public Reindex( String host, String database, String threads)
{
this.host = host
this.database= database
this.threads=threads

sql = Sql.newInstance("jdbc:postgresql://$host/$database",'postgres','','org.postgresql.Driver')
}
public void closeConnection()
{
sql.close()
}

static void main(args)
{
if ( args.length <= 1)
{
println "$args usage Reindex "
return
}
def host = args[0]
def database= args[1]
def threads = args[2]

println "host:$host, database:$database, threads:$threads"

def reindex = new Reindex(host, database, threads)
def indexes = reindex.getIndexes(20)

5.times {
Thread.start reindex.reindex.curry(indexes)
}

//reindex.reindex reindex.getIndexes(30);
reindex.emailReindex()
reindex.closeConnection()
}

}