Quantcast
Channel: Database Design forum
Viewing all articles
Browse latest Browse all 2729

Graph Database:Edge table data insertion and modifying process concern

$
0
0
I have one existing database from which i want to create graph database because my existing database has millions of data so creating graph database will help me to manage relationship easily and get faster data execution.

But here, i have confusion regarding how the data can be insert into edge table when we have large number(in millions) of data into node tables.

Let's say an example: I have two node tables in my database: 1) Customer_Node and 2) CustomerDevice_Node.  

From them i want to create edge table which gives relationship between them.Let's say Have_Edge is the edge table.

I have thousands of data into Customer and CustomerDevice table.I can make node tables easily and also can insert the data into those tables But while i'm creating Edge tables,at that time it only allows to insert one record at a time.

For example:

INSERT INTO Have_Edge ($from_id, $to_id) VALUES
 ((SELECT $node_id FROM  CUSTOMER_NODE WHERE CUSTOMERID=14),(SELECT $node_id FROM  CUSTOMERDEVICE_node WHERE CUSTOMERDEVICEID=2)),
((SELECT $node_id FROM  CUSTOMER_NODE WHERE CUSTOMERID=14),(SELECT $node_id FROM  CUSTOMERDEVICE_node WHERE CUSTOMERDEVICEID=23)),
((SELECT $node_id FROM  CUSTOMER_NODE WHERE CUSTOMERID=14),(SELECT $node_id FROM  CUSTOMERDEVICE_node WHERE CUSTOMERDEVICEID=30)),

...

...

... so on.

So is there any easy way to insert the data into edge table without writing the statement every time for each record(Like bulk insert into with one query)?Because day by day my data has been increasing so it will become tough to make one by one select statement and then insert the records into edge table.

Further,There are some tables also there which have millions of data.

Can anyone help me out?

Viewing all articles
Browse latest Browse all 2729