Forum: Building VoltDB Applications

Post: Using Dynamic Table names in stored procedure

Using Dynamic Table names in stored procedure
tarun
Apr 30, 2012
Hi

Currently we are trying to create a persistence API for our project which uses VoltDB. We have a requirement to dynamically create Tables at runtime and perform CRUD operations on that table. There is a pre-defined structure for these 'runtime' tables and the umber of tables can grow/shrink over the period of time.

As per my current understanding VoltDB stored Procs will not directly allow me parameterize the table name. Please correct me if I am wrong. Also please let me know what is the best way of solving this problem.

Thanks and Regards,
Tarun
Temp tables
awilson
May 3, 2012
Hi,

You can perform catalog updates and push those updates to the live VoltDB cluster, however this may not be a practical way of doing things within VoltDB.

Could you describe more about why you need to create new temp tables and whether these temp tables have the same or different columns. There may be no need for using temp tables depending on your goals.

Thanks,
Andy
Schema Template replication at run time.
tarun
May 7, 2012
Hi,

You can perform catalog updates and push those updates to the live VoltDB cluster, however this may not be a practical way of doing things within VoltDB.

Could you describe more about why you need to create new temp tables and whether these temp tables have the same or different columns. There may be no need for using temp tables depending on your goals.

Thanks,
Andy


Hi,

Thanks for your response, the use case is that we have a Schema and set of Procedures that we would like to replicate multiple times (Preferably at run time). The different Schema will have same set of Tables and Procedures under different names. The idea is that we should be able to create a new 'namespace' to store our data while utilizing the same DB Cluster.

Regards,
Tarun
Schema Template replication at run time.
awilson
May 7, 2012
Hi,

Thanks for your response, the use case is that we have a Schema and set of Procedures that we would like to replicate multiple times (Preferably at run time). The different Schema will have same set of Tables and Procedures under different names. The idea is that we should be able to create a new 'namespace' to store our data while utilizing the same DB Cluster.

Regards,
Tarun


Hi,

It sounds like you are trying to avoid co-mingling customer data by using namespaces rather than adding a namespace column to your root table and using that as a sort of composite key.

You can do what you are describing through catalog updates, however some updates do require a restart.
Thanks,

Andy