Fork me on GitHub
#sql
<
2019-07-05
>
gleisonsilva10:07:47

Hi, @seancorfield! I'm starting to look at jdbc.next to migrate some projects where I need the best performance possible, because it has a lot of data migrating from one source to another... in this project I've using jdbc/db-query-with-resultset so that I can get into ResultsetMetadata and extract info about the columns (type, lenght, precision, etc)... with jdbc.next, there is a case for that?

jaihindhreddy12:07:24

^ Won't getting this metadata once per table be faster than once per query?

seancorfield15:07:22

@gleisonsilva I'd have to understand a lot more about your code to be able to comment on that.

seancorfield16:07:02

@gleisonsilva The path I'd suggest is to use plan and perhaps a custom row builder but without knowing more about exactly what you're trying to do, it's hard to offer anything more concrete.

seancorfield18:07:50

Alternatively (`jdbc` here is next.jdbc):

(with-open [con (jdbc/get-connection data-source)]
  (with-open [ps (jdbc/prepare con ["...sql..." params ,,,])]
    (with-open [rs (.executeQuery ps)]
      (f rs))))
But I'd still recommend you try plan and reduce (or some transducing function) with a custom row builder, if needed.

👍 4