Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve batching performance on Oracle #469
Since Oracle does not support getColumnType(int), querydsl-sql always uses the JDBC type NULL when setting null parameters. This significantly degrades batch insert/update performance. Here's why:
Let's take this simple statement:
When this statement is first parametrized with a string and then parametrized with a null, Oracle will not do a batch insert. Instead it will treat it as two different statements because of the different types (varchar and null).
Now you can imagine that this gets worse the more nullable columns you have, because pretty much each insert will be different. This gets to the point where performance is as low as with no batching at all.
I have worked around this by having a special Null type which remembers the Path it came from. The handler of this type then uses the (private) method of the Configuration class to ask for the correct handler for this Path's type and then asks that handler for its JDBC type. Pretty hacky, I know...
This is again something that could probably be solved with column metadata. This way, we could ask a path for its JDBC type and use that as a parameter for the Null value.
No, but I have used sql_trace to look at what the database did with my inserts. When using setNull(index, Types.NULL), each statement was parsed and executed one by one. When using the correct JDBC type for each column, all statements were executed in a single batch.
added a commit
Aug 2, 2013
The NullTypes have now been removed and the typed null setting is used, when the type is available. Could you try again with the latest SNAPSHOT from here https://oss.sonatype.org/content/repositories/snapshots/