Questions tagged [batch-insert]
167 questions
                    
                    92
                    
            votes
                
                7 answers
            
        Java: Insert multiple rows into MySQL with PreparedStatement
I want to insert multiple rows into a MySQL table at once using Java. The number of rows is dynamic. In the past I was doing...
for (String element : array) {
    myStatement.setString(1, element[0]);
    myStatement.setString(2, element[1]);
   …
         
    
    
        Tom Marthenal
        
- 3,066
- 3
- 32
- 47
                    37
                    
            votes
                
                1 answer
            
        ActiveRecord batch insert (yii2)
Is it possible to insert multiple rows in one query with Yii's ActiveRecord? Or is this only possible via the lower-level DAO objects?
I have two models
1- Transaction
2-TransactionItems
There are multiple rows(onclick add row) in transaction…
         
    
    
        user1561346
        
- 502
- 3
- 13
- 28
                    25
                    
            votes
                
                4 answers
            
        Need to insert 100000 rows in mysql using hibernate in under 5 seconds
I am trying to insert 100,000 rows in a MYSQL table under 5 seconds using Hibernate(JPA). I have tried every trick hibernate offers and still can not do better than 35 seconds.  
1st optimisation : I started with IDENTITY sequence generator which…
         
    
    
        Kumar Manish
        
- 1,166
- 1
- 16
- 28
                    24
                    
            votes
                
                5 answers
            
        Batch inserts with JPA/EJB3
Does JPA/EJB3 framework provide standard way to do batch insert operation...?
We use hibernate for persistence framework, So I can fall back to Hibernate Session and use combination session.save()/session.flush() achieve batch insert. But would like…
         
    
    
        Raja
        
- 271
- 1
- 2
- 6
                    20
                    
            votes
                
                5 answers
            
        How to multi insert rows in cassandra
What is the most efficient way of inserting multiple rows in cassandra column family. Is it possible to do this in a single call.
Right now my approach is to addinsert multiple column and then execute. There in a single call I am persisting one row.…
         
    
    
        ajjain
        
- 1,151
- 2
- 15
- 28
                    16
                    
            votes
                
                5 answers
            
        How can I do a batch insert into an Oracle database using Python?
I have some monthly weather data that I want to insert into an Oracle database table but I want to insert the corresponding records in a batch in order to be more efficient.  Can anyone advise as to how I'd go about doing this in Python?
For example…
         
    
    
        James Adams
        
- 8,448
- 21
- 89
- 148
                    14
                    
            votes
                
                5 answers
            
        T-SQL, Insert into with MAX()+1 in subquery doesn't increment, alternatives?
I have a query where I need to "batch" insert rows into a table with a primary key without identity.
--TableA
--PK int (Primary key, no-identity)
--CustNo int
INSERT INTO TableA (PK,CustNo)
  SELECT (SELECT MAX(PK)+1 AS PK FROM TableA), CustNo
 …
         
    
    
        KorsG
        
- 729
- 1
- 7
- 16
                    14
                    
            votes
                
                1 answer
            
        Batch insert in Laravel 5.2
I am using a API's with lot's of calculation almost 100 database fields at the end with a big Foreach loop. 
In every iteration i insert data in database. I want to insert data in once at the end (Batch Insert like in CodeIgniter). 
Any body have…
         
    
    
        Irfan Ali
        
- 201
- 1
- 3
- 5
                    14
                    
            votes
                
                5 answers
            
        How to perform batch update in Spring with a list of maps?
New to Spring, I am trying to insert a List
         
    
    
        Mono Jamoon
        
- 4,437
- 17
- 42
- 64
                    13
                    
            votes
                
                3 answers
            
        Hibernate - how to verify if batch insert is really performed
Technology stack: Oracle database 11.2.0.2, Java 1.6, Hibernate 3.6.6.Final.
I am new to hibernate, apologize if this is trivial.
The following code was supposed to put some optimization:
Transaction tx = session.beginTransaction();
for (int i = 0;…
         
    
    
        Łukasz
        
- 1,980
- 6
- 32
- 52
                    12
                    
            votes
                
                3 answers
            
        Massive insert with JPA + Hibernate
I need to do a massive insert using EJB 3, Hibernate, Spring Data and Oracle. Originally, I am using Spring Data and code is below:
talaoAITDAO.save(taloes);
Where talaoAITDAO is a Spring Data JpaRepository subclass and taloes is a Collection of…
         
    
    
        Rafael Afonso
        
- 595
- 1
- 10
- 28
                    12
                    
            votes
                
                2 answers
            
        How to get generated keys from JDBC batch insert in Oracle?
I am inserting many records using JDBC batch inserts. 
Is there any way to get the generated key for each record?
Can I use ps.getGeneratedKeys() with batch inserts?
I am using oracle.jdbc.OracleDriver 
final String insert = "Insert into…
         
    
    
        atripathi
        
- 898
- 3
- 11
- 17
                    9
                    
            votes
                
                4 answers
            
        Inserting large number of records without locking the table
I am trying to insert 1,500,000 records into a table. Am facing table lock issues during the insertion. So I came up with the below batch insert. 
DECLARE @BatchSize INT = 50000
WHILE 1 = 1
  BEGIN
      INSERT INTO [dbo].[Destination] 
           …
         
    
    
        Pரதீப்
        
- 91,748
- 19
- 131
- 172
                    8
                    
            votes
                
                3 answers
            
        Codeigniter Insert Multiple Rows in SQL
I am fresh to Codeigniter. I have  a form which looks something like this.  
        
            
            
                
                    
    
    
         
    
    
                
            
        
    
                    
                
                    
                    
    
        
            
                
            
    
    
        
        
            
            
                
                    
    
    
         
    
    
                
            
        
    
                    
                
                
            
        
            
        
        
        
        
      
 
    
    
        Mr Hyde
        
- 3,393
- 8
- 36
- 48
                    8
                    
            votes
                
                1 answer
            
        JPA(Hibernate) and postgres sql batch upsert using nativequery
I would like to perform a batch upsert with JPA and Postgres. I can't use merge as I am checking conflict on a Unique Constraint which is not PK. I found that to upsert in postgres we can now use the ON Conflict functionality. So basically I would…
         
    
    
        Saikat Ganguly
        
- 113
- 1
- 6