No announcement yet.

are there any other methods without callProcedure to insert data into VoltDB?

  • Filter
  • Time
  • Show
Clear All
new posts

  • are there any other methods without callProcedure to insert data into VoltDB?

    Currently I found the example and other codes that most data inserting are using "callProcedure".
    So can we write some client codes in lower level without callProcedure? because I want to do a generic data import code.
    I don't want to define procedure for each table and just want to import data.

    Does anyone have a practices to do this ?

  • #2
    Hi Simon,

    For each table in your schema, VoltDB automatically generates a procedure TABLENAME.insert. Without having to define a procedure, you can call this "default" procedure to insert one record at a time into the table. Calling this procedure will be faster than calling an AdHoc SQL statement "INSERT INTO tablename (...) VALUES (...)" because the procedure is pre-compiled whereas the SQL statement needs to be parsed and planned.

    Another way of loading data is with the bulk loader API. VoltDB provides few tools that use this API. The simplest is the csvloader, which loads data from CSV files. If you specify a table name on the csvloader command, then it will batch up records that belong in the same partition and call LoadSinglePartitionTable to load a batch of records at a time, which can often be faster than calling the default TABLENAME.insert procedure.

    Another tool is the jdbcloader, which works the same, only it gets its data from a JDBC source database, where it runs a SELECT * FROM tablename query.

    It is also possible to write a custom java application that uses the bulk loader API. This is not very well documented at the moment, but this will soon be addressed.

    Best regards,