I need to speed up inserts into an Ingress VectorWise database, and the documentation shows this:
http://docs.actian.com/ingres-vectorwise/2.5/sql-language-guide/5315-insert
The INSERT statement inserts rows into a table.
This statement has the following format:
[REPEATED]]INSERT INTO [schema.]table_name
[(column {, column})]
[OVERRIDING SYSTEM VALUE | OVERRIDING USER VALUE]
[VALUES (expr{, expr}) {,(expr{ ,expr})} |
[WITH common_table_expression] subselect];
and says:
REPEATED: Saves the execution plan of the insert, which can make subsequent executions faster.
I can not for the life of me get a query using "REPEATED" to execute successfully, and I can't find any examples online using straight up SQL for it. Does anyone have any suggestions on how to get this to work syntactically?
@w00te : Ignore REPEATED. I would rather do something more "radical" if the multi-insertion performance is essential. - I would create a temporary HEAP table (they are the fastest storage type when it comes to insertion) and once I am done inserting bunch (can be MILLIONS) of rows, then I just either MODIFY the table to VECTORWISE or SELECT from it into a
vectorwise
table. If you just select, then perhaps the table does not have to be temporary, it can be a normal table where you temporarily store data. Depends on the use-case.While inserting into the abovementioned HEAP table, use batch processing if possible (Ingres JDBC >= 4.0.1), it can significantly boost the speed of inserting millions of rows (I know it for a fact - I did few tests).
EDIT: Apparently, this will not work with VectorWise. The best approach is to insert straight to a VectorWise table, preferably non-indexed. Use JDBC prepared statement, and batch execution, and you will be fine. Grant's proposal to use CACHE_DYNAMIC should also be considered.