Fork me on GitHub
#sql
<
2021-02-18
>
mathias_dw18:02:39

Hi, I’m using clojure.java.jdbc with jtds in a somewhat older project, and because of some changes in the data volume, the queries are getting way too slow. The reason seems to be this: http://www.jochenhebbrecht.be/site/2014-05-01/java/fixing-slow-queries-running-sql-server-using-jpa-hibernate-and-jtds. If I “manually” plug my parameters into the query, it’s fast again, but I can’t figure out how to pass the property in the connection map.

seancorfield19:02:57

@mathias_dw just add :sendStringParametersAsUnicode false to your db-spec hash map?

mathias_dw19:02:26

oh that’s what i tried but it didn’t speed up in the same way as when i manually inserted them into the query string

mathias_dw19:02:03

but thanks a lot for the quick reply, @seancorfield! I’ll try it again.

mathias_dw19:02:34

(tried again from scratch with the parameter added, but no improvement)

seancorfield19:02:22

Sorry, not sure what to suggest then. Are you building a connection pool, or just relying on c.j.j creating a connection directly from the db-spec hash map?

mathias_dw20:02:14

no worries 🙂 It’s just a connection with the db-spec map. It’s no big deal to manually create the query string, since it’s from a pre-defined list of values.