Announcement Announcement Module
No announcement yet.
What is the best way to do BULK INSERT ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • What is the best way to do BULK INSERT ?

    I'm trying to make an app that can save a lot of structured objects in the database.
    Now I am using Spring Data JPA (with hibernate + MySQL (MyIsam tables + foreign keys))
    Write code for data services is easy and pleasant using Spring Data repositories but performance is too slow.

    For example, I tried to insert 100 records in one table and it takes for a 8,5 sec.

    I've try to do the same insert operations straight in MySQL cmd (using hardcoded "insert strings" in a procedure) and it shows me time - 0,85 sec. Even such a result for me is too slow, but this is the problem of MySQL

    Reading the forum I have found the post
    witch says that Spring Data JPA can't do the bulk insert properly.

    How can I make my app more faster? I want to use bulk INSERT operations with size like a 1000 or more.

    The situation is complicated by the fact that I can't store my object to db in one bulk (despite the size of bulk)

    To make it clearer:
    • The objectGame contains list of objectRound
    • The objectGame also contains list of objectGamePlayer
    • The objectRound contains list of objectRoundCard
    • The objectGamePlayer contains list of objectPlayerCard
    • The objectGamePlayer also contains list of objectPlayerBet
    Of course, to insert an objectGame it needs to make several steps:
    1. Insert bulk of objectGame and get their Ids
    2. Having objectGame's Ids insert bulk of objectRound and get their Ids
      ... and so on

    Witch way is more appropriate for me?
    Use Spring Data JPA, jdbc, hibernate, myBatis? Or another way ?

  • #2
    here is a part of db schema
    Attached Files