Multi-row INSERTs to distributed tables?

103 views
Skip to first unread message

Mario Sanz Rodrigo

unread,
May 20, 2016, 6:00:19 AM5/20/16
to citus-users
Hi,

Is it possible to make multiple insertions citus 5.1?

I'm trying INSERT with this code:

CREATE TABLE test(
id INT,
valor INT,
PRIMARY KEY(id)
);

SELECT * FROM master_create_distributed_table('test','id','hash')
INSERT INTO test VALUES (1,1),(2,2),(3,3),(4,4)....

-> ERROR:  cannot perform distributed planning for the given modification
-> DETAIL:  Multi-row INSERTs to distributed tables are not supported.

Is there any way to insert multiple values in a distributed table with a single query POSTGRESQL?

Regadrs,

Mario ;)

Metin Doslu

unread,
May 20, 2016, 6:36:58 AM5/20/16
to Mario Sanz Rodrigo, citus-users
Hi Mario,

Thank you for your interest in Citus. We have an issue on GitHub to track this feature. How critical is this feature for you? Please feel free to comment on the GitHub issue to share your use-case.

Thanks,
Metin

--
You received this message because you are subscribed to the Google Groups "citus-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to citus-users...@googlegroups.com.
To post to this group, send email to citus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/citus-users/53ac2adc-1391-4136-ae91-f0a704ff9729%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Metin Doslu

unread,
May 20, 2016, 6:39:33 AM5/20/16
to Mario Sanz Rodrigo, citus-users
I forgot to add the link to the issue.

Mario Sanz Rodrigo

unread,
May 20, 2016, 6:45:57 AM5/20/16
to citus-users
Hi Metin,

Can you send me the link of GitHub where track this feature?

Currently I integrated Citus in my app. 

This app insert multi-row values on postgres db. 

I chose Citus because i want optimize the hash search, but before of the search i need insert data on my db, and my problem is the insertion on the distributed tables

Regads,

Mario

Metin Doslu

unread,
May 20, 2016, 6:48:03 AM5/20/16
to Mario Sanz Rodrigo, citus-users
Here is the link. Somehow, I failed to send it in the very first email.

Eugen Konkov

unread,
May 24, 2016, 1:25:28 PM5/24/16
to citus-users

If you want import test data into citus onetime you may try to run 'COPY ... TO file' at your DB and then 'COPY ... FROM...' at master node.

As workaround you should insert data row by row.

Also you should pay attention that citus does not support parametrized queries.

Mario Sanz Rodrigo

unread,
May 26, 2016, 6:33:22 AM5/26/16
to citus-users
Hi Eugen, in this case my app has to insert data to the database in real time. Because i can't load data with command "COPY ... TO file', 

I have to insert with the next command "INSERT INTO mytable VALUES('something','something')", really i want to try INSERT on my distributed table with the next command "INSERT INTO mytable VALUES ('something1','something1'), ('something2','something2'), ('something3','something3')......."

Regads,

Mario

Jason Petersen

unread,
May 31, 2016, 1:56:58 PM5/31/16
to citus-users
Hey Mario,

Sorry that the workaround isn't a tenable solution for you; we know it adds extra complexity, and as Metin pointed out above, we're already tracking this need in a GitHub ticket. Thanks for the feedback, it helps us prioritize these things!
Reply all
Reply to author
Forward
0 new messages