Add support for IN-lists padding to better reuse cached statements

Description

As described in this Twitter thread, we could add a new feature which generates power-of-2 IN lists so we get a better chance of reusing the execution plan, especially on Oracle and SQL Server.

So, let's assume we have the following 3 SELECT queries executed:

We can rewrite them as:

This way we reuse the same cached statement:

Environment

None

Activity

Show:
Vlad Mihalcea
October 1, 2018, 5:28 PM

Will that for for every DB supported by Hibernate? There's a Pull Request similar to what you've been asking. You might want to follow it for more details.

Mirek Sz
October 1, 2018, 5:19 PM

Why not simple use java.sql.Connection.createArrayOf().
We can have one prepere statment
https://stackoverflow.com/questions/50083516/jdbc-createarrayof-from-arraylist

Vlad Mihalcea
April 27, 2018, 3:02 PM

Applied PR upstream.

Fixed

Assignee

Vlad Mihalcea

Reporter

Vlad Mihalcea

Fix versions