Giter Club home page Giter Club logo

Comments (5)

csummers avatar csummers commented on June 25, 2024

The Tuple List Parameter supports multi-record insert for the INSERT...VALUES (...),(...) syntax, but you can still hit some JDBC driver limits with this, which is what is happening here. The limits may be higher with other database drivers.

For these kinds of batch cases, you can map or doseq through your batch calling your single-record insert or multi-record insert (cut up your batch with partition-all).

On the other hand, I say know your tools and use them to their full extent. Using clojure.java.jdbc/insert! is fine. It's already internally mapping over insert-single-row-sql, so why not use it instead of needing to write your own?

But, I can see how this is confusing, and I think this at least needs some more documentation with an example or two.

from hugsql.

jbaiter avatar jbaiter commented on June 25, 2024

Thanks for the clarification! I had a solution with map-ing over the single insert statement before and I was under the impression that the insert! method was faster, but that may just as well have been the placebo effect, I did not do any proper profiling.
Also, thank you for creating the library, I've been looking for a replacement to yesql and this looks very much like it :-)

from hugsql.

csummers avatar csummers commented on June 25, 2024

Thanks again for the report!

from hugsql.

csummers avatar csummers commented on June 25, 2024

...I was under the impression that the insert! method was faster, but that may just as well have been the placebo effect...

insert! may have been faster if it was a single transaction and your map-ing solution was multiple transactions. See Transactions.

from hugsql.

mikeball avatar mikeball commented on June 25, 2024

I was curious on the actual limit of parameters. It looks like ~32k for postgresql, and ~2k for sql server.

http://www.postgresql.org/message-id/[email protected]
http://stackoverflow.com/questions/14631346/java-jdbc-prepared-statement-maximum-parameter-markers

edit: Also mentioned in the SO post is that for postgres, before 9.4 every record in a batch did a round trip if a generated key was returned. Am I reading that right? Or is that a different kind of jdbc "batch"?

from hugsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.