Hi Henrik,
I am unconvinced that the JDBC Store node is not the better option, but I'll answer. I have not tested to see if this approach to creating that SQL insert statement is faster.
I often run across the need to build a single string value using a concatenated lest of values from multiple records like you are describing, I've started structuring it like this:
In ConfigureFields I define an empty Python List object:
In the ProcessRecords property I append() all the values to this list, and then at the end I have Python create the string from the values in the list. Python has a very nice syntax for doing this using the join() method.
Back to your question, I am wondering if there is some sort of limit on the number of entries that are reasonable to put together in a list. Maybe breaking it up into 1000 record insert statements would be better for the database to manage.
And the reason I wonder if the JDBC Store node would not be better is I wonder if you've tried to use the Optional properties that can make it run faster. Maybe the Commit Frequency needs to be increased to 10,000 or 100,000.
------------------------------
Ernest Jones
Precisely Software Inc.
PEARL RIVER NY
------------------------------
Original Message:
Sent: 03-22-2024 06:39
From: Henrik B
Subject: Batch insert query optimization
Hello, i want to use the dbexecute and not the db store node to do a batch insert of rows.
So assume the following scenario:
In this case i only have two rows, i want to make into one single insert statement as per below:
This method is very costly, if i want to insert a big number of rows, especially the part in the transform node where i try to concatenate all incoming rows into one single insert statement.
One work around is to save it as an excel file, then read it in an input raw node, but it would be nice to avoid this and have a simpler solution.
Is there a way to make this work, if i want to combine a big amount of input rows into one single row statement as per above?
Best regards
Henrik Borg
------------------------------
Henrik B
E.ON Sverige
------------------------------