Normally when you use JDBC it’s clever to use prepared query statement (with parameter substitution) to not have SQL plan calculation done all the time. Not so with CRDB it seems.
I’ve written a query that gets data from some linked up tables with some subqueries because joins were horribly slow. However, in DBeaver the query is executed within some milliseconds (around 30 or so) which is sufficient for my purpose.
However, executing the very same query with java postgresql driver using hibernate with statement parameters was running about 5 seconds!
After rewriting the query with string concatenation it executes within around 20-40ms again.
I’d call this an unexpected behavior. Can anyone explain that to me? Is it a bug?