Oracle Spatial and Graph – technical tips, best practices, and news from the product team

Oracle's Property Graph Database in Shining Armor (5)

Alan Wu

This is the fifth installment of the series "Oracle's Property Graph Database in Shining Armor." In this blog, I am going to talk about fast property graph data loading using the built-in Java APIs on Oracle Database Cloud Service Bare Metal. Click 1, 2, 3, 4 for previous installments. The following is a code snippet running in Groovy. You can take it out and embed it in your Java application (with very minor changes including type declaration) if needed.

-- Step 1: create a partitioned graph. 16 partitions are used.

oracle=new Oracle("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=g.subnet201703141927320.graphdbnet1.oraclevcn.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=pdb1.subnet201703141927320.graphdbnet1.oraclevcn.com)))","pg", "<PASSWORD_HERE>");
opg=OraclePropertyGraph.getInstance(oracle, "lj", 16 /*iHashPartitionsNum*/);

-- Step 2: create an instance of OraclePropertyGraph

cfg = GraphConfigBuilder.forPropertyGraphRdbms().setJdbcUrl("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=g.subnet201703141927320.graphdbnet1.oraclevcn.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=pdb1.subnet201703141927320.graphdbnet1.oraclevcn.com)))") .setUsername("pg").setPassword("<PASSWORD_HERE>") .setName("lj") .setMaxNumConnections(16) .setLoadEdgeLabel(false).addEdgeProperty("weight", PropertyType.DOUBLE, "1000000")  .build();

-- Step 3: load in parallel the LiveJ in .opv/.ope format (compressed)

opg-oracledb> opgdl=OraclePropertyGraphDataLoader.getInstance();
opg-oracledb> vfile="/home/oracle/liveJ.opv.gz"  // vertex flat file
opg-oracledb> efile="/home/oracle/liveJ.ope.gz"  // edge flat file
opg-oracledb> lStarttime=System.currentTimeMillis();

opg-oracledb> opgdl.loadDataWithSqlLdr(opg, "pg", "<PASSWORD_HERE>", "orcl122", vfile, efile, 32/*dop*/, true/*bNamedPipe*/, "/u01/app/oracle/product/", true, "PDML=T,PDDL=T,NO_DUP=T,");

opg-oracledb> System.out.println("total ms " + (System.currentTimeMillis() - lStarttime));
total ms 308560

opg-oracledb> opg.countEdges()

All done. The above API completed loading LiveJ graph (with 68.99M edges) in just 308 seconds. And this time included building a few unique key indexes and B*Tree indexes.




Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.