├── neo4j ├── neo4j-ldbc-benchmark │ ├── .gitignore │ ├── queries │ │ ├── warm.cypher │ │ ├── query13.cypher │ │ ├── query8.cypher │ │ ├── query5.cypher │ │ ├── query4.cypher │ │ ├── query11.cypher │ │ ├── query12.cypher │ │ ├── query6.cypher │ │ ├── query2.cypher │ │ ├── query9multihop1.cypher │ │ ├── query9multihop2.cypher │ │ ├── query9multihop3.cypher │ │ ├── query9multihop4.cypher │ │ ├── query9multihop5.cypher │ │ ├── query7.cypher │ │ ├── query14.cypher │ │ ├── query10 _with_birthdays.cypher │ │ ├── query3.cypher │ │ ├── query10.cypher │ │ └── query1.cypher │ ├── bulk_benchmark.sh │ ├── query_benchmark.sh │ └── split_benchmark.sh ├── neo4j-ldbc-ingester │ ├── ldbcIO │ │ ├── .gitignore │ │ ├── definitions │ │ │ ├── __init__.py │ │ │ ├── .gitignore │ │ │ └── Definitions.py │ │ ├── __init__.py │ │ ├── LDBCDialect.py │ │ ├── CSVHandler.py │ │ └── TemplateManager.py │ ├── ldbcdatastructures │ │ ├── .gitignore │ │ ├── __init__.py │ │ ├── Email.py │ │ ├── Place.py │ │ ├── Language.py │ │ ├── Organisation.py │ │ └── Person.py │ ├── .gitignore │ ├── bulk_ingester.sh │ └── change_headers.sh └── conf │ ├── neo4j.properties │ └── neo4j-wrapper.conf ├── vertica ├── vertica-ldbc-ingester │ ├── ldbcIO │ │ ├── definitions │ │ │ ├── __init__.py │ │ │ └── Definitions.py │ │ ├── __init__.py │ │ └── TemplateManager.py │ ├── VerticaIngestScript.py │ └── gen_ingestion.sh ├── queries │ ├── clear_cache.sql │ ├── vertica_ips.props │ ├── query2.sql │ ├── query9multihop1.sql │ ├── query8.sql │ ├── batchtest.sh │ ├── query11.sql │ ├── query9.sql │ ├── query9multihop2.sql │ ├── query6.sql │ ├── query_test.sh │ ├── run_designer.sh │ └── query9multihop3.sql └── readme.md ├── results ├── raw │ ├── vertica │ │ ├── migration_time.csv │ │ ├── untuned │ │ │ ├── 100G │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop5 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ └── result_query9multihop4 │ │ │ ├── 10G │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ ├── 1G │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ ├── 30G │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ └── 3G │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop4 │ │ │ │ ├── result_query9multihop3 │ │ │ │ └── result_query9multihop5 │ │ └── migration_size.csv │ ├── neo4j │ │ ├── migration_time.csv │ │ ├── tuned │ │ │ ├── 10G │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ ├── 1G │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ ├── 30G │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ ├── 3G │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ └── 100G │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ ├── untuned │ │ │ ├── 1G │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ ├── 10G │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ ├── 30G │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ ├── 3G │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ │ └── 100G │ │ │ │ ├── result_query11 │ │ │ │ ├── result_query6 │ │ │ │ ├── result_query8 │ │ │ │ ├── result_query2 │ │ │ │ ├── result_query9multihop1 │ │ │ │ ├── result_query9multihop2 │ │ │ │ ├── result_query9multihop3 │ │ │ │ ├── result_query9multihop4 │ │ │ │ └── result_query9multihop5 │ │ └── migration_size.csv │ └── sqlgraph │ │ ├── migration_time.csv │ │ ├── untuned │ │ ├── 1G │ │ │ ├── result_query8 │ │ │ ├── result_query11 │ │ │ ├── result_query6 │ │ │ ├── result_query2 │ │ │ ├── result_query9multihop1 │ │ │ ├── result_query9multihop2 │ │ │ ├── result_query9multihop3 │ │ │ ├── result_query9multihop5 │ │ │ └── result_query9multihop4 │ │ ├── 100G │ │ │ ├── result_query8 │ │ │ ├── result_query6 │ │ │ ├── result_query11 │ │ │ ├── result_query2 │ │ │ ├── result_query9multihop5 │ │ │ ├── result_query9multihop1 │ │ │ ├── result_query9multihop2 │ │ │ ├── result_query9multihop3 │ │ │ └── result_query9multihop4 │ │ ├── 10G │ │ │ ├── result_query11 │ │ │ ├── result_query6 │ │ │ ├── result_query8 │ │ │ ├── result_query2 │ │ │ ├── result_query9multihop1 │ │ │ ├── result_query9multihop2 │ │ │ ├── result_query9multihop3 │ │ │ ├── result_query9multihop4 │ │ │ └── result_query9multihop5 │ │ ├── 30G │ │ │ ├── result_query6 │ │ │ ├── result_query8 │ │ │ ├── result_query11 │ │ │ ├── result_query2 │ │ │ ├── result_query9multihop5 │ │ │ ├── result_query9multihop1 │ │ │ ├── result_query9multihop2 │ │ │ ├── result_query9multihop3 │ │ │ └── result_query9multihop4 │ │ └── 3G │ │ │ ├── result_query11 │ │ │ ├── result_query6 │ │ │ ├── result_query8 │ │ │ ├── result_query2 │ │ │ ├── result_query9multihop1 │ │ │ ├── result_query9multihop2 │ │ │ ├── result_query9multihop3 │ │ │ ├── result_query9multihop4 │ │ │ └── result_query9multihop5 │ │ └── migration_size.csv ├── images │ ├── query2.png │ ├── query6.png │ ├── query8.png │ ├── query11.png │ ├── query9-1.png │ ├── query9-2.png │ ├── query9-3.png │ ├── query9-4.png │ ├── query9-5.png │ ├── database_size.png │ └── migration_time.png ├── readme.md ├── app.R └── result_loader.R └── sqlgraph ├── resources ├── my.cnf ├── setup_perf.sql ├── queries │ ├── query9multihop1.sql │ ├── query2.sql │ ├── query8.sql │ ├── query9.sql │ ├── query9multihop2.sql │ ├── query4.sql │ ├── query11.sql │ ├── query7.sql │ ├── query9multihop3.sql │ └── query10.sql └── ldbc.ddl └── script └── normalise.py /neo4j/neo4j-ldbc-benchmark/.gitignore: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcIO/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcIO/definitions/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vertica/vertica-ldbc-ingester/ldbcIO/definitions/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcIO/definitions/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcdatastructures/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /vertica/queries/clear_cache.sql: -------------------------------------------------------------------------------- 1 | \o /dev/null 2 | select clear_caches(); 3 | \o 4 | -------------------------------------------------------------------------------- /vertica/queries/vertica_ips.props: -------------------------------------------------------------------------------- 1 | 172.27.1.81 2 | 172.27.1.82 3 | 172.27.1.83 4 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | neo4j-ldbc-ingestor.iml 3 | ingestion.cypher 4 | -------------------------------------------------------------------------------- /vertica/vertica-ldbc-ingester/ldbcIO/__init__.py: -------------------------------------------------------------------------------- 1 | from TemplateManager import TemplateManager 2 | -------------------------------------------------------------------------------- /results/raw/vertica/migration_time.csv: -------------------------------------------------------------------------------- 1 | 1GB, 39 2 | 3GB, 100 3 | 10GB, 291 4 | 30GB, 904 5 | 100GB, 2803 6 | -------------------------------------------------------------------------------- /results/images/query2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/query2.png -------------------------------------------------------------------------------- /results/images/query6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/query6.png -------------------------------------------------------------------------------- /results/images/query8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/query8.png -------------------------------------------------------------------------------- /results/raw/neo4j/migration_time.csv: -------------------------------------------------------------------------------- 1 | "1GB",78 2 | "3GB",207 3 | "10GB",770 4 | "30GB",2084 5 | "100GB",6988 6 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/10G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",5221 3 | "2",425 4 | "3",202 5 | "4",200 6 | "5",220 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/10G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",648 3 | "2",363 4 | "3",346 5 | "4",311 6 | "5",372 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/1G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",566 3 | "2",272 4 | "3",237 5 | "4",156 6 | "5",147 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/1G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",2891 3 | "2",858 4 | "3",739 5 | "4",752 6 | "5",809 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/1G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1108 3 | "2",303 4 | "3",204 5 | "4",119 6 | "5",119 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/1G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",497 3 | "2",287 4 | "3",284 5 | "4",257 6 | "5",235 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/30G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",6336 3 | "2",536 4 | "3",362 5 | "4",329 6 | "5",360 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/30G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",819 3 | "2",566 4 | "3",478 5 | "4",500 6 | "5",518 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/3G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1110 3 | "2",482 4 | "3",419 5 | "4",405 6 | "5",393 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/3G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",5939 3 | "2",246 4 | "3",122 5 | "4",119 6 | "5",117 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/3G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",527 3 | "2",319 4 | "3",290 5 | "4",268 6 | "5",258 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/1G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",5388 3 | "2",303 4 | "3",196 5 | "4",123 6 | "5",92 7 | -------------------------------------------------------------------------------- /results/images/query11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/query11.png -------------------------------------------------------------------------------- /results/images/query9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/query9-1.png -------------------------------------------------------------------------------- /results/images/query9-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/query9-2.png -------------------------------------------------------------------------------- /results/images/query9-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/query9-3.png -------------------------------------------------------------------------------- /results/images/query9-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/query9-4.png -------------------------------------------------------------------------------- /results/images/query9-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/query9-5.png -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/100G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1193 3 | "2",978 4 | "3",991 5 | "4",1043 6 | "5",9247 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/10G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",5191 3 | "2",421 4 | "3",385 5 | "4",447 6 | "5",400 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/10G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",16015 3 | "2",2029 4 | "3",6006 5 | "4",6121 6 | "5",6049 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/30G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",9123 3 | "2",771 4 | "3",712 5 | "4",686 6 | "5",730 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/3G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",12208 3 | "2",2029 4 | "2",6498 5 | "4",6071 6 | "5",3714 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/10G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",5485 3 | "2",661 4 | "3",684 5 | "4",601 6 | "5",694 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/10G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",5831 3 | "2",458 4 | "3",223 5 | "4",229 6 | "5",240 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/1G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1033 3 | "2",333 4 | "3",254 5 | "4",267 6 | "5",241 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/1G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",15311 3 | "2",1142 4 | "3",797 5 | "4",825 6 | "5",826 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/1G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",7146 3 | "2",4913 4 | "3",966 5 | "4",931 6 | "5",3410 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/30G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",8161 3 | "2",522 4 | "3",350 5 | "4",407 6 | "5",373 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/3G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",579 3 | "2",578 4 | "3",541 5 | "4",582 6 | "5",566 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/3G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",5752 3 | "2",115 4 | "3",112 5 | "4",108 6 | "5",115 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/3G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",10393 3 | "2",5980 4 | "3",1586 5 | "4",5114 6 | "5",990 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/migration_time.csv: -------------------------------------------------------------------------------- 1 | 1GB, 788 2 | 3GB, 2143 3 | 10GB, 7103 4 | 30GB, 21620 5 | 100GB, 71959 6 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/100G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",13527 3 | "2",1285 4 | "3",1104 5 | "4",1092 6 | "5",1366 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/100G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",28802 3 | "2",8607 4 | "3",5448 5 | "4",3711 6 | "5",8298 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/100G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",11082 3 | "2",5551 4 | "3",1138 5 | "4",1005 6 | "5",1132 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/1G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",968 3 | "2",1024 4 | "3",843 5 | "4",799 6 | "5",843 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/30G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",13996 3 | "2",10802 4 | "3",14216 5 | "4",2812 6 | "5",6926 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/100G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",2741 3 | "2",3387 4 | "3",3248 5 | "4",3471 6 | "5",2257 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/100G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",9400 3 | "2",5799 4 | "3",1439 5 | "4",1926 6 | "5",1496 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/100G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",7934 3 | "2",7796 4 | "3",7615 5 | "4",7128 6 | "5",12266 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/10G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",16745 3 | "2",11862 4 | "3",8699 5 | "4",1888 6 | "5",6129 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/10G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",10668 3 | "2",6288 4 | "3",1516 5 | "4",5792 6 | "5",1601 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/30G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",6137 3 | "2",990 4 | "3",1068 5 | "4",1017 6 | "5",1013 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/30G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",20446 3 | "2",3778 4 | "3",8708 5 | "4",2990 6 | "5",8865 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/30G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",15411 3 | "2",7679 4 | "3",1897 5 | "4",6765 6 | "5",5997 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/3G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",13952 3 | "2",6874 4 | "3",9876 5 | "4",4223 6 | "5",4086 7 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/warm.cypher: -------------------------------------------------------------------------------- 1 | MATCH (n) 2 | OPTIONAL MATCH (n)-[r]->() 3 | RETURN count(n.prop) + count(r.prop); -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcIO/__init__.py: -------------------------------------------------------------------------------- 1 | from LDBCDialect import LDBCDialect 2 | from TemplateManager import TemplateManager -------------------------------------------------------------------------------- /results/images/database_size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/database_size.png -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/100G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",12746 3 | "2",8811 4 | "3",4802 5 | "4",4883 6 | "5",4806 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/10G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",12566 3 | "2",2861 4 | "3",3459 5 | "4",2673 6 | "5",3195 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/30G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",12746 3 | "2",3761 4 | "3",3108 5 | "4",4083 6 | "5",3102 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/3G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",12428 3 | "2",3571 4 | "3",1689 5 | "4",2132 6 | "5",1548 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/100G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",13122 3 | "2",42810 4 | "3",44622 5 | "4",26777 6 | "5",51270 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/1G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",5909 3 | "2",1308 4 | "3",1313 5 | "4",5349 6 | "5",5556 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/3G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",16259 3 | "2",3507 4 | "3",3396 5 | "4",3548 6 | "5",3688 7 | -------------------------------------------------------------------------------- /results/images/migration_time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alnaimi-/database-benchmark/HEAD/results/images/migration_time.png -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/1G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",30104 3 | "2",41304 4 | "3",37778 5 | "4",23581 6 | "5",42922 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/3G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",103970 3 | "2",93676 4 | "3",93576 5 | "4",64552 6 | "5",64991 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/100G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",9124 3 | "2",40550 4 | "3",20006 5 | "4",40997 6 | "5",18389 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/10G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",16259 3 | "2",2975 4 | "3",2828 5 | "4",2986 6 | "5",2680 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/30G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",17503 3 | "2",4892 4 | "3",4675 5 | "4",4392 6 | "5",4919 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/1G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",57.616 3 | "2",51.432 4 | "3",69.221 5 | "4",49.464 6 | "5",59.03 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/100G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",459551 3 | "2",347619 4 | "3",348735 5 | "4",362594 6 | "5",360003 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/10G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",136813 3 | "2",129860 4 | "3",105174 5 | "4",130389 6 | "5",124196 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/1G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",430881 3 | "2",490461 4 | "3",481351 5 | "4",471947 6 | "5",463187 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/30G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",213672 3 | "2",180198 4 | "3",182021 5 | "4",168568 6 | "5",168474 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/10G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",548281 3 | "2",424978 4 | "3",422432 5 | "4",434687 6 | "5",462762 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/1G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",141238 3 | "2",143869 4 | "3",108708 5 | "4",126681 6 | "5",97563 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/3G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",470754 3 | "2",407404 4 | "3",408167 5 | "4",323001 6 | "5",345231 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/100G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",472.024 3 | "2",434.257 4 | "3",457.52 5 | "4",412.356 6 | "5",455.722 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/10G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",980.8 3 | "2",964.06 4 | "3",920.266 5 | "4",890.749 6 | "5",833.909 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/10G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",455.049 3 | "2",306.78 4 | "3",331.803 5 | "4",280.679 6 | "5",246.631 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/10G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",371.231 3 | "2",263.879 4 | "3",264.33 5 | "4",308.25 6 | "5",274.015 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/1G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",141.299 3 | "2",138.419 4 | "3",148.554 5 | "4",143.439 6 | "5",136.108 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/1G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",130.394 3 | "2",120.031 4 | "3",123.163 5 | "4",118.456 6 | "5",119.618 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/30G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",860.934 3 | "2",863.625 4 | "3",1028.68 5 | "4",839.051 6 | "5",821.515 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/30G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",398.176 3 | "2",333.363 4 | "3",320.379 5 | "4",314.012 6 | "5",378.787 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/3G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",731.58 3 | "2",711.616 4 | "3",680.082 5 | "4",653.768 6 | "5",636.083 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/3G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",300.765 3 | "2",218.584 4 | "3",224.27 5 | "4",224.999 6 | "5",235.567 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/3G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",204.491 3 | "2",177.935 4 | "3",170.873 5 | "4",168.163 6 | "5",168.748 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/100G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",454.326 3 | "2",346.771 4 | "3",360.28 5 | "4",350.007 6 | "5",350.947 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/10G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",246.701 3 | "2",216.129 4 | "3",212.862 5 | "4",212.809 6 | "5",211.505 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/10G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",611.251 3 | "2",460.322 4 | "3",450.976 5 | "4",465.83 6 | "5",455.921 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/1G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",207.322 3 | "2",181.706 4 | "3",176.12 5 | "4",178.711 6 | "5",176.936 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/1G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",362.941 3 | "2",297.654 4 | "3",296.454 5 | "4",309.082 6 | "5",293.752 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/1G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",553.829 3 | "2",531.977 4 | "3",534.001 5 | "4",518.749 6 | "5",532.535 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/30G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",364.497 3 | "2",253.646 4 | "3",241.612 5 | "4",240.021 6 | "5",239.175 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/3G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",205.895 3 | "2",192.131 4 | "3",197.528 5 | "4",193.427 6 | "5",190.386 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/3G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",407.039 3 | "2",382.919 4 | "3",384.743 5 | "4",339.568 6 | "5",338.656 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/3G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",938.374 3 | "2",895.159 4 | "3",898.407 5 | "4",897.174 6 | "5",929.035 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/10G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",4158203 3 | "2",3860940 4 | "3",3314706 5 | "4",3168227 6 | "5",3095145 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/1G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",7320591 3 | "2",7821994 4 | "3",7751285 5 | "4",7855716 6 | "5",7386048 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/30G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",8001947 3 | "2",7883591 4 | "3",7858116 5 | "4",7836621 6 | "5",8165583 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/3G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1866390 3 | "2",1778489 4 | "3",1734511 5 | "4",1802456 6 | "5",1763026 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/1G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",9501265 3 | "2",9669005 4 | "3",10383711 5 | "4",9713836 6 | "5",9438297 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/30G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1026552 3 | "2",839617 4 | "3",808543 5 | "4",834598 6 | "5",813991 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/100G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",3526.961 3 | "2",3295.868 4 | "3",3471.429 5 | "4",3469.987 6 | "5",4040.859 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/10G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",7638.559 3 | "2",7543.547 4 | "3",7413.972 5 | "4",7418.478 6 | "5",7206.595 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/1G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1091.561 3 | "2",1061.008 4 | "3",1044.168 5 | "4",1075.706 6 | "5",1063.747 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/30G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1581.271 3 | "2",1607.238 4 | "3",1454.548 5 | "4",1423.014 6 | "5",1497.372 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/3G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",6159.14 3 | "2",5883.512 4 | "3",5678.668 5 | "4",5858.676 6 | "5",5987.519 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/100G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",3988.148 3 | "2",4008.885 4 | "3",4021.707 5 | "4",4145.901 6 | "5",4055.63 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/10G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",4325.748 3 | "2",4244.077 4 | "3",4279.474 5 | "4",4290.484 6 | "5",4375.561 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/10G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",2249.52 3 | "2",2314.781 4 | "3",2157.769 5 | "4",2288.987 6 | "5",2165.233 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/1G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1800.331 3 | "2",1798.96 4 | "3",1731.253 5 | "4",1745.221 6 | "5",1754.862 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/1G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",380.423 3 | "2",375.797 4 | "3",372.133 5 | "4",374.86 6 | "5",371.739 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/30G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1758.48 3 | "2",1871.726 4 | "3",1875.039 5 | "4",1932.297 6 | "5",1905.903 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/3G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",2287.434 3 | "2",2287.635 4 | "3",2220.926 5 | "4",2244.336 6 | "5",2235.083 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/migration_size.csv: -------------------------------------------------------------------------------- 1 | 1GB, 2469606195.2 2 | 3GB, 7301444403.2 3 | 10GB, 24696061952 4 | 30GB, 77309411328 5 | 100GB, 252329328640 6 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/100G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/100G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/100G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/10G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/10G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/1G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/30G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/30G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/3G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/tuned/3G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/10G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/10G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/10G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/1G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/1G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/30G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/30G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/30G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/3G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/3G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/3G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/100G/result_query11: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",2779.762 3 | "2",2610.597 4 | "3",2528.867 5 | "4",2474.251 6 | "5",2441.083 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/100G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",16893.604 3 | "2",15718.74 4 | "3",15755.698 5 | "4",16261.851 6 | "5",15800.489 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/30G/result_query2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",12150.881 3 | "2",11941.541 4 | "3",11621.367 5 | "4",11886.016 6 | "5",11892.103 7 | -------------------------------------------------------------------------------- /results/raw/vertica/migration_size.csv: -------------------------------------------------------------------------------- 1 | 1GB, 1516831881 2 | 3GB, 2270610172 3 | 10GB, 4698617142 4 | 30GB, 15546911178 5 | 100GB, 52651839291 6 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/100G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",20224.432 3 | "2",19825.144 4 | "3",19070.052 5 | "4",18398.555 6 | "5",17722.251 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/100G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",40809.359 3 | "2",41176.291 4 | "3",40587.373 5 | "4",40952.721 6 | "5",41074.345 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/10G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",625.94 3 | "2",582.019 4 | "3",583.889 5 | "4",570.721 6 | "5",561.876 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/30G/result_query6: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",9909.162 3 | "2",9745.691 4 | "3",10025.787 5 | "4",10011.938 6 | "5",10280.979 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/30G/result_query8: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",11255.514 3 | "2",11281.989 4 | "3",11031.19 5 | "4",11059.822 6 | "5",10892.654 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/3G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",480.155 3 | "2",456.134 4 | "3",449.946 5 | "4",463.493 6 | "5",470.685 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/100G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/100G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/100G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/neo4j/untuned/100G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/migration_size.csv: -------------------------------------------------------------------------------- 1 | 1GB, 5325759447 2 | 3GB, 15633680957 3 | 10GB, 53515292508 4 | 30GB, 160459978178 5 | 100GB, 515116902645 6 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/100G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/10G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",7415.258 3 | "2",6803.834 4 | "3",6695.862 5 | "4",6720.059 6 | "5",6815.862 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/1G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",2415.03 3 | "2",2333.884 4 | "3",2596.694 5 | "4",2235.827 6 | "5",2229.634 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/30G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21600000 3 | "2",21600000 4 | "3",21600000 5 | "4",21600000 6 | "5",21600000 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/3G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",5809.098 3 | "2",6051.706 4 | "3",6247.159 5 | "4",5632.643 6 | "5",5676.934 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/100G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",4402.369 3 | "2",4239.278 4 | "3",4261.836 5 | "4",4190.457 6 | "5",4189.158 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/100G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",21777793 3 | "2",15715247 4 | "3",19041130 5 | "4",18517883 6 | "5",19021201 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/10G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",4921.112 3 | "2",4844.086 4 | "3",5074.867 5 | "4",4811.288 6 | "5",4859.791 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/1G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1674.417 3 | "2",1635.202 4 | "3",1671.025 5 | "4",1629.252 6 | "5",1673.364 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/1G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",4856.762 3 | "2",4814.708 4 | "3",4849.781 5 | "4",4861.295 6 | "5",4839.862 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/1G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",75257.694 3 | "2",78297.689 4 | "3",79292.04 5 | "4",84684.054 6 | "5",75773.903 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/30G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",2206.646 3 | "2",2170.924 4 | "3",2106.601 5 | "4",2127.432 6 | "5",2081.133 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/3G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",3559.528 3 | "2",3497.558 4 | "3",3494.551 5 | "4",3580.259 6 | "5",3594.637 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/3G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",33283.884 3 | "2",33823.15 4 | "3",33468.086 5 | "4",33979.168 6 | "5",33577.014 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/100G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",18705.628 3 | "2",17126.578 4 | "3",18549.37 5 | "4",17903.858 6 | "5",19256.22 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/1G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",32571.533 3 | "2",31789.504 4 | "3",32205.253 5 | "4",38462.739 6 | "5",38072.564 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/1G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",81210.806 3 | "2",75490.526 4 | "3",80427.783 5 | "4",73540.23 6 | "5",76903.196 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/1G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",605851.403 3 | "2",610631.783 4 | "3",617313.825 5 | "4",612115.49 6 | "5",614348.73 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/30G/result_query9multihop1: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",11771.767 3 | "2",11514.708 4 | "3",11204.544 5 | "4",10868.181 6 | "5",10497.096 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/3G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",113565.573 3 | "2",110717.67 4 | "3",118006.9 5 | "4",118421.448 6 | "5",109081.656 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/3G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",250730.941 3 | "2",255893.319 4 | "3",251042.283 5 | "4",260663.255 6 | "5",268290.8 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/100G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",32907.179 3 | "2",33529.737 4 | "3",33561.589 5 | "4",33747.134 6 | "5",33296.681 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/10G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",52065.135 3 | "2",52360.985 4 | "3",52019.474 5 | "4",51795.328 6 | "5",51991.679 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/10G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",151360.6 3 | "2",151137.707 4 | "3",152622.221 5 | "4",151426.815 6 | "5",152177.888 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/10G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",220727.524 3 | "2",221917.304 4 | "3",220495.86 5 | "4",219720.476 6 | "5",221183.2 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/1G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",39597.607 3 | "2",39802.588 4 | "3",38283.645 5 | "4",39482.964 6 | "5",39031.488 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/30G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",15194.876 3 | "2",15212.102 4 | "3",14997.366 5 | "4",14940.51 6 | "5",15032.691 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/3G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",19359.395 3 | "2",19054.883 4 | "3",19641.954 5 | "4",19376.644 6 | "5",19419.926 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/3G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",118752.944 3 | "2",113168.18 4 | "3",119521.342 5 | "4",114102.109 6 | "5",116306.637 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/100G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",736296.634 3 | "2",744681.931 4 | "3",766729.011 5 | "4",734706.707 6 | "5",775532.477 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/10G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",174819.431 3 | "2",174088.423 4 | "3",176370.424 5 | "4",163275.522 6 | "5",173285.658 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/10G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",938694.764 3 | "2",916143.18 4 | "3",916849.462 5 | "4",942870.229 6 | "5",932673.83 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/1G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",112737.092 3 | "2",106112.456 4 | "3",106051.584 5 | "4",105457.625 6 | "5",111641.964 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/30G/result_query9multihop2: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",377910.299 3 | "2",413455.515 4 | "3",384968.435 5 | "4",387796.024 6 | "5",368733.016 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/3G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",402268.265 3 | "2",405722.308 4 | "3",403178.673 5 | "4",398827.767 6 | "5",397527.094 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/3G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",3284207.006 3 | "2",3290263.72 4 | "3",3308527.403 5 | "4",3274944.684 6 | "5",3346296.16 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/100G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",913619.405 3 | "2",913121.489 4 | "3",909244.243 5 | "4",914113.404 6 | "5",911933.263 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/30G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",205638.332 3 | "2",206327.725 4 | "3",207499.588 5 | "4",205573.978 6 | "5",205410.673 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/30G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",549000.416 3 | "2",545422.797 4 | "3",544252.472 5 | "4",546959.913 6 | "5",550331.15 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/30G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",791716.175 3 | "2",786526.644 4 | "3",781832.388 5 | "4",783263.843 6 | "5",781994.523 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/100G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",9550582.402 3 | "2",9324482.318 4 | "3",8943982.073 5 | "4",9033295.993 6 | "5",9010932.311 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/10G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",1381567.077 3 | "2",1370918.826 4 | "3",1376089.813 5 | "4",1375421.899 6 | "5",1368119.129 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/30G/result_query9multihop3: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",2656030.282 3 | "2",2637329.311 4 | "3",2604444.14 5 | "4",2600740.296 6 | "5",2599176.873 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/30G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",4459650.703 3 | "2",4468149.221 4 | "3",4488033.448 5 | "4",4474131.964 6 | "5",4505239.395 7 | -------------------------------------------------------------------------------- /results/raw/vertica/untuned/100G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",5626908.539 3 | "2",5634543.894 4 | "3",5622490.09 5 | "4",5626658.558 6 | "5",5636242.429 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/100G/result_query9multihop4: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",16626605.079 3 | "2",16511413.725 4 | "3",16351790.543 5 | "4",17108766.37 6 | "5",16326070.319 7 | -------------------------------------------------------------------------------- /results/raw/sqlgraph/untuned/10G/result_query9multihop5: -------------------------------------------------------------------------------- 1 | "","x" 2 | "1",15564564.788 3 | "2",15515718.85 4 | "3",15641310.877 5 | "4",15793926.169 6 | "5",15557900.251 7 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcdatastructures/__init__.py: -------------------------------------------------------------------------------- 1 | from Email import Email 2 | from Language import Language 3 | from Person import Person 4 | from Place import Place 5 | 6 | from Organisation import Organisation -------------------------------------------------------------------------------- /vertica/vertica-ldbc-ingester/ldbcIO/definitions/Definitions.py: -------------------------------------------------------------------------------- 1 | class LDBCDefines(object): 2 | # Template information: 3 | TEMPLATE_FILE_PATH = "resources/templates" 4 | SQL_TEMPLATE_FILE_NAME = "ingestionTemplate.sql" 5 | OUTPUT_SQL_FILE_NAME = "ingestion.sql" 6 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query13.cypher: -------------------------------------------------------------------------------- 1 | MATCH (person1:Person {id:13194139534222}), (person2:Person {id:15393162799671}) 2 | OPTIONAL MATCH path = shortestPath((person1)-[:KNOWS]-(person2)) 3 | RETURN CASE path IS NULL 4 | WHEN true THEN -1 5 | ELSE length(path) 6 | END AS pathLength 7 | ; 8 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcIO/LDBCDialect.py: -------------------------------------------------------------------------------- 1 | import csv 2 | 3 | 4 | class LDBCDialect(csv.excel): 5 | """Describe the usual properties of LDBC-generated CSV files.""" 6 | # LDBC Dialect uses "|" character as field delimiter 7 | delimiter = '|' 8 | lineterminator = '|' + '\r\n' 9 | 10 | 11 | # Register on first class reference 12 | csv.register_dialect("LDBCDialect", LDBCDialect) 13 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcdatastructures/Email.py: -------------------------------------------------------------------------------- 1 | class Email(object): 2 | """Models e-mails addresses in LDBC. A person can have multiple e-mail addresses.""" 3 | personId = 0 4 | email = "" 5 | 6 | def __init__(self, row): 7 | self.personId = row['Person.id'] 8 | self.email = row['email'] 9 | 10 | def __str__(self): 11 | """Returns the email address""" 12 | return str(self.email) 13 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcdatastructures/Place.py: -------------------------------------------------------------------------------- 1 | class Place: 2 | """Models places on LDBC data.""" 3 | id = 0 4 | name = "" 5 | url = "" 6 | type = "" 7 | 8 | def __init__(self, row): 9 | self.id = row["id"] 10 | self.name = row["name"] 11 | self.url = row["url"] 12 | self.type = row["type"] 13 | 14 | @staticmethod 15 | def csvFields(): 16 | return ["id", "name", "url"] 17 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcdatastructures/Language.py: -------------------------------------------------------------------------------- 1 | class Language(object): 2 | """Models languages that a person speaks in LDBC. A person can speak multiple languages.""" 3 | personId = 0 4 | language = "" 5 | 6 | def __init__(self, row): 7 | self.personId = row['Person.id'] 8 | self.language = row['language'] 9 | 10 | def __str__(self): 11 | """Returns the language address""" 12 | return str(self.language) 13 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcdatastructures/Organisation.py: -------------------------------------------------------------------------------- 1 | class Organisation: 2 | """Models organisations on LDBC data.""" 3 | id = 0 4 | type = "" 5 | name = "" 6 | url = "" 7 | 8 | def __init__(self, row): 9 | self.id = row["id"] 10 | self.name = row["name"] 11 | self.url = row["url"] 12 | self.type = row["type"] 13 | 14 | @staticmethod 15 | def csvFields(): 16 | return ["id", "name", "url"] 17 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query8.cypher: -------------------------------------------------------------------------------- 1 | MATCH (start:Person {id:2199023259437})<-[:HAS_CREATOR]-()<-[:REPLY_OF]-(comment:Comment)-[:HAS_CREATOR]->(person:Person) 2 | RETURN 3 | person.id AS personId, 4 | person.firstName AS personFirstName, 5 | person.lastName AS personLastName, 6 | comment.id AS commentId, 7 | comment.creationDate AS commentCreationDate, 8 | comment.content AS commentContent 9 | ORDER BY commentCreationDate DESC, commentId ASC 10 | limit 20 11 | ; 12 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query5.cypher: -------------------------------------------------------------------------------- 1 | MATCH (person:Person {id:2199023259437})-[:KNOWS*1..2]-(friend:Person)<-[membership:HAS_MEMBER]-(forum:Forum) 2 | WHERE membership.joinDate>"1990-7-7" AND not(person=friend) 3 | WITH DISTINCT friend, forum 4 | OPTIONAL MATCH (friend)<-[:HAS_CREATOR]-(post:Post)<-[:CONTAINER_OF]-(forum) 5 | WITH forum, count(post) AS postCount 6 | RETURN 7 | forum.title AS forumName, 8 | postCount 9 | ORDER BY postCount DESC, forum.id ASC 10 | LIMIT 100; 11 | 12 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query4.cypher: -------------------------------------------------------------------------------- 1 | MATCH (person:Person {id:2199023259437})-[:KNOWS]->(:Person)<-[:HAS_CREATOR]-(post:Post)-[HAS_TAG]->(tag:Tag) 2 | WHERE post.creationDate >= "2010-02-01" AND post.creationDate < "2016-7-7" 3 | OPTIONAL MATCH (tag)<-[:HAS_TAG]-(oldPost:Post) 4 | WHERE oldPost.creationDate < "2010-02-01" 5 | WITH tag, post, length(collect(oldPost)) AS oldPostCount 6 | WHERE oldPostCount=0 7 | RETURN 8 | tag.name AS tagName, 9 | length(collect(post)) AS postCount 10 | ORDER BY postCount DESC, tagName ASC 11 | LIMIT 100; 12 | 13 | ##Could not find any working dates for this one 14 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query11.cypher: -------------------------------------------------------------------------------- 1 | MATCH (person:Person {id:2199023259437})-[:KNOWS*1..2]-(friend:Person) 2 | WHERE not(person=friend) 3 | WITH DISTINCT friend 4 | MATCH (friend)-[worksAt:WORKS_AT]->(company:Company)-[:IS_LOCATED_IN]->(:Country {url:"http://dbpedia.org/resource/France"}) 5 | WHERE worksAt.workFrom < "2016-7-7" 6 | RETURN 7 | friend.id AS friendId, 8 | friend.firstName AS friendFirstName, 9 | friend.lastName AS friendLastName, 10 | worksAt.workFrom AS workFromYear, 11 | company.name AS companyName 12 | ORDER BY workFromYear ASC, friendId ASC, companyName DESC 13 | LIMIT 20 14 | ; 15 | -------------------------------------------------------------------------------- /sqlgraph/resources/my.cnf: -------------------------------------------------------------------------------- 1 | !includedir /etc/mysql/conf.d/ 2 | !includedir /etc/mysql/mysql.conf.d/ 3 | 4 | [mysqld] 5 | 6 | # InnoDB variables 7 | innodb_buffer_pool_size = 60G 8 | innodb_buffer_pool_instances = 20 9 | 10 | # logging variables 11 | innodb_flush_log_at_trx_commit = 2 # 1 for durability, 0 or 2 for performance 12 | innodb_log_buffer_size = 1G # Bigger if innodb_flush_log_at_trx_commit = 0 13 | innodb_log_file_size = 10G # Bigger means more write throughput but longer recovery 14 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query12.cypher: -------------------------------------------------------------------------------- 1 | MATCH (:Person {id:2199023259437})-[:KNOWS]-(friend:Person) 2 | OPTIONAL MATCH (friend)<-[:HAS_CREATOR]-(comment:Comment)-[:REPLY_OF]->(:Post)-[:HAS_TAG]->(tag:Tag), 3 | (tag)-[:HAS_TYPE]->(tagClass:TagClass)-[:IS_SUBCLASS_OF*0..]->(baseTagClass:TagClass) 4 | WHERE tagClass.name = "Sun_Is_Shining" OR baseTagClass.name = "Sun_Is_Shining" 5 | RETURN 6 | friend.id AS friendId, 7 | friend.firstName AS friendFirstName, 8 | friend.lastName AS friendLastName, 9 | collect(DISTINCT tag.name) AS tagNames, 10 | count(DISTINCT comment) AS count 11 | ORDER BY count DESC, friendId ASC 12 | LIMIT 100; 13 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query6.cypher: -------------------------------------------------------------------------------- 1 | MATCH (person:Person {id:2199023259437})-[:KNOWS*1..2]->(friend:Person), 2 | (friend)<-[:HAS_CREATOR]-(friendPost:Post)-[:HAS_TAG]->(knownTag:Tag {name:"A_Woman_and_a_Man"}) 3 | WHERE not(person=friend) 4 | MATCH (friendPost)-[:HAS_TAG]->(commonTag:Tag) 5 | WHERE not(commonTag=knownTag) 6 | WITH DISTINCT commonTag, knownTag, friend 7 | MATCH (commonTag)<-[:HAS_TAG]-(commonPost:Post)-[:HAS_TAG]->(knownTag) 8 | WHERE (commonPost)-[:HAS_CREATOR]->(friend) 9 | RETURN 10 | commonTag.name AS tagName, 11 | count(commonPost) AS postCount 12 | ORDER BY postCount DESC, tagName ASC 13 | LIMIT 20; 14 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query2.cypher: -------------------------------------------------------------------------------- 1 | MATCH (:Person {id:2199023259437})-[:KNOWS]->(friend:Person) <-[:HAS_CREATOR]-(message) 2 | WHERE message.creationDate <= "2016-7-7" AND (message:Post OR message:Comment) 3 | RETURN 4 | friend.id AS personId, 5 | friend.firstName AS personFirstName, 6 | friend.lastName AS personLastName, 7 | message.id AS messageId, 8 | CASE has (message.content) 9 | WHEN true THEN message.content 10 | ELSE message.imageFile 11 | END AS messageContent, 12 | message.creationDate AS messageDate 13 | ORDER BY messageDate DESC, messageId ASC 14 | LIMIT 20 15 | ; 16 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query9multihop1.cypher: -------------------------------------------------------------------------------- 1 | EXPORT personId=2199023259437 2 | EXPORT date="2016-7-7" 3 | EXPORT top=20 4 | 5 | MATCH (:Person {id:{personId}})-[:KNOWS*1..1]->(friend:Person)<-[:HAS_CREATOR]-(message) 6 | WHERE message.creationDate < {date} 7 | RETURN DISTINCT 8 | message.id AS messageId, 9 | CASE HAS(message.content) 10 | WHEN true THEN message.content 11 | ELSE message.imageFile 12 | END AS messageContent, 13 | message.creationDate AS messageCreationDate, 14 | friend.id AS personId, 15 | friend.firstName AS personFirstName, 16 | friend.lastName AS personLastName 17 | ORDER BY message.creationDate DESC, message.id ASC 18 | LIMIT {top} 19 | ; -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query9multihop2.cypher: -------------------------------------------------------------------------------- 1 | EXPORT personId=2199023259437 2 | EXPORT date="2016-7-7" 3 | EXPORT top=20 4 | 5 | MATCH (:Person {id:{personId}})-[:KNOWS*1..2]->(friend:Person)<-[:HAS_CREATOR]-(message) 6 | WHERE message.creationDate < {date} 7 | RETURN DISTINCT 8 | message.id AS messageId, 9 | CASE HAS(message.content) 10 | WHEN true THEN message.content 11 | ELSE message.imageFile 12 | END AS messageContent, 13 | message.creationDate AS messageCreationDate, 14 | friend.id AS personId, 15 | friend.firstName AS personFirstName, 16 | friend.lastName AS personLastName 17 | ORDER BY message.creationDate DESC, message.id ASC 18 | LIMIT {top} 19 | ; -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query9multihop3.cypher: -------------------------------------------------------------------------------- 1 | EXPORT personId=2199023259437 2 | EXPORT date="2016-7-7" 3 | EXPORT top=20 4 | 5 | MATCH (:Person {id:{personId}})-[:KNOWS*1..3]->(friend:Person)<-[:HAS_CREATOR]-(message) 6 | WHERE message.creationDate < {date} 7 | RETURN DISTINCT 8 | message.id AS messageId, 9 | CASE HAS(message.content) 10 | WHEN true THEN message.content 11 | ELSE message.imageFile 12 | END AS messageContent, 13 | message.creationDate AS messageCreationDate, 14 | friend.id AS personId, 15 | friend.firstName AS personFirstName, 16 | friend.lastName AS personLastName 17 | ORDER BY message.creationDate DESC, message.id ASC 18 | LIMIT {top} 19 | ; -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query9multihop4.cypher: -------------------------------------------------------------------------------- 1 | EXPORT personId=2199023259437 2 | EXPORT date="2016-7-7" 3 | EXPORT top=20 4 | 5 | MATCH (:Person {id:{personId}})-[:KNOWS*1..4]->(friend:Person)<-[:HAS_CREATOR]-(message) 6 | WHERE message.creationDate < {date} 7 | RETURN DISTINCT 8 | message.id AS messageId, 9 | CASE HAS(message.content) 10 | WHEN true THEN message.content 11 | ELSE message.imageFile 12 | END AS messageContent, 13 | message.creationDate AS messageCreationDate, 14 | friend.id AS personId, 15 | friend.firstName AS personFirstName, 16 | friend.lastName AS personLastName 17 | ORDER BY message.creationDate DESC, message.id ASC 18 | LIMIT {top} 19 | ; -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query9multihop5.cypher: -------------------------------------------------------------------------------- 1 | EXPORT personId=2199023259437 2 | EXPORT date="2016-7-7" 3 | EXPORT top=20 4 | 5 | MATCH (:Person {id:{personId}})-[:KNOWS*1..5]->(friend:Person)<-[:HAS_CREATOR]-(message) 6 | WHERE message.creationDate < {date} 7 | RETURN DISTINCT 8 | message.id AS messageId, 9 | CASE HAS(message.content) 10 | WHEN true THEN message.content 11 | ELSE message.imageFile 12 | END AS messageContent, 13 | message.creationDate AS messageCreationDate, 14 | friend.id AS personId, 15 | friend.firstName AS personFirstName, 16 | friend.lastName AS personLastName 17 | ORDER BY message.creationDate DESC, message.id ASC 18 | LIMIT {top} 19 | ; -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query7.cypher: -------------------------------------------------------------------------------- 1 | MATCH (person:Person {id:2199023259437})<-[:HAS_CREATOR]-(message)<-[like:LIKES]-(liker:Person) 2 | WITH liker, message, like.creationDate AS likeTime, person 3 | ORDER BY likeTime DESC, message.id ASC 4 | WITH liker, head(collect({msg: message, likeTime: likeTime})) AS latestLike, person 5 | RETURN 6 | liker.id AS personId, 7 | liker.firstName AS personFirstName, 8 | liker.lastName AS personLastName, 9 | latestLike.likeTime AS likeTime, 10 | not((liker)-[:KNOWS]-(person)) AS isNew, 11 | latestLike.msg.id AS messageId, 12 | latestLike.msg.content AS messageContent 13 | ORDER BY likeTime DESC, personId ASC 14 | LIMIT 100; 15 | 16 | //removed latency as would not work with current version 17 | -------------------------------------------------------------------------------- /sqlgraph/resources/setup_perf.sql: -------------------------------------------------------------------------------- 1 | # Enable performance schema for user root 2 | INSERT INTO performance_schema.setup_actors (HOST,USER,ROLE,ENABLED,HISTORY) VALUES('localhost','root','%','YES','YES'); 3 | 4 | # Update the statement and stage instrumentation 5 | UPDATE performance_schema.setup_instruments SET ENABLED = 'YES', TIMED = 'YES' WHERE NAME LIKE '%statement/%'; 6 | UPDATE performance_schema.setup_instruments SET ENABLED = 'YES', TIMED = 'YES' WHERE NAME LIKE '%stage/%'; 7 | 8 | # Make sure that statement and stage consumers are enabled 9 | UPDATE performance_schema.setup_consumers SET ENABLED = 'YES' WHERE NAME LIKE '%events_statements_%'; 10 | UPDATE performance_schema.setup_consumers SET ENABLED = 'YES' WHERE NAME LIKE '%events_stages_%'; -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query14.cypher: -------------------------------------------------------------------------------- 1 | MATCH path = allShortestPaths((person1:Person {id:15393162799671})-[:KNOWS]-(person2:Person {id:13194139534222})) 2 | WITH nodes(path) AS pathNodes 3 | RETURN 4 | extract(n IN pathNodes | n.id) AS pathNodeIds, 5 | reduce(weight=0.0, idx IN range(1,size(pathNodes)-1) | 6 | extract(prev IN [pathNodes[idx-1]] | 7 | extract(curr IN [pathNodes[idx]] | 8 | weight + 9 | length((curr)<-[:HAS_CREATOR]-(:Comment)-[:REPLY_OF]->(:Post)-[:HAS_CREATOR]->(prev))*1.0 + 10 | length((prev)<-[:HAS_CREATOR]-(:Comment)-[:REPLY_OF]->(:Post)-[:HAS_CREATOR]->(curr))*1.0 + 11 | length((prev)-[:HAS_CREATOR]-(:Comment)-[:REPLY_OF]-(:Comment)-[:HAS_CREATOR]-(curr))*0.5 12 | ) 13 | )[0][0] 14 | ) AS weight 15 | ORDER BY weight DESC; 16 | -------------------------------------------------------------------------------- /vertica/vertica-ldbc-ingester/VerticaIngestScript.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | import ldbcIO.TemplateManager as TemplateManager 5 | 6 | # Main flow: 7 | 8 | # Only one argument is accepted - path to ldbc 9 | if (sys.argv >= 1): 10 | ldbcPath = sys.argv[1]; 11 | else: 12 | print ("[ERROR] Wrong usage. Is it being run through the script?") 13 | exit(1) 14 | 15 | if not os.path.exists(ldbcPath): 16 | print ("[ERROR] LDBC folder " + ldbcPath + " does no exist.") 17 | exit(2) 18 | 19 | # remove '/' from the path end 20 | if (ldbcPath[-1] == r'/'): 21 | ldbcPath = ldbcPath[0:-2] 22 | 23 | # generate ingestionTemplate 24 | tempManager = TemplateManager() 25 | tempManager.populateSqlIngestionTemplate(ldbcPath) 26 | 27 | 28 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcIO/CSVHandler.py: -------------------------------------------------------------------------------- 1 | import csv 2 | 3 | 4 | def importFromLDBCData(filePath): 5 | """Read a list of rows from the CSV datafile""" 6 | 7 | infoRows = [] 8 | with open(filePath) as csvfile: 9 | rows = csv.DictReader(csvfile, dialect="LDBCDialect"); 10 | 11 | for row in rows: 12 | infoRows.append(row) 13 | return infoRows 14 | 15 | 16 | def exportToLDBCData(fieldNames, objects, filePath): 17 | """Exports the object to a new csv file.""" 18 | with open(filePath, 'w') as csvfile: 19 | writer = csv.DictWriter(csvfile, fieldnames=fieldNames, dialect="LDBCDialect") 20 | writer.writeheader() 21 | 22 | for object in objects: 23 | getAttributeValues = lambda attributeName: getattr(object, attributeName) 24 | attributes = map(getAttributeValues, fieldNames) 25 | objectInfo = dict(zip(fieldNames, attributes)) 26 | writer.writerow(objectInfo) 27 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcIO/definitions/Definitions.py: -------------------------------------------------------------------------------- 1 | class LDBCDefines(object): 2 | # LDBC information: 3 | PERSON_FILE_NAME = "person_0_0.csv" 4 | EMAIL_FILE_NAME = "person_email_emailaddress_0_0.csv" 5 | LANGUAGE_FILE_NAME = "person_speaks_language_0_0.csv" 6 | MERGED_FILE_NAME = "person_complete_0_0.csv" 7 | 8 | PLACES_FILE_NAME = "place_0_0.csv" 9 | CITIES_FILE_NAME = "city_0_0.csv" 10 | COUNTRIES_FILE_NAME = "country_0_0.csv" 11 | CONTINENTS_FILE_NAME = "continent_0_0.csv" 12 | 13 | ORGANISATION_FILE_NAME = "organisation_0_0.csv" 14 | UNIVERSITY_FILE_NAME = "university_0_0.csv" 15 | COMPANY_FILE_NAME = "company_0_0.csv" 16 | 17 | # Template information: 18 | TEMPLATE_FILE_PATH = "resources/templates" 19 | TEMPLATE_FILE_NAME = "ingestionTemplate.cypher" 20 | SQL_TEMPLATE_FILE_NAME = "ingestionTemplate.sql" 21 | OUTPUT_SQL_FILE_NAME = "ingestion.sql" 22 | OUTPUT_CYPHER_FILE_NAME = "ingestion.cypher" 23 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query10 _with_birthdays.cypher: -------------------------------------------------------------------------------- 1 | MATCH (person:Person {id:2199023259437})-[:KNOWS*2..2]-(friend:Person)-[:IS_LOCATED_IN]->(city:City) 2 | WHERE ((toInt(friend.birthday_month) = 6 AND toInt(friend.birthday_day) >= 21) 3 | OR (toInt(friend.birthday_month) = (6+1)%12 AND toInt(friend.birthday_day) < 22)) 4 | AND not(friend=person) 5 | AND not((friend)-[:KNOWS]-(person)) 6 | WITH DISTINCT friend, city, person 7 | OPTIONAL MATCH (friend)<-[:HAS_CREATOR]-(post:Post) 8 | WITH friend, city, collect(post) AS posts, person 9 | WITH 10 | friend, 11 | city, 12 | length(posts) AS postCount, 13 | length([p IN posts WHERE (p)-[:HAS_TAG]->(:Tag)<-[:HAS_INTEREST]-(person)]) AS commonPostCount 14 | RETURN 15 | friend.id AS personId, 16 | friend.firstName AS personFirstName, 17 | friend.lastName AS personLastName, 18 | friend.gender AS personGender, 19 | city.name AS personCityName, 20 | commonPostCount - (postCount - commonPostCount) AS commonInterestScore 21 | ORDER BY commonInterestScore DESC, personId ASC 22 | LIMIT 100 23 | ; 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query3.cypher: -------------------------------------------------------------------------------- 1 | MATCH (person:Person {id:2199023259437})-[:KNOWS*1..2]->(friend:Person)<-[:HAS_CREATOR]-(messageX), 2 | (messageX)-[:IS_LOCATED_IN]->(countryX:Country) 3 | WHERE not(person=friend) AND 4 | not((friend)-[:IS_LOCATED_IN]->()-[:IS_PART_OF]->(countryX)) 5 | AND countryX.url="http://dbpedia.org/resource/France" 6 | AND messageX.creationDate>="1990-7-7" 7 | AND messageX.creationDate< "2016-7-7" 8 | WITH friend, count(DISTINCT messageX) AS xCount 9 | MATCH (friend)<-[:HAS_CREATOR]-(messageY)-[:IS_LOCATED_IN]->(countryY:Country) 10 | WHERE countryY.url="http://dbpedia.org/resource/France" 11 | AND not((friend)-[:IS_LOCATED_IN]->()-[:IS_PART_OF]->(countryY)) 12 | AND messageY.creationDate>="1990-7-7" 13 | AND messageY.creationDate< "2016-7-7" 14 | WITH friend.id AS friendId, 15 | friend.firstName AS friendFirstName, 16 | friend.lastName AS friendLastName, 17 | xCount, 18 | count(DISTINCT messageY) AS yCount 19 | RETURN 20 | friendId, 21 | friendFirstName, 22 | friendLastName, 23 | xCount, 24 | yCount, 25 | xCount + yCount AS xyCount 26 | ORDER BY xyCount DESC, friendId ASC 27 | LIMIT 100 28 | ; 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query10.cypher: -------------------------------------------------------------------------------- 1 | MATCH (person:Person {id:2199023259437})-[:KNOWS*2..2]-(friend:Person)-[:IS_LOCATED_IN]->(city:City) 2 | WHERE ((toInt(substring(friend.birthday,5,2)) = 6 AND toInt(substring(friend.birthday,8,2)) >= 21) 3 | OR (toInt(substring(friend.birthday,5,2)) = (6+1)%12 AND toInt(substring(friend.birthday,8,2)) < 22)) 4 | AND not(friend=person) 5 | AND not((friend)-[:KNOWS]-(person)) 6 | WITH DISTINCT friend, city, person 7 | OPTIONAL MATCH (friend)<-[:HAS_CREATOR]-(post:Post) 8 | WITH friend, city, collect(post) AS posts, person 9 | WITH 10 | friend, 11 | city, 12 | length(posts) AS postCount, 13 | length([p IN posts WHERE (p)-[:HAS_TAG]->(:Tag)<-[:HAS_INTEREST]-(person)]) AS commonPostCount 14 | RETURN 15 | friend.id AS personId, 16 | friend.firstName AS personFirstName, 17 | friend.lastName AS personLastName, 18 | friend.gender AS personGender, 19 | city.name AS personCityName, 20 | commonPostCount - (postCount - commonPostCount) AS commonInterestScore 21 | ORDER BY commonInterestScore DESC, personId ASC 22 | LIMIT 100 23 | ; 24 | 25 | //due to bulk ingestion, the birthday_day/month data has to be done within the query 26 | 27 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/queries/query1.cypher: -------------------------------------------------------------------------------- 1 | MATCH (:Person {id:2199023259437})-[path:KNOWS*1..3]-(friend:Person) 2 | WHERE friend.firstName = "Richard" 3 | WITH friend, min(length(path)) AS distance 4 | ORDER BY distance ASC, friend.lastName ASC, friend.id ASC 5 | LIMIT 100 6 | 7 | MATCH (friend)-[:IS_LOCATED_IN]->(friendCity:City) 8 | OPTIONAL MATCH (friend)-[studyAt:STUDY_AT]->(uni:University)-[:IS_LOCATED_IN]->(uniCity:City) 9 | WITH friend, 10 | collect(CASE uni.name 11 | WHEN null THEN null 12 | ELSE [uni.name, studyAt.classYear, uniCity.name] 13 | END) AS unis, 14 | friendCity, 15 | distance 16 | 17 | OPTIONAL MATCH (friend)-[worksAt:WORKS_AT]->(company:Company)-[:IS_LOCATED_IN]->(companyCountry:Country) 18 | WITH friend, 19 | collect(CASE company.name 20 | WHEN null THEN null 21 | ELSE [company.name, worksAt.workFrom, companyCountry.name] 22 | END) AS companies, 23 | unis, 24 | friendCity, 25 | distance 26 | 27 | RETURN 28 | friend.id AS id, 29 | friend.firstName as firstName, 30 | friend.lastName AS lastName, 31 | distance, 32 | friend.birthday AS birthday, 33 | friend.creationDate AS creationDate, 34 | friend.gender AS gender, 35 | friend.browserUsed AS browser, 36 | friend.locationIP AS locationIp, 37 | friend.email AS emails, 38 | friend.languages AS languages, 39 | friendCity.name AS cityName, 40 | unis, 41 | companies 42 | ORDER BY distance ASC, friend.lastName ASC, friend.id ASC 43 | LIMIT 100 44 | ; 45 | -------------------------------------------------------------------------------- /vertica/queries/query2.sql: -------------------------------------------------------------------------------- 1 | \o /dev/null 2 | 3 | SELECT /*+label(query2)*/ * FROM (SELECT friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName,message.id AS messageId,message.creationDate AS messageDate, CASE WHEN message.content is not null THEN message.content ELSE message.imageFile END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) JOIN Post AS message ON (message.id = post_hasCreator_person.post_id) WHERE p_$1.id = 2199023259437 AND message.creationDate <= '2016-7-7' union all SELECT friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName,message.id AS messageId,message.creationDate AS messageDate, CASE WHEN message.content is not null THEN message.content ELSE '' END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) JOIN comment_hasCreator_person ON (comment_hasCreator_person.person_id = friend.id) JOIN Comment AS message ON (message.id = comment_hasCreator_person.comment_id) WHERE p_$1.id = 2199023259437 AND message.creationDate <= '2016-7-7') AS unionAlias ORDER BY messageDate DESC , messageId LIMIT 20; 4 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcdatastructures/Person.py: -------------------------------------------------------------------------------- 1 | class Person: 2 | """Models a Person on LDBC data. Languages and emails are used has an array, as described in the LDBC-SNB data 3 | schema""" 4 | id = 0 5 | firstName = "" 6 | lastName = "" 7 | gender = "" 8 | birthday = "" 9 | creationDate = "" 10 | locationIP = "" 11 | browserUsed = "" 12 | listOfLanguages = [] 13 | listOfEmails = [] 14 | languages = "" 15 | emails = "" 16 | 17 | def __init__(self, row): 18 | self.id = row["id"] 19 | self.firstName = row["firstName"] 20 | self.lastName = row["lastName"] 21 | self.gender = row["gender"] 22 | self.birthday = row["birthday"] 23 | self.creationDate = row["creationDate"] 24 | self.locationIP = row["locationIP"] 25 | self.browserUsed = row["browserUsed"] 26 | self.listOfLanguages = [] 27 | self.listOfEmails = [] 28 | 29 | @staticmethod 30 | def csvFields(): 31 | return ["id", "firstName", "lastName", "gender", "birthday", "creationDate", "locationIP", "browserUsed", 32 | "languages", "emails"] 33 | 34 | def prepareToSerialization(self): 35 | lang = map(lambda x: str(x), self.listOfLanguages) 36 | self.languages = ';'.join(lang) 37 | 38 | mail = map(lambda x: str(x), self.listOfEmails) 39 | self.emails = ';'.join(mail) 40 | -------------------------------------------------------------------------------- /vertica/vertica-ldbc-ingester/ldbcIO/TemplateManager.py: -------------------------------------------------------------------------------- 1 | from jinja2 import FileSystemLoader, Environment 2 | 3 | from ldbcIO.definitions import Definitions 4 | 5 | 6 | class TemplateManager: 7 | """Singleton Template Manager. Used to populate the sql templates.""" 8 | _instances = {} 9 | 10 | env = None 11 | 12 | """Singleton""" 13 | 14 | def __call__(cls, *args, **kwargs): 15 | if cls not in cls._instances: 16 | cls._instances[cls] = super(TemplateManager, cls).__call__(*args, **kwargs) 17 | return cls._instances[cls] 18 | 19 | def populateSqlIngestionTemplate(self, ldbcPath): 20 | print ("[WRITING SQL FILE FROM TEMPLATE]") 21 | template = TemplateManager.env.get_template(Definitions.LDBCDefines.SQL_TEMPLATE_FILE_NAME) 22 | validSql = template.render(LDBC_LOCATION=ldbcPath) 23 | 24 | with open(Definitions.LDBCDefines.OUTPUT_SQL_FILE_NAME, "w") as sqlFile: 25 | print (" - Exporting to file: " + Definitions.LDBCDefines.OUTPUT_SQL_FILE_NAME) 26 | sqlFile.write(validSql) 27 | sqlFile.close() 28 | 29 | @staticmethod 30 | def initTemplateManager(): 31 | templateLoader = FileSystemLoader(searchpath=Definitions.LDBCDefines.TEMPLATE_FILE_PATH) 32 | TemplateManager.env = Environment(loader=templateLoader) 33 | 34 | 35 | # Creates Environment object on application initialisation 36 | TemplateManager.initTemplateManager() 37 | -------------------------------------------------------------------------------- /vertica/queries/query9multihop1.sql: -------------------------------------------------------------------------------- 1 | \o /dev/null 2 | 3 | SELECT /*+label(query9multihop1)*/ DISTINCT * FROM (SELECT DISTINCT message.id AS messageId,message.creationDate AS messageCreationDate,friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName, CASE WHEN message.content is not null THEN message.content ELSE message.imageFile END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS friend 4 | ON (friend.id = person_knows_person.other_person_id) JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) JOIN Post AS message ON (message.id = post_hasCreator_person.post_id) WHERE p_$1.id = 2199023259437 AND message.creationDate < '2016-7-7' union SELECT DISTINCT message.id AS messageId,message.creationDate AS messageCreationDate,friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName, CASE WHEN message.content is not null THEN message.content ELSE '' END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) JOIN comment_hasCreator_person ON (comment_hasCreator_person.person_id = friend.id) JOIN Comment AS message ON (message.id = comment_hasCreator_person.comment_id) WHERE p_$1.id = 2199023259437 AND message.creationDate < '2016-7-7') AS unionAlias ORDER BY messageCreationDate DESC , messageId LIMIT 100; 5 | 6 | -------------------------------------------------------------------------------- /vertica/queries/query8.sql: -------------------------------------------------------------------------------- 1 | \o /dev/null 2 | SELECT /*+label(query8)*/ * FROM (SELECT person.id AS personId,person.firstName AS personFirstName,person.lastName AS personLastName,comment.id AS commentId,comment.creationDate AS commentCreationDate,comment.content AS commentContent FROM person AS start JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = start.id) JOIN Post AS p_$1 ON (p_$1.id = post_hasCreator_person.post_id) JOIN comment_replyOf_post ON (comment_replyOf_post.post_id = p_$1.id) JOIN Comment AS comment ON (comment.id = comment_replyOf_post.comment_id) JOIN comment_hasCreator_person ON (comment_hasCreator_person.comment_id = comment.id) JOIN Person AS person ON (person.id = comment_hasCreator_person.person_id) WHERE start.id = 2199023259437 union all SELECT person.id AS personId,person.firstName AS personFirstName,person.lastName AS personLastName,comment.id AS commentId,comment.creationDate AS commentCreationDate,comment.content AS commentContent FROM person AS start JOIN comment_hasCreator_person ON (comment_hasCreator_person.person_id = start.id) JOIN Comment AS c_$1 ON (c_$1.id = comment_hasCreator_person.comment_id) JOIN comment_replyOf_comment ON (comment_replyOf_comment.other_comment_id = c_$1.id) JOIN Comment AS comment ON (comment.id = comment_replyOf_comment.comment_id) JOIN comment_hasCreator_person AS comment_hasCreator_person_$1 ON (comment_hasCreator_person_$1.comment_id = comment.id) JOIN Person AS person ON (person.id = comment_hasCreator_person_$1.person_id) WHERE start.id = 2199023259437) AS unionAlias ORDER BY commentCreationDate DESC , commentId; 3 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/bulk_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | dataset=("1G" "3G" "10G" "30G" "100G") 4 | 5 | ingesterLoop(){ 6 | for size in "${dataset[@]}"; do 7 | for i in `seq 1 10`; do 8 | echo "$size run $i" 9 | ../neo4j-ldbc-ingester/bulk_ingester.sh "$LDBC_HOME/$size/social_network_ingest" "graph.db" 10 | >> results/bulkbenchmark/$sizeresults.txt 11 | du graph.db -h >> results/bulkbenchmark/$sizesize.txt 12 | rm -rf graph.db 13 | done 14 | done 15 | } 16 | 17 | if [ -z ${NEO4J_HOME} ]; then 18 | echo "NEO4J_HOME enviromental variable value could not been found. Has it been set?" 19 | exit 1; 20 | fi 21 | 22 | if [ -z ${LDBC_HOME} ]; then 23 | echo "LDBC_HOME enviromental variable value could not been found. Has it been set?" 24 | exit 1; 25 | fi 26 | 27 | ############################ Main 28 | 29 | echo " - Change dataset headers? [y/N] " 30 | read response 31 | case $response in [yY][eE][sS]|[yY]) 32 | #change headers of csv files to allow bulk ingester to run 33 | for size in "${dataset[@]}"; do 34 | echo "Changing $size headers" 35 | ../neo4j-ldbc-ingester/change_headers.sh "$LDBC_HOME/$size/social_network_ingest" 36 | done 37 | esac 38 | 39 | #make sure the folder to store the results exists 40 | if [ ! -d "results/bulkbenchmark" ]; then 41 | mkdir -p results/bulkbenchmark 42 | fi 43 | 44 | #remove the previous graph.db folder if it exists to stop the first query breaking 45 | if [ -d "graph.db" ]; then 46 | rm -rf graph.db 47 | fi 48 | 49 | #run the ingester on the different datasets 50 | ingesterLoop -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/query_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Define dataset size dirs located in $base_dir 4 | dataset=("1G" "3G" "10G" "30G" "100G") 5 | 6 | loadDB() { 7 | for size in "${dataset[@]}"; do 8 | DATA_PATH="$LDBC_HOME/$size/social_network_ingest" 9 | 10 | if [ -d $NEO4J_HOME/data/graph.db ]; then 11 | rm -r -f $NEO4J_HOME/data/graph.db 12 | fi 13 | 14 | # Change dir due to python file scope 15 | echo $'\n'"Ingesting and migrating the $1 db into Neo4J..." 16 | (cd ../neo4j-ldbc-ingester && ./bulk_ingester.sh $DATA_PATH $NEO4J_HOME/data/graph.db &> /dev/null) 17 | 18 | # Restart neo4j service 19 | $NEO4J_HOME/bin/neo4j restart 20 | 21 | runQuery $size 22 | done 23 | } 24 | 25 | runQuery() { 26 | # Warm up the silly cache 27 | $NEO4J_HOME/bin/neo4j-shell -file "queries/warm.cypher" &> /dev/null 28 | 29 | echo $'\n'"Running the set of queries in the folder 'queries'..." 30 | for query in `ls -v queries/*.cypher`; do 31 | echo -ne "-- Running query $query\033[K\r"; echo 32 | # Run the query 5 times sequentially 33 | for i in {1..5}; do 34 | echo -ne "\033[K---- Running iteration $i\r" 35 | 36 | # Specify the output folder 37 | result_dir="results/$1/query/iter$i/$(basename $query .cypher)/" 38 | mkdir -p $result_dir 39 | 40 | # Timeout if query exceeds 6 hours 41 | timeout 21600 $NEO4J_HOME/bin/neo4j-shell -file $query > $result_dir"result.txt" 42 | 43 | # it timed out :(! break out of for loop 44 | if [[ $? -ne 0 ]]; then 45 | echo timedout > $result_dir"result.txt"; break; 46 | fi 47 | done 48 | done 49 | } 50 | 51 | loadDB 52 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-benchmark/split_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | dataset=("1G" "3G" "10G" "30G" "100G") 4 | 5 | INGEST_DIR="../neo4j-ldbc-ingester" 6 | INGESTION_CYPHER_FILE="../neo4j-ldbc-ingester/ingestion.cypher" 7 | 8 | ingesterLoop(){ 9 | for size in "${dataset[@]}"; do 10 | for i in `seq 1 10`; do 11 | echo "$size run $i" 12 | echo "$size run $i" >> results/splitbenchmark/$sizeresults.txt 13 | 14 | echo "Running bulk ingester on first half of the data" 15 | ./$INGEST_DIR/bulk_ingester.sh $LDBC_HOME/$size/social_network/0 graph.db 16 | >> results/splitbenchmark/$sizeresults.txt 17 | 18 | echo "Running LOAD_CSV on the second half of the data" 19 | time $NEO4J_HOME"/bin/neo4j-shell" -config $NEO4J_HOME/conf/neo4j-wrapper.conf -path graph.db -file $INGESTION_CYPHER_FILE 20 | >> results/splitbenchmark/$sizeloadresults$i.txt 21 | 22 | du graph.db -h >> results/splitbenchmark/$sizeresults.txt 23 | rm -rf graph.db 24 | done 25 | done 26 | } 27 | 28 | ############################ Main 29 | if [ -z ${LDBC_HOME} ]; then 30 | echo "LDBC_HOME enviromental variable value could not been found. Has it been set?" 31 | exit 1; 32 | fi 33 | 34 | #make sure the folder to store the results exists 35 | if [ ! -d "results/splitbenchmark" ]; 36 | then mkdir results/splitbenchmark 37 | fi 38 | 39 | #remove the previous test folder if it exists to stop the first query breaking 40 | if [ -d "graph.db" ]; 41 | then 42 | rm -rf graph.db 43 | fi 44 | 45 | echo " - Does the data need to be split? [y/N] " 46 | read response 47 | case $response in [yY][eE][sS]|[yY]) 48 | for size in "${dataset[@]}"; do 49 | python $INGEST_DIR/datasplit.py $LDBC_HOME/$size/social_network 50 | ./$INGEST_DIR/change_headers.sh $LDBC_HOME/$size/social_network/0 51 | done 52 | esac 53 | 54 | #run the ingester on the different datasets 55 | ingesterLoop -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/ldbcIO/TemplateManager.py: -------------------------------------------------------------------------------- 1 | from jinja2 import FileSystemLoader, Environment 2 | 3 | from ldbcIO.definitions import Definitions 4 | 5 | 6 | class TemplateManager: 7 | """Singleton Template Manager. Used to populate the cypher/sql templates.""" 8 | _instances = {} 9 | 10 | env = None 11 | 12 | """Singleton""" 13 | 14 | def __call__(cls, *args, **kwargs): 15 | if cls not in cls._instances: 16 | cls._instances[cls] = super(TemplateManager, cls).__call__(*args, **kwargs) 17 | return cls._instances[cls] 18 | 19 | def populateCypherIngestionTemplate(self, ldbcPath): 20 | print ("[WRITING CYPHER FILE FROM TEMPLATE]") 21 | template = TemplateManager.env.get_template(Definitions.LDBCDefines.TEMPLATE_FILE_NAME) 22 | validCypher = template.render(LDBC_LOCATION=ldbcPath) 23 | 24 | with open(Definitions.LDBCDefines.OUTPUT_CYPHER_FILE_NAME, "w") as cypherFile: 25 | print (" - Exporting to file: " + Definitions.LDBCDefines.OUTPUT_CYPHER_FILE_NAME) 26 | cypherFile.write(validCypher) 27 | cypherFile.close() 28 | 29 | 30 | def populateSqlIngestionTemplate(self, ldbcPath): 31 | print ("[WRITING SQL FILE FROM TEMPLATE]") 32 | template = TemplateManager.env.get_template(Definitions.LDBCDefines.SQL_TEMPLATE_FILE_NAME) 33 | validSql = template.render(LDBC_LOCATION=ldbcPath) 34 | 35 | with open(Definitions.LDBCDefines.OUTPUT_SQL_FILE_NAME, "w") as sqlFile: 36 | print (" - Exporting to file: " + Definitions.LDBCDefines.OUTPUT_SQL_FILE_NAME) 37 | sqlFile.write(validSql) 38 | sqlFile.close() 39 | 40 | @staticmethod 41 | def initTemplateManager(): 42 | templateLoader = FileSystemLoader(searchpath=Definitions.LDBCDefines.TEMPLATE_FILE_PATH) 43 | TemplateManager.env = Environment(loader=templateLoader) 44 | 45 | 46 | # Creates Environment object on application initialisation 47 | TemplateManager.initTemplateManager() 48 | -------------------------------------------------------------------------------- /sqlgraph/resources/queries/query9multihop1.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | creator.ATTR->'$.FIRST_NAME' AS firstName, 3 | creator.ATTR->'$.LAST_NAME' AS lastName, 4 | message.VID AS commentId, 5 | IF ( 6 | message.ATTR->'$.CONTENT' = "", 7 | message.ATTR->'$.IMAGE_FILE', 8 | message.ATTR->'$.CONTENT' 9 | ) content, 10 | message.ATTR->'$.CREATION_DATE' AS creationdate 11 | FROM ( 12 | SELECT 13 | friends.VID AS personId, 14 | CASE 15 | WHEN friends.LBL1 = "HAS_CREATOR" THEN friends.VAL1 16 | WHEN friends.LBL2 = "HAS_CREATOR" THEN friends.VAL2 17 | WHEN friends.LBL3 = "HAS_CREATOR" THEN friends.VAL3 18 | WHEN friends.LBL4 = "HAS_CREATOR" THEN friends.VAL4 19 | WHEN friends.LBL5 = "HAS_CREATOR" THEN friends.VAL5 20 | WHEN friends.LBL6 = "HAS_CREATOR" THEN friends.VAL6 21 | WHEN friends.LBL7 = "HAS_CREATOR" THEN friends.VAL7 22 | WHEN friends.LBL8 = "HAS_CREATOR" THEN friends.VAL8 23 | WHEN friends.LBL9 = "HAS_CREATOR" THEN friends.VAL9 24 | END AS hasMessage 25 | FROM ( 26 | SELECT 27 | CASE 28 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 29 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 30 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 31 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 32 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 33 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 34 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 35 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 36 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 37 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 38 | END AS knows 39 | FROM OPA person 40 | WHERE person.VID = 1502199023259437 41 | ) AS person_relation 42 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 43 | JOIN IPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 44 | ) AS f_fof_messages 45 | LEFT JOIN ISA has_message ON (has_message.VALID = hasMessage) 46 | JOIN VA message ON COALESCE(has_message.VAL, hasMessage) = message.VID 47 | JOIN VA creator ON (creator.VID = personId) 48 | ORDER BY creationDate Desc, message.VID 49 | LIMIT 20; 50 | -------------------------------------------------------------------------------- /results/readme.md: -------------------------------------------------------------------------------- 1 | #Acquired results 2 | 3 | Following folder contains acquired results from the comparative benchmarks between [Vertica, SqlGraph and Neo4J]. The source code for respective benchmark may be found under the master branch. These results may either be browsed in raw text format or ran as part of a GUI style R-shinyapp. 4 | 5 | ##Script Structure 6 | ```html 7 | GUI\app.R : Main shinyapp script, containing both server and ui. 8 | \result_loader.R : Utiltiy script for loading and parsing the results. 9 | \results\ : Directory containing benchmark results in raw txt format. 10 | ``` 11 | 12 | ##Quick Start 13 | To setup the shinyapp server make sure that R base latest version is installed. Then simply cd into the script folder and run following command in terminal. 14 | 15 | ```bash 16 | Rscript app.R 17 | ``` 18 | 19 | The above will create and setup a Shiny app server which may be accessible on 0.0.0.0:8737. To change default subnet mask and port number simply open up the file *app.R*, navigate to the bottom where the shiny object is created, and change the corresponding passed arguments. 20 | 21 | Alternatively, you may also run the attached script files in Rstudio. Just make sure to set the working directory to that of the source file. This can be accessed under session settings. 22 | 23 | ##Observations 24 | 25 | Due to the large number of combinations (queries, dataset, storage size, etc.) we believe that grouping and displaying the results as part of a graphical user interface would allow for a more organized display. As explained above, the result set have also been given in raw format. This is for anyone that wish to manipulate or display the result in the form that they wish. 26 | 27 | It's worth noting that all query execution times are an acquired mean average, ignoring the first run (to allow for a fair comparison eliminating cache and warm up time). Additionally, any query result set with an execution time of 21600000 indicates a timeout. These queries are omitted from the dataframe and are chosen not to be displayed in the R script. 28 | 29 | -------- 30 | 31 | * As a last note, any suggestions, improvement or contribution to the code base are sincerely welcome. 32 | -------------------------------------------------------------------------------- /neo4j/conf/neo4j.properties: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # Neo4j 3 | # 4 | # neo4j.properties - database tuning parameters 5 | # 6 | ################################################################ 7 | 8 | # Enable this to be able to upgrade a store from an older version. 9 | #allow_store_upgrade=true 10 | 11 | # The amount of memory to use for mapping the store files, in bytes (or 12 | # kilobytes with the 'k' suffix, megabytes with 'm' and gigabytes with 'g'). 13 | # If Neo4j is running on a dedicated server, then it is generally recommended 14 | # to leave about 2-4 gigabytes for the operating system, give the JVM enough 15 | # heap to hold all your transaction state and query context, and then leave the 16 | # rest for the page cache. 17 | # The default page cache memory assumes the machine is dedicated to running 18 | # Neo4j, and is heuristically set to 50% of RAM minus the max Java heap size. 19 | #dbms.pagecache.memory=10g 20 | 21 | # Enable this to specify a parser other than the default one. 22 | #cypher_parser_version=2.0 23 | 24 | # Set the root directory for use with file URLs (`file:///`) in LOAD CSV. 25 | # If enabled, file URLs will refer to locations inside the `data/import` 26 | # directory. I.e. `file:///movies/actors.csv` will load from the file 27 | # `data/import/movies/actors.csv`. 28 | #dbms.security.load_csv_file_url_root=data/import 29 | 30 | # Keep logical logs, helps debugging but uses more disk space, enabled for 31 | # legacy reasons To limit space needed to store historical logs use values such 32 | # as: "7 days" or "100M size" instead of "true". 33 | keep_logical_logs=100M size 34 | 35 | # Enable shell server so that remote clients can connect via Neo4j shell. 36 | #remote_shell_enabled=true 37 | # The network interface IP the shell will listen on (use 0.0.0.0 for all interfaces). 38 | #remote_shell_host=127.0.0.1 39 | # The port the shell will listen on, default is 1337. 40 | #remote_shell_port=1337 41 | 42 | 43 | # =========================================================== 44 | # Config by Alnaimi 45 | # =========================================================== 46 | 47 | use_memory_mapped_buffers=true 48 | 49 | # Propertystore size of 100G data + more than enough margin 50 | dbms.pagecache.memory=360g 51 | 52 | # Increase min replan to avoid timeout 53 | dbms.cypher.min_replan_interval=21600s 54 | -------------------------------------------------------------------------------- /sqlgraph/resources/queries/query2.sql: -------------------------------------------------------------------------------- 1 | # Query 2: Recent Posts and Comments by your Friends 2 | # ==================================================================================================================== 3 | 4 | SELECT 5 | friendId, 6 | people.ATTR->'$.FIRST_NAME' AS firstName, 7 | people.ATTR->'$.LAST_NAME' AS lastName, 8 | IF ( 9 | message.ATTR->'$.CONTENT' = "", 10 | message.ATTR->'$.IMAGE_FILE', 11 | message.ATTR->'$.CONTENT' 12 | ) content, 13 | message.ATTR->'$.CREATION_DATE' as creationDate 14 | FROM ( 15 | SELECT 16 | friends.VID AS friendId, 17 | CASE 18 | WHEN friends.LBL1 = "HAS_CREATOR" THEN friends.VAL1 19 | WHEN friends.LBL2 = "HAS_CREATOR" THEN friends.VAL2 20 | WHEN friends.LBL3 = "HAS_CREATOR" THEN friends.VAL3 21 | WHEN friends.LBL4 = "HAS_CREATOR" THEN friends.VAL4 22 | WHEN friends.LBL5 = "HAS_CREATOR" THEN friends.VAL5 23 | WHEN friends.LBL6 = "HAS_CREATOR" THEN friends.VAL6 24 | WHEN friends.LBL7 = "HAS_CREATOR" THEN friends.VAL7 25 | WHEN friends.LBL8 = "HAS_CREATOR" THEN friends.VAL8 26 | WHEN friends.LBL9 = "HAS_CREATOR" THEN friends.VAL9 27 | WHEN friends.LBL10 = "HAS_CREATOR" THEN friends.VAL10 28 | END AS hasCreator 29 | FROM ( 30 | SELECT 31 | CASE 32 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 33 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 34 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 35 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 36 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 37 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 38 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 39 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 40 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 41 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 42 | END AS knows 43 | FROM OPA person 44 | WHERE person.VID = 1502199023259437 45 | ) AS person_relation 46 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 47 | JOIN IPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 48 | ) AS has_creator 49 | JOIN VA people ON (people.VID = has_creator.friendId) 50 | LEFT JOIN ISA message_relation ON (message_relation.VALID = has_creator.hasCreator) 51 | JOIN VA message ON COALESCE(message_relation.VAL, has_creator.hasCreator) = message.VID 52 | WHERE message.ATTR->'$.CREATION_DATE' <= "2016-07-07" 53 | ORDER BY creationDate Desc, friendId 54 | LIMIT 20; -------------------------------------------------------------------------------- /vertica/queries/batchtest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## This script depends on the ingestion scripts having been added to a directory called 'datascripts' 3 | ## for each test run size 4 | ## 5 | ## For the collection of the data size it is assumed the Vertica data is stored in /data. 6 | ## 7 | ## Steps of script 8 | ## - Attempts to create the database (named LDBCx - then the run size - for example LDBCx30GB) 9 | ## - Starts the database 10 | ## - Run the data loading 11 | ## - Sleeps for 20 mins (to allow Vertica to compress data) 12 | ## - Runs the query tests - each test is run non cached and cached. 13 | ## - Runs the query designer 14 | ## - Sleeps for 20 mins to make sure Vertica has settled 15 | ## - Repeats the query tests 16 | ## - Finally it stops the database 17 | 18 | SIZE=(1GB 3GB 10GB 30GB 100GB) 19 | 20 | function collectDataSize { 21 | TOTAL_SIZE=0 22 | # Read vertica ips from property file and gather their data sizes 23 | while read p; do 24 | INSTANCE_SIZE=$(ssh $p "du -bs /data/LDBCx$1 | cut -f1") 25 | TOTAL_SIZE=$(($TOTAL_SIZE + $INSTANCE_SIZE)) 26 | done > test/totalSize.txt 31 | } 32 | 33 | for i in ${SIZE[@]}; do 34 | echo "datascripts/ingestion${i}.sql" 35 | if [ ! -f "datascripts/ingestion${i}.sql" ]; then 36 | echo "Couldn't find ingestion file, please create and put in in datascripts directory file name ingestion${i}.sql" 37 | exit 1 38 | fi 39 | 40 | # Remove DB if it exists 41 | adminTools --tool drop_db -d "LDBCx${i}" 42 | # Read vertica ips from property file 43 | NODE_IPS="" 44 | while read p; do 45 | if [ ! -z $NODE_IPS ]; then 46 | NODE_IPS=$NODE_IPS, 47 | fi 48 | NODE_IPS=$NODE_IPS$p 49 | done > test/ingestionTime.txt 57 | 58 | echo "sleeping for 20 mins" 59 | sleep 20m 60 | 61 | collectDataSize ${i} "withoutProjections" 62 | 63 | ./query_test.sh ${i} "withoutProjections" 64 | ./run_designer.sh 65 | 66 | echo "sleep for 20 mins" 67 | sleep 20m 68 | 69 | ./query_test.sh ${i} "withProjections" 70 | 71 | collectDataSize ${i} "withProjections" 72 | 73 | adminTools --tool stop_db -d "LDBCx${i}" 74 | done 75 | -------------------------------------------------------------------------------- /vertica/queries/query11.sql: -------------------------------------------------------------------------------- 1 | \o /dev/null 2 | 3 | -- Manual created using the cypher2sql output as the starting point. 4 | 5 | 6 | WITH SUB_2043610698 AS ( 7 | SELECT friend.id,'Person('||friend.id||')' AS friend,friend.id AS friendId,friend.firstName AS friendFirstName,friend.lastName AS friendLastName FROM person AS person JOIN person_knows_person ON (person_knows_person.person_id = person.id) JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) WHERE person.id = 2199023259437 AND person.id != friend.id 8 | ), SUB_1296752076 AS ( 9 | SELECT friend.id,'Person('||friend.id||')' AS friend,friend.id AS friendId,friendFirstName,friendLastName,company.name AS companyName, worksAt.workFrom AS workFrom FROM SUB_2043610698 AS friend JOIN person_workAt_company AS worksAt ON (worksAt.person_id = friend.id) JOIN Company AS company ON (company.id = worksAt.company_id) JOIN company_isLocatedIn_country ON (company_isLocatedIn_country.company_id = company.id) JOIN Country AS c_$1 ON (c_$1.id = company_isLocatedIn_country.country_id) WHERE worksAt.workFrom < '2016-7-7' and c_$1.url = 'http://dbpedia.org/resource/France' 10 | ), SUB_1166431844 AS ( 11 | SELECT friend.id,'Person('||friend.id||')' AS friend,friend.id AS friendId,friend.firstName AS friendFirstName,friend.lastName AS friendLastName FROM person AS person JOIN person_knows_person ON (person_knows_person.person_id = person.id) JOIN Person AS p_$1 ON (p_$1.id = person_knows_person.other_person_id) JOIN person_knows_person AS person_knows_person_$1 ON (person_knows_person_$1.person_id = p_$1.id) JOIN Person AS friend ON (friend.id = person_knows_person_$1.other_person_id) WHERE person.id = 2199023259437 AND person.id != friend.id 12 | ), SUB_1296752075 AS ( 13 | SELECT friend.id,'Person('||friend.id||')' AS friend,friend.id AS friendId,friendFirstName,friendLastName,company.name AS companyName, worksAt.workFrom AS workFrom FROM SUB_1166431844 AS friend JOIN person_workAt_company AS worksAt ON (worksAt.person_id = friend.id) JOIN Company AS company ON (company.id = worksAt.company_id) JOIN company_isLocatedIn_country ON (company_isLocatedIn_country.company_id = company.id) JOIN Country AS c_$1 ON (c_$1.id = company_isLocatedIn_country.country_id) WHERE worksAt.workFrom < '2016-7-7' and c_$1.url = 'http://dbpedia.org/resource/France' 14 | ) 15 | SELECT /*+label(query11)*/ * FROM ( 16 | SELECT workFrom AS workFromYear,SUB_1296752076.id AS friendId,SUB_1296752076.friendFirstName,SUB_1296752076.friendLastName,SUB_1296752076.companyName FROM SUB_1296752076 17 | union 18 | SELECT workFrom AS workFromYear,SUB_1296752075.id AS friendId,SUB_1296752075.friendFirstName,SUB_1296752075.friendLastName,SUB_1296752075.companyName FROM SUB_1296752075 19 | ) AS unionAlias ORDER BY workFromYear, friendId, companyName DESC LIMIT 100; 20 | 21 | -------------------------------------------------------------------------------- /neo4j/conf/neo4j-wrapper.conf: -------------------------------------------------------------------------------- 1 | #******************************************************************** 2 | # Property file references 3 | #******************************************************************** 4 | 5 | wrapper.java.additional=-Dorg.neo4j.server.properties=/data/benchmark/neo4j/conf/neo4j-server.properties 6 | wrapper.java.additional=-Dlog4j.configuration=file:/data/benchmark/neo4j/conf/log4j.properties 7 | 8 | #******************************************************************** 9 | # Wrapper settings 10 | #******************************************************************** 11 | # path is relative to the bin dir 12 | wrapper.pidfile=/data/benchmark/neo4j/data/neo4j-server.pid 13 | 14 | #******************************************************************** 15 | # Wrapper Windows NT/2000/XP Service Properties 16 | #******************************************************************** 17 | # WARNING - Do not modify any of these properties when an application 18 | # using this configuration file has been installed as a service. 19 | # Please uninstall the service before modifying this section. The 20 | # service can then be reinstalled. 21 | 22 | # Name of the service 23 | wrapper.name=neo4j 24 | 25 | # User account to be used for linux installs. Will default to current 26 | # user if not set. 27 | wrapper.user= 28 | 29 | #******************************************************************** 30 | # Other Neo4j system properties 31 | #******************************************************************** 32 | wrapper.java.additional=-Dneo4j.ext.udc.source=tarball 33 | 34 | # ================================================================= 35 | # Config by Alnaimi 36 | # The below, are to our knowledge, full parameter tuning for jvm 37 | # ================================================================= 38 | 39 | # Heap size for java. Init and max are same to avoid dynamic growth 40 | wrapper.java.initmemory=65500 41 | wrapper.java.maxmemory=65500 42 | 43 | # Same for the database heap size. Do not recommend to increase 44 | # further, as it seems to produce spikes 45 | dbms.memory.heap.initial_size=128000 46 | dbms.memory.heap.max_size=128000 47 | dbms.jvm.additional=-XX:NewRatio=2 48 | 49 | # Set Garbage collector type to G1 (better for large heap sizes) 50 | dbms.jvm.additional=-XX:+UseG1GC 51 | 52 | # too slow (up to 32sec younggen gc) 53 | #dbms.jvm.additional=-XX:+UseConcMarkSweepGC 54 | #dbms.jvm.additional=-XX:+ParallelGCThreads=30 55 | 56 | # Enable GC logging for heap inspection 57 | wrapper.java.additional=-Xloggc:data/log/neo4j-gc.log 58 | wrapper.java.additional=-XX:+PrintGCDetails 59 | wrapper.java.additional=-XX:+PrintGCDateStamps 60 | wrapper.java.additional=-XX:+PrintGCApplicationStoppedTime 61 | wrapper.java.additional=-XX:+PrintPromotionFailure 62 | wrapper.java.additional=-XX:+PrintTenuringDistribution 63 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/bulk_ingester.sh: -------------------------------------------------------------------------------- 1 | #This file contains the LDBC import command using the Neo4J import tool 2 | #The sytax is fairly self explainitory, but for a better understanding 3 | #the usage documents can be accessed via the wayback machine 4 | #as the actual page 404's : 5 | #https://web.archive.org/web/20160329053359/http://neo4j.com/docs/milestone/import-tool-usage.html 6 | 7 | DATA_LOCATION=$1 8 | FOLDER_NAME=$2 9 | 10 | echo "Populating NEO4J LDBC database" 11 | 12 | $NEO4J_HOME/bin/neo4j-import \ 13 | --into $FOLDER_NAME \ 14 | --delimiter '|' \ 15 | --id-type integer \ 16 | --nodes:Person $DATA_LOCATION/person_complete_0_0.csv \ 17 | --nodes:City:Place $DATA_LOCATION/city_0_0.csv \ 18 | --nodes:Country:Place $DATA_LOCATION/country_0_0.csv \ 19 | --nodes:Continent:Place $DATA_LOCATION/continent_0_0.csv \ 20 | --nodes:Forum $DATA_LOCATION/forum_0_0.csv \ 21 | --nodes:Post:Message $DATA_LOCATION/post_0_0.csv \ 22 | --nodes:Comment:Message $DATA_LOCATION/comment_0_0.csv \ 23 | --nodes:Company:Organisation $DATA_LOCATION/company_0_0.csv \ 24 | --nodes:University:Organisation $DATA_LOCATION/university_0_0.csv \ 25 | --nodes:Tag $DATA_LOCATION/tag_0_0.csv \ 26 | --nodes:TagClass $DATA_LOCATION/tagclass_0_0.csv \ 27 | --relationships:IS_SUBCLASS_OF $DATA_LOCATION/tagclass_isSubclassOf_tagclass_0_0.csv \ 28 | --relationships:HAS_TYPE $DATA_LOCATION/tag_hasType_tagclass_0_0.csv \ 29 | --relationships:KNOWS $DATA_LOCATION/person_knows_person_0_0.csv \ 30 | --relationships:IS_LOCATED_IN $DATA_LOCATION/person_isLocatedIn_place_0_0.csv \ 31 | --relationships:HAS_INTEREST $DATA_LOCATION/person_hasInterest_tag_0_0.csv \ 32 | --relationships:LIKES $DATA_LOCATION/person_likes_post_0_0.csv \ 33 | --relationships:LIKES $DATA_LOCATION/person_likes_comment_0_0.csv \ 34 | --relationships:STUDY_AT $DATA_LOCATION/person_studyAt_organisation_0_0.csv \ 35 | --relationships:WORKS_AT $DATA_LOCATION/person_workAt_organisation_0_0.csv \ 36 | --relationships:IS_LOCATED_IN $DATA_LOCATION/organisation_isLocatedIn_place_0_0.csv \ 37 | --relationships:IS_PART_OF $DATA_LOCATION/place_isPartOf_place_0_0.csv \ 38 | --relationships:HAS_CREATOR $DATA_LOCATION/comment_hasCreator_person_0_0.csv \ 39 | --relationships:HAS_CREATOR $DATA_LOCATION/post_hasCreator_person_0_0.csv \ 40 | --relationships:HAS_TAG $DATA_LOCATION/comment_hasTag_tag_0_0.csv \ 41 | --relationships:HAS_TAG $DATA_LOCATION/post_hasTag_tag_0_0.csv \ 42 | --relationships:REPLY_OF $DATA_LOCATION/comment_replyOf_comment_0_0.csv \ 43 | --relationships:REPLY_OF $DATA_LOCATION/comment_replyOf_post_0_0.csv \ 44 | --relationships:IS_LOCATED_IN $DATA_LOCATION/comment_isLocatedIn_place_0_0.csv \ 45 | --relationships:IS_LOCATED_IN $DATA_LOCATION/post_isLocatedIn_place_0_0.csv \ 46 | --relationships:HAS_MEMBER $DATA_LOCATION/forum_hasMember_person_0_0.csv \ 47 | --relationships:HAS_MODERATOR $DATA_LOCATION/forum_hasModerator_person_0_0.csv \ 48 | --relationships:CONTAINER_OF $DATA_LOCATION/forum_containerOf_post_0_0.csv \ 49 | --relationships:HAS_TAG $DATA_LOCATION/forum_hasTag_tag_0_0.csv 50 | 51 | -------------------------------------------------------------------------------- /vertica/queries/query9.sql: -------------------------------------------------------------------------------- 1 | \o /dev/null 2 | SELECT /*+label(query9)*/ DISTINCT * FROM (SELECT DISTINCT message.id AS messageId,message.creationDate AS messageCreationDate,friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName, CASE WHEN message.content is not null THEN message.content ELSE '' END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS p_$2 ON (p_$2.id = person_knows_person.other_person_id) JOIN person_knows_person AS person_knows_person_$1 ON (person_knows_person_$1.person_id = p_$2.id) JOIN Person AS friend ON (friend.id = person_knows_person_$1.other_person_id) JOIN comment_hasCreator_person ON (comment_hasCreator_person.person_id = friend.id) JOIN Comment AS message ON (message.id = comment_hasCreator_person.comment_id) WHERE p_$1.id = 2199023259437 AND message.creationDate < '2016-7-7' union SELECT DISTINCT message.id AS messageId,message.creationDate AS messageCreationDate,friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName, CASE WHEN message.content is not null THEN message.content ELSE message.imageFile END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) JOIN Post AS message ON (message.id = post_hasCreator_person.post_id) WHERE p_$1.id = 2199023259437 AND message.creationDate < '2016-7-7' union SELECT DISTINCT message.id AS messageId,message.creationDate AS messageCreationDate,friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName, CASE WHEN message.content is not null THEN message.content ELSE message.imageFile END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS p_$2 ON (p_$2.id = person_knows_person.other_person_id) JOIN person_knows_person AS person_knows_person_$1 ON (person_knows_person_$1.person_id = p_$2.id) JOIN Person AS friend ON (friend.id = person_knows_person_$1.other_person_id) JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) JOIN Post AS message ON (message.id = post_hasCreator_person.post_id) WHERE p_$1.id = 2199023259437 AND message.creationDate < '2016-7-7' union SELECT DISTINCT message.id AS messageId,message.creationDate AS messageCreationDate,friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName, CASE WHEN message.content is not null THEN message.content ELSE '' END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) JOIN comment_hasCreator_person ON (comment_hasCreator_person.person_id = friend.id) JOIN Comment AS message ON (message.id = comment_hasCreator_person.comment_id) WHERE p_$1.id = 2199023259437 AND message.creationDate < '2016-7-7') AS unionAlias ORDER BY messageCreationDate DESC , messageId LIMIT 100; 3 | -------------------------------------------------------------------------------- /vertica/queries/query9multihop2.sql: -------------------------------------------------------------------------------- 1 | \o /dev/null 2 | 3 | SELECT /*+label(query9multihop2)*/ DISTINCT * FROM (SELECT DISTINCT message.id AS messageId,message.creationDate AS messageCreationDate,friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName, CASE WHEN message.content is not null THEN message.content ELSE '' END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS p_$2 ON (p_$2.id = person_knows_person.other_person_id) JOIN person_knows_person AS person_knows_person_$1 ON (person_knows_person_$1.person_id = p_$2.id) JOIN Person AS friend ON (friend.id = person_knows_person_$1.other_person_id) JOIN comment_hasCreator_person ON (comment_hasCreator_person.person_id = friend.id) JOIN Comment AS message ON (message.id = comment_hasCreator_person.comment_id) WHERE p_$1.id = 2199023259437 AND message.creationDate < '2016-7-7' union SELECT DISTINCT message.id AS messageId,message.creationDate AS messageCreationDate,friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName, CASE WHEN message.content is not null THEN message.content ELSE message.imageFile END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) JOIN Post AS message ON (message.id = post_hasCreator_person.post_id) WHERE p_$1.id = 2199023259437 AND message.creationDate < '2016-7-7' union SELECT DISTINCT message.id AS messageId,message.creationDate AS messageCreationDate,friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName, CASE WHEN message.content is not null THEN message.content ELSE message.imageFile END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS p_$2 ON (p_$2.id = person_knows_person.other_person_id) JOIN person_knows_person AS person_knows_person_$1 ON (person_knows_person_$1.person_id = p_$2.id) JOIN Person AS friend ON (friend.id = person_knows_person_$1.other_person_id) JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) JOIN Post AS message ON (message.id = post_hasCreator_person.post_id) WHERE p_$1.id = 2199023259437 AND message.creationDate < '2016-7-7' union SELECT DISTINCT message.id AS messageId,message.creationDate AS messageCreationDate,friend.id AS personId,friend.firstName AS personFirstName,friend.lastName AS personLastName, CASE WHEN message.content is not null THEN message.content ELSE '' END AS messageContent FROM person AS p_$1 JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) JOIN comment_hasCreator_person ON (comment_hasCreator_person.person_id = friend.id) JOIN Comment AS message ON (message.id = comment_hasCreator_person.comment_id) WHERE p_$1.id = 2199023259437 AND message.creationDate < '2016-7-7') AS unionAlias ORDER BY messageCreationDate DESC , messageId LIMIT 100; 4 | -------------------------------------------------------------------------------- /sqlgraph/resources/queries/query8.sql: -------------------------------------------------------------------------------- 1 | # Query 8: Recent Replies 2 | # ==================================================================================================================== 3 | 4 | SELECT 5 | creator.ATTR->'$.FIRST_NAME' AS firstName, 6 | creator.ATTR->'$.LAST_NAME' AS lastName, 7 | comment.VID AS commentId, 8 | comment.ATTR->'$.CONTENT' AS content, 9 | comment.ATTR->'$.CREATION_DATE' AS creationdate 10 | FROM ( 11 | SELECT 12 | CASE 13 | WHEN message_relations.LBL1 = "REPLY_OF" THEN message_relations.VAL1 14 | WHEN message_relations.LBL2 = "REPLY_OF" THEN message_relations.VAL2 15 | WHEN message_relations.LBL3 = "REPLY_OF" THEN message_relations.VAL3 16 | WHEN message_relations.LBL4 = "REPLY_OF" THEN message_relations.VAL4 17 | WHEN message_relations.LBL5 = "REPLY_OF" THEN message_relations.VAL5 18 | WHEN message_relations.LBL6 = "REPLY_OF" THEN message_relations.VAL6 19 | WHEN message_relations.LBL7 = "REPLY_OF" THEN message_relations.VAL7 20 | WHEN message_relations.LBL8 = "REPLY_OF" THEN message_relations.VAL8 21 | WHEN message_relations.LBL9 = "REPLY_OF" THEN message_relations.VAL9 22 | WHEN message_relations.LBL10 = "REPLY_OF" THEN message_relations.VAL10 23 | END AS replyId 24 | FROM IPA person 25 | JOIN ISA messages ON CASE 26 | WHEN person.LBL1 = "HAS_CREATOR" THEN person.VAL1 27 | WHEN person.LBL2 = "HAS_CREATOR" THEN person.VAL2 28 | WHEN person.LBL3 = "HAS_CREATOR" THEN person.VAL3 29 | WHEN person.LBL4 = "HAS_CREATOR" THEN person.VAL4 30 | WHEN person.LBL5 = "HAS_CREATOR" THEN person.VAL5 31 | WHEN person.LBL6 = "HAS_CREATOR" THEN person.VAL6 32 | WHEN person.LBL7 = "HAS_CREATOR" THEN person.VAL7 33 | WHEN person.LBL8 = "HAS_CREATOR" THEN person.VAL8 34 | WHEN person.LBL9 = "HAS_CREATOR" THEN person.VAL9 35 | WHEN person.LBL10 = "HAS_CREATOR" THEN person.VAL10 36 | END = messages.VALID 37 | JOIN IPA message_relations ON (message_relations.VID = messages.VAL) 38 | WHERE person.VID = 1502199023259437 39 | ) AS reply_relation 40 | LEFT JOIN ISA ON CASE 41 | WHEN reply_relation.replyId LIKE "-%" THEN reply_relation.replyId 42 | END = VALID 43 | JOIN VA comment ON IF(replyId LIKE "-%", VAL, replyId) = VID 44 | JOIN OPA comment_relation ON (comment_relation.VID = comment.VID) 45 | JOIN VA creator ON CASE 46 | WHEN comment_relation.LBL1 = "HAS_CREATOR" THEN comment_relation.VAL1 47 | WHEN comment_relation.LBL2 = "HAS_CREATOR" THEN comment_relation.VAL2 48 | WHEN comment_relation.LBL3 = "HAS_CREATOR" THEN comment_relation.VAL3 49 | WHEN comment_relation.LBL4 = "HAS_CREATOR" THEN comment_relation.VAL4 50 | WHEN comment_relation.LBL5 = "HAS_CREATOR" THEN comment_relation.VAL5 51 | WHEN comment_relation.LBL6 = "HAS_CREATOR" THEN comment_relation.VAL6 52 | WHEN comment_relation.LBL7 = "HAS_CREATOR" THEN comment_relation.VAL7 53 | WHEN comment_relation.LBL8 = "HAS_CREATOR" THEN comment_relation.VAL8 54 | WHEN comment_relation.LBL9 = "HAS_CREATOR" THEN comment_relation.VAL9 55 | WHEN comment_relation.LBL10 = "HAS_CREATOR" THEN comment_relation.VAL10 56 | END = creator.VID 57 | WHERE reply_relation.replyId IS NOT NULL 58 | ORDER BY creationDate Desc, comment.VID 59 | LIMIT 20; 60 | -------------------------------------------------------------------------------- /results/app.R: -------------------------------------------------------------------------------- 1 | ipak <- function(pkg) { 2 | new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])] 3 | if (length(new.pkg)) 4 | install.packages(new.pkg, dependencies = TRUE, repos='http://cran.us.r-project.org') 5 | sapply(pkg, require, character.only = TRUE) 6 | } 7 | 8 | # list of packages needed, apssed to ipak 9 | packages <- c("shiny", "ggplot2", "devtools", "plotly") 10 | ipak(packages) 11 | 12 | # Define server logic required to plot various variables against mpg 13 | server <- function(input, output) { 14 | # load class functions 15 | source("result_loader.R") 16 | 17 | # load result data from dir 18 | m.data <- load_mdata() 19 | q.times <- load_qtimes() 20 | 21 | sliderValues <- reactive({ 22 | values <- list() 23 | 24 | values$sele <- input$select 25 | values$migr <- input$migr 26 | values$qnum <- input$qnum 27 | values$fit <- input$fit 28 | 29 | values 30 | }) 31 | 32 | output$plot <- renderPlotly({ 33 | val <- sliderValues() 34 | 35 | # Check selected list item 36 | if (val$sele == 1) { # data migration 37 | if(val$migr == 1) { # migration time 38 | p <- migr_times(m.data[["time"]]) 39 | } 40 | if(val$migr == 2) { # database size 41 | p <- data_size(m.data[["size"]]) 42 | } 43 | } 44 | 45 | if (val$sele == 2) { # query execution 46 | df <- q.times[[val$qnum]] 47 | fi <- val$fit 48 | p <- exec_times(df, fi) 49 | } 50 | 51 | # p$x$layout$annotations[[6]]$text <- "" 52 | m = list(l = 70, r = 80, b = 40, t = 80) 53 | p %>% layout(margin = m) 54 | }) 55 | 56 | output$text <- renderText({ 57 | val <- sliderValues() 58 | 59 | if(val $sele == 2) { # query execution 60 | "Note that missing graphs/points indiciate a timeout ( > 6 hours)." 61 | } 62 | }) 63 | } 64 | 65 | 66 | # Define UI for miles per gallon application 67 | ui <- shinyUI(fluidPage( 68 | title = "Execution times", 69 | plotlyOutput("plot"), 70 | textOutput("text"), 71 | 72 | # Sidebar with controls to select the variable to plot against mpg 73 | # and to specify whether outliers should be included 74 | fluidRow( 75 | column(3, 76 | h4("Benchmark Metrics"), 77 | selectInput("select", label = "Show results for", choices = list("Data migration" = 1, "Query execution" = 2), selected = 1), 78 | 79 | conditionalPanel( 80 | condition = "input.select == 1", 81 | selectInput("migr", label = "Option", choices = list("Migration time" = 1, "Database size" = 2), selected = 1) 82 | ), 83 | 84 | conditionalPanel( 85 | condition = "input.select == 2", 86 | selectInput("qnum", label = "Query", choices = list('2' = 2, '6' = 6, '8' = 8, '9 hop 1' = "9multihop1", 87 | '9 hop 2' = "9multihop2", '9 hop 3' = "9multihop3", '9 hop 4' = "9multihop4", '9 hop 5' = "9multihop5", 88 | '11' = 11), selected = 2), 89 | selectInput("fit", label = "Fit model", choices = list('None' = 1, 'Linear' = 2, 'Loess' = 3), selected = 1) 90 | ) 91 | ) 92 | ) 93 | )) 94 | 95 | # Running the Shiny app object with conf 96 | app <- shinyApp(ui = ui, server = server) 97 | runApp(appDir = app, port = getOption("shiny.port", 7831), host = getOption("shiny.host", "0.0.0.0")) 98 | -------------------------------------------------------------------------------- /sqlgraph/resources/ldbc.ddl: -------------------------------------------------------------------------------- 1 | -- Outgoing Primary Adjacency (IPA) 2 | -- I am assuming 10 edges per vertice/row. 3 | 4 | CREATE TABLE OPA 5 | ( 6 | VID BIGINT NOT NULL, 7 | TYPE VARCHAR(20), 8 | SPILL BIT NOT NULL, 9 | EID1 BIGINT, 10 | LBL1 VARCHAR(32), 11 | VAL1 BIGINT, 12 | EID2 BIGINT , 13 | LBL2 VARCHAR(32), 14 | VAL2 BIGINT, 15 | EID3 BIGINT, 16 | LBL3 VARCHAR(32), 17 | VAL3 BIGINT, 18 | EID4 BIGINT, 19 | LBL4 VARCHAR(32), 20 | VAL4 BIGINT, 21 | EID5 BIGINT, 22 | LBL5 VARCHAR(32), 23 | VAL5 BIGINT, 24 | EID6 BIGINT, 25 | LBL6 VARCHAR(32), 26 | VAL6 BIGINT, 27 | EID7 BIGINT, 28 | LBL7 VARCHAR(32), 29 | VAL7 BIGINT, 30 | EID8 BIGINT, 31 | LBL8 VARCHAR(32), 32 | VAL8 BIGINT, 33 | EID9 BIGINT, 34 | LBL9 VARCHAR(32), 35 | VAL9 BIGINT, 36 | EID10 BIGINT, 37 | LBL10 VARCHAR(32), 38 | VAL10 BIGINT, 39 | 40 | INDEX vertex_id_opa USING HASH (VID) 41 | ); 42 | 43 | -- Ingoing Primary Adjacency (IPA) 44 | -- I am assuming 10 edges per vertice/row. 45 | 46 | CREATE TABLE IPA 47 | ( 48 | VID BIGINT NOT NULL, 49 | TYPE VARCHAR(20), 50 | SPILL BIT NOT NULL, 51 | EID1 BIGINT, 52 | LBL1 VARCHAR(32), 53 | VAL1 BIGINT, 54 | EID2 BIGINT, 55 | LBL2 VARCHAR(32), 56 | VAL2 BIGINT, 57 | EID3 BIGINT, 58 | LBL3 VARCHAR(32), 59 | VAL3 BIGINT, 60 | EID4 BIGINT, 61 | LBL4 VARCHAR(32), 62 | VAL4 BIGINT, 63 | EID5 BIGINT, 64 | LBL5 VARCHAR(32), 65 | VAL5 BIGINT, 66 | EID6 BIGINT, 67 | LBL6 VARCHAR(32), 68 | VAL6 BIGINT, 69 | EID7 BIGINT, 70 | LBL7 VARCHAR(32), 71 | VAL7 BIGINT, 72 | EID8 BIGINT, 73 | LBL8 VARCHAR(32), 74 | VAL8 BIGINT, 75 | EID9 BIGINT, 76 | LBL9 VARCHAR(32), 77 | VAL9 BIGINT, 78 | EID10 BIGINT, 79 | LBL10 VARCHAR(32), 80 | VAL10 BIGINT, 81 | 82 | INDEX vertex_id_ipa USING HASH (VID) 83 | ); 84 | 85 | -- Outgoing Secundary Adjacency (OSA) 86 | 87 | CREATE TABLE OSA 88 | ( 89 | VALID BIGINT NOT NULL, 90 | TYPE VARCHAR(20), 91 | EID BIGINT NOT NULL, 92 | VAL BIGINT NOT NULL, 93 | 94 | INDEX outgoing_vertex_id USING HASH (VALID) 95 | ); 96 | 97 | -- Ingoing Secundary Adjacency (ISA) 98 | 99 | CREATE TABLE ISA 100 | ( 101 | VALID BIGINT NOT NULL, 102 | TYPE VARCHAR(20), 103 | EID BIGINT NOT NULL, 104 | VAL BIGINT NOT NULL, 105 | 106 | INDEX ingoing_vertex_id USING HASH (VALID) 107 | ); 108 | 109 | -- Edge Attributes (EA) 110 | -- Since SQLGraph uses an unspecified Relational database with JSON storage capabilities 111 | -- Instead of adding json, a column for each different possible edge attribute can be used. 112 | 113 | CREATE TABLE EA 114 | ( 115 | EID BIGINT NOT NULL, 116 | INV BIGINT NOT NULL, 117 | OUTV BIGINT NOT NULL, 118 | LBL VARCHAR(100) NOT NULL, 119 | ATTR JSON, 120 | -- CREATION_DATE DATE, 121 | -- JOIN_DATE DATE, 122 | -- CLASS_YEAR BIGINT, 123 | -- WORK_FROM DATE, 124 | 125 | PRIMARY KEY USING HASH (EID) 126 | ); 127 | 128 | -- Vertex Attributes (VA) 129 | -- Since SQLGraph uses an unspecified Relational database with JSON storage capabilities 130 | -- Instead of adding json, a column for each different possible vertex attribute can be used. 131 | 132 | CREATE TABLE VA 133 | ( 134 | VID BIGINT NOT NULL, 135 | TYPE VARCHAR(20), 136 | ATTR JSON, 137 | -- Person Attributes 138 | -- CREATION_DATE DATE, 139 | -- FIRST_NAME VARCHAR(100), 140 | -- LAST_NAME VARCHAR(100), 141 | -- GENDER VARCHAR(32), 142 | -- BIRTHDAY DATE, 143 | -- EMAIL VARCHAR(100), 144 | -- SPEAKS VARCHAR(100), 145 | -- BROWSER_USED VARCHAR(100), 146 | -- LOCATION_IP VARCHAR(100), 147 | 148 | -- Place Attributes 149 | -- NAME VARCHAR(100), 150 | 151 | -- Message Attributes 152 | -- CONTENT VARCHAR(1024), 153 | -- LENGTH BIGINT, 154 | 155 | -- Post attributes 156 | -- LANGUAGE VARCHAR(100), 157 | -- IMAGE_FILE VARCHAR(1024), 158 | 159 | -- Forum attributes 160 | -- TITLE VARCHAR(256), 161 | 162 | -- Tag attributes 163 | -- NAME 164 | 165 | -- Tagclass attributes 166 | -- NAME 167 | 168 | -- Organisation attributes 169 | -- TYPE 170 | -- Name 171 | 172 | -- The vertice names missing had the attributes already declared by anoter vertex type and share the same name 173 | INDEX va_type USING HASH (TYPE), 174 | PRIMARY KEY USING HASH (VID) 175 | ); 176 | -------------------------------------------------------------------------------- /vertica/vertica-ldbc-ingester/gen_ingestion.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #================================================================ 4 | # HEADER 5 | #================================================================ 6 | #% SYNOPSIS 7 | #+ ${SCRIPT_NAME} --db database --ldbc ldbcpath 8 | #% 9 | #% DESCRIPTION 10 | #% Creates a ingestion.sql for loading LDBC data into Vertica. 11 | #% 12 | #% --ldbc [path] path to LDBC input files 13 | #% -h, --help Print this help 14 | #% -v, --version Print script information 15 | #% bulk, half with Load CSV 16 | #% 17 | #% EXAMPLES 18 | #% ${SCRIPT_NAME} --db LDBC10G --ldbc ~/home/myuser/ldbc 19 | #% 20 | #================================================================ 21 | #- IMPLEMENTATION 22 | #- author James Brook 23 | #- copyright 24 | #- license Apache License V2 25 | #- script_id 1 26 | #- 27 | #================================================================ 28 | # HISTORY 29 | # 2016/09/29 : James Brook : Script creation 30 | # 31 | #================================================================ 32 | # END_OF_HEADER 33 | #================================================================ 34 | 35 | # CONSTANT DEFINES: 36 | CSV_MERGER="VerticaIngestScript.py" 37 | INGESTION_SQL_FILE="ingestion.sql" 38 | 39 | 40 | #== HEADER Info variables ==# 41 | SCRIPT_HEADSIZE=$(head -200 ${0} |grep -n "^# END_OF_HEADER" | cut -f1 -d:) 42 | SCRIPT_NAME="$(basename ${0})" 43 | 44 | #== Command line Arguments ==# 45 | SHORT=h,v 46 | LONG=ldbc:,help,version 47 | 48 | #== Usage functions ==# 49 | usage() { printf "Usage: "; head -${SCRIPT_HEADSIZE:-99} ${0} | grep -e "^#+" | sed -e "s/^#+[ ]*//g" -e "s/\${SCRIPT_NAME}/${SCRIPT_NAME}/g" ; } 50 | usagefull() { head -${SCRIPT_HEADSIZE:-99} ${0} | grep -e "^#[%+-]" | sed -e "s/^#[%+-]//g" -e "s/\${SCRIPT_NAME}/${SCRIPT_NAME}/g" ; } 51 | scriptinfo() { head -${SCRIPT_HEADSIZE:-99} ${0} | grep -e "^#-" | sed -e "s/^#-//g" -e "s/\${SCRIPT_NAME}/${SCRIPT_NAME}/g"; } 52 | 53 | ###### Script main flow: 54 | 55 | ## Parser options 56 | 57 | # Test getOpt to make sure it's getopt(3) 58 | getopt --test > /dev/null 59 | if [[ $? != 4 ]]; then 60 | echo "`getopt --test` failed in this environment." 61 | echo "update getopt in to enhanced version in order to run this script." 62 | exit 2 63 | fi 64 | 65 | # temporarily store output to be able to check for errors 66 | # activate advanced mode getopt quoting e.g. via “--options” 67 | # pass arguments only via -- "$@" to separate them correctly 68 | PARSED=`getopt --options $SHORT --longoptions $LONG --name "$0" -- "$@"` 69 | 70 | if [[ $? != 0 ]]; then 71 | # e.g. $? == 1 72 | # then getopt has complained about wrong arguments to stdout 73 | usage 74 | exit 3 75 | fi 76 | 77 | # use eval with "$PARSED" to properly handle the quoting 78 | eval set -- "$PARSED" 79 | 80 | # Choose options 81 | while true; do 82 | case "$1" in 83 | --ldbc) 84 | LDBC_PATH=$2 85 | shift 2 86 | ;; 87 | -v|--version) 88 | echo "version 1.0" 89 | exit 0 90 | ;; 91 | -h|--help) 92 | usagefull 93 | exit 0 94 | ;; 95 | --) 96 | shift 97 | break 98 | ;; 99 | *) 100 | echo "Invalid Argument: $1" 101 | usage 102 | exit 4 103 | ;; 104 | esac 105 | done 106 | 107 | ###### Script main flow: 108 | 109 | # handle non-option arguments 110 | if [[ -z "$LDBC_PATH" ]] ; then 111 | echo "Incorrect usage." 112 | usage 113 | exit 5 114 | fi 115 | 116 | ABS_LDBC_PATH=$(cd $LDBC_PATH; pwd) 117 | python $CSV_MERGER $ABS_LDBC_PATH $TARGET 118 | 119 | if [[ $? != 0 ]]; then 120 | echo "Error while converting the .csv files to a vertica consumable format" 121 | exit 6 122 | else 123 | echo -e "\n [DONE]\n" 124 | fi 125 | 126 | echo " Please excute the ingestion.sql on your Vertica instance, by running this command: \i 'PATH_TO_SCRIPT/ingestion.sql' " 127 | -------------------------------------------------------------------------------- /sqlgraph/resources/queries/query9.sql: -------------------------------------------------------------------------------- 1 | # Query 9: Recent posts and comments by friends and friends of friends 2 | # ==================================================================================================================== 3 | 4 | SELECT 5 | creator.ATTR->'$.FIRST_NAME' AS firstName, 6 | creator.ATTR->'$.LAST_NAME' AS lastName, 7 | message.VID AS commentId, 8 | IF ( 9 | message.ATTR->'$.CONTENT' = "", 10 | message.ATTR->'$.IMAGE_FILE', 11 | message.ATTR->'$.CONTENT' 12 | ) content, 13 | message.ATTR->'$.CREATION_DATE' AS creationdate 14 | FROM ( 15 | SELECT 16 | f_fof.VID AS personId, 17 | CASE 18 | WHEN f_fof.LBL1 = "HAS_CREATOR" THEN f_fof.VAL1 19 | WHEN f_fof.LBL2 = "HAS_CREATOR" THEN f_fof.VAL2 20 | WHEN f_fof.LBL3 = "HAS_CREATOR" THEN f_fof.VAL3 21 | WHEN f_fof.LBL4 = "HAS_CREATOR" THEN f_fof.VAL4 22 | WHEN f_fof.LBL5 = "HAS_CREATOR" THEN f_fof.VAL5 23 | WHEN f_fof.LBL6 = "HAS_CREATOR" THEN f_fof.VAL6 24 | WHEN f_fof.LBL7 = "HAS_CREATOR" THEN f_fof.VAL7 25 | WHEN f_fof.LBL8 = "HAS_CREATOR" THEN f_fof.VAL8 26 | WHEN f_fof.LBL9 = "HAS_CREATOR" THEN f_fof.VAL9 27 | END AS hasMessage 28 | FROM ( 29 | SELECT friends.* 30 | FROM ( 31 | SELECT 32 | CASE 33 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 34 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 35 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 36 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 37 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 38 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 39 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 40 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 41 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 42 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 43 | END AS knows 44 | FROM OPA person 45 | WHERE person.VID = 1502199023259437 46 | ) AS person_relation 47 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 48 | JOIN IPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 49 | UNION 50 | SELECT fof.* 51 | FROM ( 52 | SELECT 53 | friends.*, 54 | CASE 55 | WHEN friends.LBL1 = "KNOWS" THEN friends.VAL1 56 | WHEN friends.LBL2 = "KNOWS" THEN friends.VAL2 57 | WHEN friends.LBL3 = "KNOWS" THEN friends.VAL3 58 | WHEN friends.LBL4 = "KNOWS" THEN friends.VAL4 59 | WHEN friends.LBL5 = "KNOWS" THEN friends.VAL5 60 | WHEN friends.LBL6 = "KNOWS" THEN friends.VAL6 61 | WHEN friends.LBL7 = "KNOWS" THEN friends.VAL7 62 | WHEN friends.LBL8 = "KNOWS" THEN friends.VAL8 63 | WHEN friends.LBL9 = "KNOWS" THEN friends.VAL9 64 | WHEN friends.LBL10 = "KNOWS" THEN friends.VAL10 65 | END AS fKnows 66 | FROM ( 67 | SELECT 68 | CASE 69 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 70 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 71 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 72 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 73 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 74 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 75 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 76 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 77 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 78 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 79 | END AS knows 80 | FROM OPA person 81 | WHERE person.VID = 1502199023259437 82 | ) AS person_relation 83 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 84 | JOIN IPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 85 | ) AS friends 86 | LEFT JOIN OSA fof_relation ON (fof_relation.VALID = friends.fKnows) 87 | JOIN OPA fof ON COALESCE(fof_relation.VAL, friends.fKnows) = fof.VID 88 | ) AS f_fof 89 | ) AS f_fof_messages 90 | LEFT JOIN ISA has_message ON (has_message.VALID = hasMessage) 91 | JOIN VA message ON COALESCE(has_message.VAL, hasMessage) = message.VID 92 | JOIN VA creator ON (creator.VID = personId) 93 | ORDER BY creationDate Desc, message.VID 94 | LIMIT 20; 95 | -------------------------------------------------------------------------------- /sqlgraph/resources/queries/query9multihop2.sql: -------------------------------------------------------------------------------- 1 | # Query 9: Recent posts and comments by friends and friends of friends 2 | # ==================================================================================================================== 3 | 4 | SELECT 5 | creator.ATTR->'$.FIRST_NAME' AS firstName, 6 | creator.ATTR->'$.LAST_NAME' AS lastName, 7 | message.VID AS commentId, 8 | IF ( 9 | message.ATTR->'$.CONTENT' = "", 10 | message.ATTR->'$.IMAGE_FILE', 11 | message.ATTR->'$.CONTENT' 12 | ) content, 13 | message.ATTR->'$.CREATION_DATE' AS creationdate 14 | FROM ( 15 | SELECT 16 | f_fof.VID AS personId, 17 | CASE 18 | WHEN f_fof.LBL1 = "HAS_CREATOR" THEN f_fof.VAL1 19 | WHEN f_fof.LBL2 = "HAS_CREATOR" THEN f_fof.VAL2 20 | WHEN f_fof.LBL3 = "HAS_CREATOR" THEN f_fof.VAL3 21 | WHEN f_fof.LBL4 = "HAS_CREATOR" THEN f_fof.VAL4 22 | WHEN f_fof.LBL5 = "HAS_CREATOR" THEN f_fof.VAL5 23 | WHEN f_fof.LBL6 = "HAS_CREATOR" THEN f_fof.VAL6 24 | WHEN f_fof.LBL7 = "HAS_CREATOR" THEN f_fof.VAL7 25 | WHEN f_fof.LBL8 = "HAS_CREATOR" THEN f_fof.VAL8 26 | WHEN f_fof.LBL9 = "HAS_CREATOR" THEN f_fof.VAL9 27 | END AS hasMessage 28 | FROM ( 29 | SELECT friends.* 30 | FROM ( 31 | SELECT 32 | CASE 33 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 34 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 35 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 36 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 37 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 38 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 39 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 40 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 41 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 42 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 43 | END AS knows 44 | FROM OPA person 45 | WHERE person.VID = 1502199023259437 46 | ) AS person_relation 47 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 48 | JOIN IPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 49 | UNION 50 | SELECT fof.* 51 | FROM ( 52 | SELECT 53 | friends.*, 54 | CASE 55 | WHEN friends.LBL1 = "KNOWS" THEN friends.VAL1 56 | WHEN friends.LBL2 = "KNOWS" THEN friends.VAL2 57 | WHEN friends.LBL3 = "KNOWS" THEN friends.VAL3 58 | WHEN friends.LBL4 = "KNOWS" THEN friends.VAL4 59 | WHEN friends.LBL5 = "KNOWS" THEN friends.VAL5 60 | WHEN friends.LBL6 = "KNOWS" THEN friends.VAL6 61 | WHEN friends.LBL7 = "KNOWS" THEN friends.VAL7 62 | WHEN friends.LBL8 = "KNOWS" THEN friends.VAL8 63 | WHEN friends.LBL9 = "KNOWS" THEN friends.VAL9 64 | WHEN friends.LBL10 = "KNOWS" THEN friends.VAL10 65 | END AS fKnows 66 | FROM ( 67 | SELECT 68 | CASE 69 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 70 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 71 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 72 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 73 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 74 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 75 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 76 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 77 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 78 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 79 | END AS knows 80 | FROM OPA person 81 | WHERE person.VID = 1502199023259437 82 | ) AS person_relation 83 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 84 | JOIN OPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 85 | ) AS friends 86 | LEFT JOIN OSA fof_relation ON (fof_relation.VALID = friends.fKnows) 87 | JOIN IPA fof ON COALESCE(fof_relation.VAL, friends.fKnows) = fof.VID 88 | ) AS f_fof 89 | ) AS f_fof_messages 90 | LEFT JOIN ISA has_message ON (has_message.VALID = hasMessage) 91 | JOIN VA message ON COALESCE(has_message.VAL, hasMessage) = message.VID 92 | JOIN VA creator ON (creator.VID = personId) 93 | ORDER BY creationDate Desc, message.VID 94 | LIMIT 20; 95 | -------------------------------------------------------------------------------- /vertica/queries/query6.sql: -------------------------------------------------------------------------------- 1 | \o /dev/null 2 | 3 | WITH SUB_1804388986 AS ( 4 | SELECT 5 | person.id as personId, 'Person('||friend.id||')' AS friend, friend.id AS friendId, friendPost.id, 'Post('||friendPost.id||')' AS friendPost, knownTag.id as knownTagId 6 | FROM person AS person 7 | JOIN person_knows_person ON (person_knows_person.person_id = person.id) JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) 8 | JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) JOIN Post AS friendPost ON (friendPost.id = post_hasCreator_person.post_id) 9 | JOIN post_hasTag_tag ON (post_hasTag_tag.post_id = friendPost.id) JOIN Tag AS knownTag ON (knownTag.id = post_hasTag_tag.tag_id) 10 | WHERE person.id = 2199023259437 AND knownTag.name = 'A_Woman_and_a_Man' 11 | ), SUB_2018627083 AS ( 12 | SELECT 13 | person.id as personId, 'Person('||friend.id||')' AS friend, friend.id AS friendId, friendPost.id, 'Post('||friendPost.id||')' AS friendPost, knownTag.id as knownTagId 14 | FROM person AS person 15 | JOIN person_knows_person ON (person_knows_person.person_id = person.id) JOIN Person AS p_$1 ON (p_$1.id = person_knows_person.other_person_id) 16 | JOIN person_knows_person AS person_knows_person_$1 ON (person_knows_person_$1.person_id = p_$1.id) JOIN Person AS friend ON (friend.id = person_knows_person_$1.other_person_id) 17 | JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) JOIN Post AS friendPost ON (friendPost.id = post_hasCreator_person.post_id) 18 | JOIN post_hasTag_tag ON (post_hasTag_tag.post_id = friendPost.id) JOIN Tag AS knownTag ON (knownTag.id = post_hasTag_tag.tag_id) 19 | WHERE person.id = 2199023259437 AND knownTag.name = 'A_Woman_and_a_Man' 20 | ), SUB_843853757 AS ( 21 | SELECT 'Post('||friendPost.id||')' AS friendPost,commonTag.id as commonTagId,'Tag('||commonTag.id||')' AS commonTag, commonTag.name as cName, personId, friendId, knownTagId FROM SUB_1804388986 AS friendPost JOIN post_hasTag_tag ON (post_hasTag_tag.post_id = friendPost.id) JOIN Tag AS commonTag ON (commonTag.id = post_hasTag_tag.tag_id) WHERE commonTag.id != knownTagId 22 | ), SUB_1456464649 AS ( 23 | SELECT cName, commonPost.id AS commonPost, personId, friendId, commonTagId, knownTag.id as knownTagId 24 | FROM SUB_843853757 AS commonTag 25 | JOIN post_hasTag_tag ON (post_hasTag_tag.tag_id = commonTagId) JOIN Post AS commonPost ON (commonPost.id = post_hasTag_tag.post_id) 26 | JOIN post_hasTag_tag AS post_hasTag_tag_$1 ON (post_hasTag_tag_$1.post_id = commonPost.id) JOIN Tag AS knownTag ON (knownTag.id = post_hasTag_tag_$1.tag_id) 27 | JOIN post_hasCreator_person ON (post_hasCreator_person.post_id = commonPost.id) JOIN Person AS friend ON (friend.id = post_hasCreator_person.person_id) 28 | where knownTag.id = knownTagId 29 | ), SUB_843853757_V2 AS ( 30 | SELECT 'Post('||friendPost.id||')' AS friendPost,commonTag.id as commonTagId,'Tag('||commonTag.id||')' AS commonTag, commonTag.name as cName, personId, friendId, knownTagId FROM SUB_2018627083 AS friendPost JOIN post_hasTag_tag ON (post_hasTag_tag.post_id = friendPost.id) JOIN Tag AS commonTag ON (commonTag.id = post_hasTag_tag.tag_id) WHERE commonTag.id != knownTagId 31 | ), SUB_1456464649_V2 AS ( 32 | SELECT cName, commonPost.id AS commonPost, personId, friendId, commonTagId, knownTag.id as knownTagId 33 | FROM SUB_843853757_V2 AS commonTag 34 | JOIN post_hasTag_tag ON (post_hasTag_tag.tag_id = commonTagId) JOIN Post AS commonPost ON (commonPost.id = post_hasTag_tag.post_id) 35 | JOIN post_hasTag_tag AS post_hasTag_tag_$1 ON (post_hasTag_tag_$1.post_id = commonPost.id) JOIN Tag AS knownTag ON (knownTag.id = post_hasTag_tag_$1.tag_id) 36 | JOIN post_hasCreator_person ON (post_hasCreator_person.post_id = commonPost.id) JOIN Person AS friend ON (friend.id = post_hasCreator_person.person_id) 37 | where knownTag.id = knownTagId 38 | ) 39 | select /*+label(query6)*/ * from ( 40 | (SELECT cName AS tagName,count (distinct SUB_1456464649.commonPost) AS postCount FROM SUB_1456464649 WHERE personId != friendId and commonTagId != knownTagId GROUP BY tagName ORDER BY postCount DESC , tagName ) 41 | union 42 | (SELECT cName AS tagName,count (distinct SUB_1456464649_V2.commonPost) AS postCount FROM SUB_1456464649_V2 WHERE personId != friendId and commonTagId != knownTagId GROUP BY tagName ORDER BY postCount DESC , tagName) 43 | ) AS foo LIMIT 100; 44 | -------------------------------------------------------------------------------- /vertica/queries/query_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## times to repeat queries 4 | QUERY_REPEAT=5 5 | PROJECTIONS=$2 6 | 7 | TEST_RUN_NAME=$1 8 | QUERIES=(query2 query6 query8 query9 query11 query9multihop1 query9multihop3 query9multihop4 query9multihop5) 9 | 10 | ## Function to lookup the stats of a given query, it takes four parameters: query label, cache state, start and end date 11 | function stats { 12 | echo "Stats for $1 $2 between Start-> $3 End-> $4" 13 | 14 | ##echo "select identifier, query_duration_us as 'Duration (us)', processed_row_count,error_code from query_profiles where identifier = '${1}' and query_start > '$3' and query_start < '$4' order by query_start" 15 | vsql -c "select identifier, query_duration_us as 'Duration (us)', processed_row_count,error_code from query_profiles where identifier = '${1}' and query_start > '$3' and query_start < '$4' order by query_start" 16 | 17 | echo "**** Summary *****" 18 | 19 | vsql -c "select identifier, count(query_duration_us) as '#samples', avg(query_duration_us) as 'Avg (us)', min(query_duration_us) as 'Min (us)', max(query_duration_us) as 'Max (us)', stddev(query_duration_us), processed_row_count,error_code from query_profiles where identifier = '${1}' and query_start > '$3' and query_start < '$4' group by identifier, processed_row_count, error_code;" 20 | } 21 | 22 | ## 23 | function statsToFile { 24 | STATS_DIR="test/${PROJECTIONS}/${TEST_RUN_NAME}/${2}" 25 | echo $STATS_DIR 26 | mkdir -p $STATS_DIR 27 | echo "Record stats to file $1 $2 between Start-> $3 End-> $4" 28 | vsql -c "select identifier, query_duration_us as 'Duration (us)', case when error_code is null then 'OK' ELSE 'FAILED' END from query_profiles where identifier = '${1}' and query_start > '$3' and query_start < '$4' order by query_start" >> "${STATS_DIR}/result_${1}" 29 | 30 | } 31 | 32 | # Clears the OS cache on all cluster hosts, removes any Vertica cache. 33 | # Requires root privilege on the user to run it 34 | function clearCache { 35 | 36 | vsql -f clear_cache.sql 37 | # Cleans cache in parallel 38 | while read p; do 39 | echo "dropping cache on: $p" 40 | ssh $p "sudo sh -c \"sync; echo 3 > /proc/sys/vm/drop_caches\"" & 41 | done '$.NAME' AS tagName, COUNT(*) AS postCount 2 | FROM 3 | ( 4 | SELECT 5 | CASE 6 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 7 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 8 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 9 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 10 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 11 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 12 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 13 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 14 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 15 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 16 | END AS knowsId 17 | FROM OPA person 18 | WHERE person.VID = 1502199023259437 19 | ) p_r, OSA knows, IPA has_post, ISA has_post_rel, OPA post_rel, OSA has_tag, VA post, VA tag 20 | WHERE 21 | knows.VALID = knowsId 22 | AND has_post.VID = COALESCE(knows.VAL, knowsId) 23 | AND has_post_rel.VALID = 24 | CASE 25 | WHEN has_post.LBL1 = "HAS_CREATOR" THEN has_post.VAL1 26 | WHEN has_post.LBL2 = "HAS_CREATOR" THEN has_post.VAL2 27 | WHEN has_post.LBL3 = "HAS_CREATOR" THEN has_post.VAL3 28 | WHEN has_post.LBL4 = "HAS_CREATOR" THEN has_post.VAL4 29 | WHEN has_post.LBL5 = "HAS_CREATOR" THEN has_post.VAL5 30 | WHEN has_post.LBL6 = "HAS_CREATOR" THEN has_post.VAL6 31 | WHEN has_post.LBL7 = "HAS_CREATOR" THEN has_post.VAL7 32 | WHEN has_post.LBL8 = "HAS_CREATOR" THEN has_post.VAL8 33 | WHEN has_post.LBL9 = "HAS_CREATOR" THEN has_post.VAL9 34 | WHEN has_post.LBL10 = "HAS_CREATOR" THEN has_post.VAL10 35 | END 36 | AND post_rel.VID = has_post_rel.VAL 37 | AND post_rel.TYPE = "post" 38 | AND post.VID = post_rel.VID 39 | AND post.ATTR->'$.CREATION_DATE' >= "2011-06-06" AND post.ATTR->'$.CREATION_DATE' <= "2016-06-06" 40 | AND has_tag.VALID = 41 | CASE 42 | WHEN post_rel.LBL1 = "HAS_TAG" THEN post_rel.VAL1 43 | WHEN post_rel.LBL2 = "HAS_TAG" THEN post_rel.VAL2 44 | WHEN post_rel.LBL3 = "HAS_TAG" THEN post_rel.VAL3 45 | WHEN post_rel.LBL4 = "HAS_TAG" THEN post_rel.VAL4 46 | WHEN post_rel.LBL5 = "HAS_TAG" THEN post_rel.VAL5 47 | WHEN post_rel.LBL6 = "HAS_TAG" THEN post_rel.VAL6 48 | WHEN post_rel.LBL7 = "HAS_TAG" THEN post_rel.VAL7 49 | WHEN post_rel.LBL8 = "HAS_TAG" THEN post_rel.VAL8 50 | WHEN post_rel.LBL9 = "HAS_TAG" THEN post_rel.VAL9 51 | WHEN post_rel.LBL10 = "HAS_TAG" THEN post_rel.VAL10 52 | END 53 | AND tag.VID = has_tag.VAL 54 | AND tag.VID NOT IN ( 55 | SELECT has_tag.VAL 56 | FROM 57 | ( 58 | SELECT 59 | CASE 60 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 61 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 62 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 63 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 64 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 65 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 66 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 67 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 68 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 69 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 70 | END AS knowsId 71 | FROM OPA person 72 | WHERE person.VID = 1502199023259437 73 | ) p_r, OSA knows, IPA has_post, ISA has_post_rel, OPA post_rel, OSA has_tag, VA post 74 | WHERE 75 | knows.VALID = knowsId 76 | AND has_post.VID = COALESCE(knows.VAL, knowsId) 77 | AND has_post_rel.VALID = 78 | CASE 79 | WHEN has_post.LBL1 = "HAS_CREATOR" THEN has_post.VAL1 80 | WHEN has_post.LBL2 = "HAS_CREATOR" THEN has_post.VAL2 81 | WHEN has_post.LBL3 = "HAS_CREATOR" THEN has_post.VAL3 82 | WHEN has_post.LBL4 = "HAS_CREATOR" THEN has_post.VAL4 83 | WHEN has_post.LBL5 = "HAS_CREATOR" THEN has_post.VAL5 84 | WHEN has_post.LBL6 = "HAS_CREATOR" THEN has_post.VAL6 85 | WHEN has_post.LBL7 = "HAS_CREATOR" THEN has_post.VAL7 86 | WHEN has_post.LBL8 = "HAS_CREATOR" THEN has_post.VAL8 87 | WHEN has_post.LBL9 = "HAS_CREATOR" THEN has_post.VAL9 88 | WHEN has_post.LBL10 = "HAS_CREATOR" THEN has_post.VAL10 89 | END 90 | AND post_rel.VID = has_post_rel.VAL 91 | AND post_rel.TYPE = "post" 92 | AND post.VID = post_rel.VID 93 | AND post.ATTR->'$.CREATION_DATE' < "2011-06-06" 94 | AND has_tag.VALID = 95 | CASE 96 | WHEN post_rel.LBL1 = "HAS_TAG" THEN post_rel.VAL1 97 | WHEN post_rel.LBL2 = "HAS_TAG" THEN post_rel.VAL2 98 | WHEN post_rel.LBL3 = "HAS_TAG" THEN post_rel.VAL3 99 | WHEN post_rel.LBL4 = "HAS_TAG" THEN post_rel.VAL4 100 | WHEN post_rel.LBL5 = "HAS_TAG" THEN post_rel.VAL5 101 | WHEN post_rel.LBL6 = "HAS_TAG" THEN post_rel.VAL6 102 | WHEN post_rel.LBL7 = "HAS_TAG" THEN post_rel.VAL7 103 | WHEN post_rel.LBL8 = "HAS_TAG" THEN post_rel.VAL8 104 | WHEN post_rel.LBL9 = "HAS_TAG" THEN post_rel.VAL9 105 | WHEN post_rel.LBL10 = "HAS_TAG" THEN post_rel.VAL10 106 | END 107 | ) 108 | GROUP BY tagName 109 | ORDER BY 2 Desc, 1 110 | LIMIT 5; 111 | -------------------------------------------------------------------------------- /vertica/queries/run_designer.sh: -------------------------------------------------------------------------------- 1 | vsql -c "SELECT DESIGNER_DROP_DESIGN ('ldbc_design');" 2 | mkdir ldbc_design 3 | vsql -c "SELECT DESIGNER_CREATE_DESIGN ( 'ldbc_design' );" 4 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.city');" 5 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.city_isPartOf_country');" 6 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.comment');" 7 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.comment_hasCreator_person');" 8 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.comment_hasTag_tag');" 9 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.comment_isLocatedIn_country');" 10 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.comment_replyOf_comment');" 11 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.comment_replyOf_post');" 12 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.company');" 13 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.company_isLocatedIn_country');" 14 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.continent');" 15 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.country');" 16 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.country_isPartOf_continent');" 17 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.forum');" 18 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.forum_containerOf_post');" 19 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.forum_hasMember_person');" 20 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.forum_hasModerator_person');" 21 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.forum_hasTag_tag');" 22 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person');" 23 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_email_emailaddress');" 24 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_hasInterest_tag');" 25 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_isLocatedIn_city');" 26 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_isLocatedIn_continent');" 27 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_isLocatedIn_country');" 28 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_knows_person');" 29 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_likes_comment');" 30 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_likes_post');" 31 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_speaks_language');" 32 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_studyAt_university');" 33 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.person_workAt_company');" 34 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.post');" 35 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.post_hasCreator_person');" 36 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.post_hasTag_tag');" 37 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.post_isLocatedIn_country');" 38 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.tag');" 39 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.tag_hasType_tagclass');" 40 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.tagclass');" 41 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.tagclass_isSubclassOf_tagclass');" 42 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.university');" 43 | vsql -c "SELECT DESIGNER_ADD_DESIGN_TABLES('ldbc_design', 'public.university_isLocatedIn_city');" 44 | vsql -c "SELECT DESIGNER_ADD_DESIGN_QUERIES( 'ldbc_design', '$PWD/query2.sql', true);" 45 | vsql -c "SELECT DESIGNER_ADD_DESIGN_QUERIES( 'ldbc_design', '$PWD/query6.sql', true);" 46 | vsql -c "SELECT DESIGNER_ADD_DESIGN_QUERIES( 'ldbc_design', '$PWD/query8.sql', true);" 47 | vsql -c "SELECT DESIGNER_ADD_DESIGN_QUERIES( 'ldbc_design', '$PWD/query9.sql', true);" 48 | vsql -c "SELECT DESIGNER_ADD_DESIGN_QUERIES( 'ldbc_design', '$PWD/query11.sql', true);" 49 | vsql -c "SELECT DESIGNER_ADD_DESIGN_QUERIES( 'ldbc_design', '$PWD/query9multihop1.sql', true);" 50 | vsql -c "SELECT DESIGNER_ADD_DESIGN_QUERIES( 'ldbc_design', '$PWD/query9multihop3.sql', true);" 51 | vsql -c "SELECT DESIGNER_ADD_DESIGN_QUERIES( 'ldbc_design', '$PWD/query9multihop4.sql', true);" 52 | vsql -c "SELECT DESIGNER_ADD_DESIGN_QUERIES( 'ldbc_design', '$PWD/query9multihop5.sql', true);" 53 | vsql -c "SELECT DESIGNER_SET_DESIGN_TYPE('ldbc_design', 'comprehensive');" 54 | vsql -c "SELECT DESIGNER_SET_OPTIMIZATION_OBJECTIVE('ldbc_design', 'query');" 55 | yes | vsql -c "SELECT DESIGNER_RUN_POPULATE_DESIGN_AND_DEPLOY('ldbc_design','$PWD/ldbc_design/ldbc_design_projections.sql', '$PWD/ldbc_design/ldbc_design_deploy.sql', 'True','True','False','False');" 56 | yes | vsql -c "SELECT * FROM OUTPUT_DEPLOYMENT_STATUS;" 57 | yes | vsql -c "select DESIGNER_WAIT_FOR_DESIGN ( 'ldbc_design')"; 58 | yes | vsql -c "SELECT * FROM OUTPUT_DEPLOYMENT_STATUS;" 59 | #vsql -f "$PWD/ldbc_design/ldbc_design_deploy.sql" 60 | # vsql -c "SELECT DESIGNER_DROP_DESIGN ('ldbc_design');" 61 | -------------------------------------------------------------------------------- /sqlgraph/resources/queries/query11.sql: -------------------------------------------------------------------------------- 1 | # Query 11: Job Referral 2 | # ==================================================================================================================== 3 | 4 | SELECT 5 | personId, 6 | firstName, 7 | lastName, 8 | company.VID AS companyId, 9 | company.ATTR->'$.NAME' AS companyName, 10 | company_place.ATTR->'$.NAME' AS companyIn, 11 | work_from.ATTR->'$.WORK_FROM' AS worksFrom 12 | FROM ( 13 | SELECT 14 | f_fof.VID AS personId, 15 | people.ATTR->'$.FIRST_NAME' AS firstName, 16 | people.ATTR->'$.LAST_NAME' AS lastName, 17 | CASE 18 | WHEN f_fof.LBL1 = "WORK_AT" THEN f_fof.VAL1 19 | WHEN f_fof.LBL2 = "WORK_AT" THEN f_fof.VAL2 20 | WHEN f_fof.LBL3 = "WORK_AT" THEN f_fof.VAL3 21 | WHEN f_fof.LBL4 = "WORK_AT" THEN f_fof.VAL4 22 | WHEN f_fof.LBL5 = "WORK_AT" THEN f_fof.VAL5 23 | WHEN f_fof.LBL6 = "WORK_AT" THEN f_fof.VAL6 24 | WHEN f_fof.LBL7 = "WORK_AT" THEN f_fof.VAL7 25 | WHEN f_fof.LBL8 = "WORK_AT" THEN f_fof.VAL8 26 | WHEN f_fof.LBL9 = "WORK_AT" THEN f_fof.VAL9 27 | WHEN f_fof.LBL10 = "WORK_AT" THEN f_fof.VAL10 28 | END AS companyId, 29 | CASE 30 | WHEN f_fof.LBL1 = "WORK_AT" THEN f_fof.EID1 31 | WHEN f_fof.LBL2 = "WORK_AT" THEN f_fof.EID2 32 | WHEN f_fof.LBL3 = "WORK_AT" THEN f_fof.EID3 33 | WHEN f_fof.LBL4 = "WORK_AT" THEN f_fof.EID4 34 | WHEN f_fof.LBL5 = "WORK_AT" THEN f_fof.EID5 35 | WHEN f_fof.LBL6 = "WORK_AT" THEN f_fof.EID6 36 | WHEN f_fof.LBL7 = "WORK_AT" THEN f_fof.EID7 37 | WHEN f_fof.LBL8 = "WORK_AT" THEN f_fof.EID8 38 | WHEN f_fof.LBL9 = "WORK_AT" THEN f_fof.EID9 39 | WHEN f_fof.LBL10 = "WORK_AT" THEN f_fof.EID10 40 | END AS companyEid 41 | FROM ( 42 | SELECT friends.* 43 | FROM ( 44 | SELECT 45 | CASE 46 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 47 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 48 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 49 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 50 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 51 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 52 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 53 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 54 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 55 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 56 | END AS knows 57 | FROM OPA person 58 | WHERE person.VID = 1502199023259437 59 | ) AS person_relation 60 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 61 | JOIN OPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 62 | UNION 63 | SELECT fof.* 64 | FROM ( 65 | SELECT 66 | friends.*, 67 | CASE 68 | WHEN friends.LBL1 = "KNOWS" THEN friends.VAL1 69 | WHEN friends.LBL2 = "KNOWS" THEN friends.VAL2 70 | WHEN friends.LBL3 = "KNOWS" THEN friends.VAL3 71 | WHEN friends.LBL4 = "KNOWS" THEN friends.VAL4 72 | WHEN friends.LBL5 = "KNOWS" THEN friends.VAL5 73 | WHEN friends.LBL6 = "KNOWS" THEN friends.VAL6 74 | WHEN friends.LBL7 = "KNOWS" THEN friends.VAL7 75 | WHEN friends.LBL8 = "KNOWS" THEN friends.VAL8 76 | WHEN friends.LBL9 = "KNOWS" THEN friends.VAL9 77 | WHEN friends.LBL10 = "KNOWS" THEN friends.VAL10 78 | END AS fKnows 79 | FROM ( 80 | SELECT 81 | CASE 82 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 83 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 84 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 85 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 86 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 87 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 88 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 89 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 90 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 91 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 92 | END AS knows 93 | FROM OPA person 94 | WHERE person.VID = 1502199023259437 95 | ) AS person_relation 96 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 97 | JOIN OPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 98 | ) AS friends 99 | LEFT JOIN OSA fof_relation ON (fof_relation.VALID = friends.fKnows) 100 | JOIN OPA fof ON COALESCE(fof_relation.VAL, friends.fKnows) = fof.VID 101 | ) AS f_fof 102 | JOIN VA people ON (f_fof.VID = people.VID) 103 | ) AS f_fof_company_relation 104 | LEFT JOIN OSA work_at ON (work_at.VALID = f_fof_company_relation.companyId) 105 | JOIN VA company ON COALESCE(work_at.VAL, f_fof_company_relation.companyId) = company.VID 106 | JOIN OPA company_relation ON (company.VID = company_relation.VID) 107 | JOIN VA company_place ON (company_relation.VAL1 = company_place.VID) 108 | JOIN EA work_from ON COALESCE(work_at.EID, f_fof_company_relation.companyEid) = work_from.EID 109 | WHERE company_place.ATTR->'$.NAME' = "France" AND work_from.ATTR->'$.WORK_FROM' <= "2016-07-07" 110 | ORDER BY worksFrom, personId 111 | LIMIT 10; 112 | -------------------------------------------------------------------------------- /vertica/readme.md: -------------------------------------------------------------------------------- 1 | #Vertica Benchmark 2 | 3 | 4 | A set of bash style scripts to automate a Vertica benchmark using the LDBC Social Network data which can be found publicly on [ldbc_snb_datagen][1]. 5 | 6 | This benchmarking was conducted as part of a comparative study between three different database technologies, namely: Vertica; SqlGraph, running on MySQL; and Neo4J. The source code to these, together with a GUI style R-shinyapp representation of the acquired results can be found under the master branch. 7 | 8 | ##Script Structure 9 | 10 | ```html 11 | Vertica/queries/ : Directory for test queries and scripts to automate repeat testing. 12 | /vertica-ldbc-ingester/ : Main directory for ingestion script (1). 13 | /testResults/ : Raw data from multiple test runs with 1GB, 10GB, 30GB and 100GB data. 14 | ``` 15 | 16 | ##Quick Start 17 | To run the benchmark follow the numbered instructions below: 18 | 19 | 1: Generate the LDBC data and place in a know location on a Vertica node. 20 | 21 | 2: Create the multiple ingestion scripts for each data size. 22 | 23 | ```bash 24 | ./vertica-ldbc-ingester/gen_ingestion.sh --ldbc "PATH to ldbc datagen dir" 25 | ``` 26 | 27 | For example: 28 | 29 | ```bash 30 | ./vertica-ldbc-ingester/gen_ingestion.sh --ldbc /media/1G/social_network 31 | ``` 32 | 33 | This will produce a ingestion.sql, move this file as per step 3. 34 | 35 | 36 | 3: Copy the ingestion.sql into the "queries/datascripts"" directory renamed to follow the form: ingestion1GB.sql for the 1GB data or ingestion3GB.sql (for 3GB). 37 | 38 | 4: Confirm the batchtest.sh (in Vertica/queries) has the correct data sizes set by checking the SIZE property. For example (1GB 3GB 10GB 30GB 100GB) will run the tests for 1,3,10,30,100GBs. 39 | 40 | 5: As a user with access to Vertica's "adminTools" (for example dbAdmin) run: 41 | 42 | ```bash 43 | ./batchtest.sh 44 | ``` 45 | 46 | This does the following: 47 | 48 | ``` 49 | For each size it will: 50 | 1. Check for the ingestion script is present 51 | 2. Remove the Vertica DB for this size (schema name is LDBCx{SIZE}) 52 | 3. Create the Vertica DB for the size 53 | 4. Start the created DB 54 | 5. Execute the ingestion script for the DB size (which creates the schema, loads the data and gathers stats) 55 | 6. It waits 20 minutes for Vertica DB compression to finish 56 | 7. Gathers stats on the DB size 57 | 8. Executes the test query set (with and without cache) 58 | 9. Records the times 59 | 10. Runs the designer to generate the projections 60 | 11. Repeats steps 6, 7 & 8 61 | 12. Finally it stops the database 62 | ``` 63 | Results are outputted into a directory called "test" which has the following elements. 64 | 65 | ```html 66 | test/totalSize.txt : Stats on the size of the DB 67 | /withoutProjections : Directory with the non projection timings in 68 | /withoutProjections/{SIZE}\NoCache : NoCache results for the DB {SIZE} without projections 69 | /withoutProjections/{SIZE}\Cache : NoCache results for the DB {SIZE} without projections 70 | /withProjections : Directory with the projection timings in 71 | /withProjections/{SIZE}\Cache : NoCache results for the DB {SIZE} with projections 72 | /withProjections/{SIZE}\NoCache : NoCache results for the DB {SIZE} with projections 73 | ``` 74 | 75 | 76 | ##Subdirectories 77 | ####queries 78 | 79 | ```html 80 | queries\ : Main directory for benchmark script. 81 | \datascripts\ : Contains all ingestion sql generated by the gen_ingestion.sh for each data size. 82 | \batchtest.sh : Runs the tests for each datasize 83 | \clear_cache.sql : SQL script to clear the database cache (used by the batchtest.sh). 84 | \run_designer.sh : script to run the designer against the schema based on the testing queries (used by the batchtest.sh). 85 | \query_test.sh : Runs the query, no cache and then cached (used by the batchtest.sh). 86 | ``` 87 | 88 | **query_test.sh steps** 89 | For each query that is tested the following steps are taken: 90 | 91 | ```html 92 | 1. The SQL cache is cleared, see clear_cache.sql. 93 | 2. The linux page caches are dropped using the following command on each node: sudo sh -c \"sync; echo 3 > /proc/sys/vm/drop_caches\" 94 | 3. The query is run and then step 2 is repeated $QUERY_REPEAT times (5 by default) 95 | 4. Stats are taken for the processing time. 96 | 5. Finally this is repeated but without the cache clearing 97 | ``` 98 | 99 | 100 | ##Observations 101 | ####Vertica Tuning / Spec 102 | 103 | ###### Spec 104 | The Vertica cluster we used was composed of three identical dedicated physical hosts, each of the hosts with the following specs: 105 | ``` 106 | 2 x Intel Xeon CPU X5650 (6 real cores each @ 2.667 GHz) 107 | L1 cache: 192 kB 108 | L2 cache: 1536 kB 109 | L3 cache: 12288 kB 110 | RAM: 96GB @ 1333MHz 111 | SCSI Disk, 15000 rpm, 2TB 112 | ``` 113 | The connection between the hosts was done with 1GB ethernet. 114 | Ubuntu 14.04 LTS was running on every single host, with Vertica v7.2. 115 | 116 | These specs are considerably inferior - in every single item - to the Vertica's recommended specs, available at [vertica_spec_reference][2]: 117 | 118 | ###### System Tuning 119 | 120 | Only one change was made for the tuning of the cluster, which was to disable CPU frequency scaling on every single host and enable hyper threading. 121 | 122 | 123 | The schema hasn't been enhanced / improved from the LDBC spec, other than the addition of projections. 124 | 125 | -------- 126 | 127 | * As a last note, any suggestions, improvement or contribution to the code base are sincerely welcome. 128 | 129 | [1]: https://github.com/ldbc/ldbc_snb_datagen 130 | [2]: https://community.dev.hpe.com/t5/Vertica-Knowledge-Base/Recommendations-for-Sizing-Vertica-Nodes-and-Clusters/ta-p/233755 131 | -------------------------------------------------------------------------------- /results/result_loader.R: -------------------------------------------------------------------------------- 1 | # define the set of data we have 2 | queries <- c(2,6,8,"9multihop1","9multihop2","9multihop3","9multihop4","9multihop5",11) 3 | dataset <- c("1G", "3G", "10G", "30G", "100G") 4 | databas <- c("neo4j", "vertica", "sqlgraph") 5 | tuneset <- c("untuned", "tuned") 6 | 7 | # Function to load migraiton time for respective db 8 | load_mdata <- function() { 9 | # Create a Progress object 10 | progress <- shiny::Progress$new() 11 | # Make sure it closes when we exit this reactive, even if there's an error 12 | on.exit(progress$close()) 13 | progress$set(message = "Loading migration data", value = 0) 14 | 15 | data <- list() # list to return 16 | 17 | m.times <- data.frame(time=integer(), size=character(), database=character()) 18 | m.sizes <- data.frame(store=integer(), size=factor(), database=character()) 19 | count <- 0 20 | 21 | for(db in seq_along(databas)) { 22 | file <- paste(c("raw/", databas[db], "/migration_time.csv"), collapse = "") 23 | times <- read.table(file, sep = ",") 24 | 25 | # Melt the migraiton times together 26 | m.times <- rbind(m.times, data.frame(time = times[[2]], database = rep(databas[db], length(times[[1]])), size = times[[1]])) 27 | 28 | file <- paste(c("raw/", databas[db], "/migration_size.csv"), collapse = "") 29 | sizes <- read.table(file, sep = ",") 30 | sizes[[2]] <- sizes[[2]]/(1024*1024*1024) 31 | 32 | # Melth the migration size togethe 33 | m.sizes <- rbind(m.sizes, data.frame(store = sizes[[2]], database = rep(databas[db], length(sizes[[1]])), size = sizes[[1]])) 34 | 35 | # Increment the progress bar, and update the detail text. 36 | count <- count + 1 37 | progress$inc(1/(db), detail = paste("part", count, "/", db)) 38 | } 39 | 40 | data[["time"]] <- m.times 41 | data[["size"]] <- m.sizes 42 | data 43 | } 44 | 45 | # Function to load execution times for queries 46 | load_qtimes <- function() { 47 | progress <- shiny::Progress$new() 48 | on.exit(progress$close()) 49 | progress$set(message = "Loading execution data", value = 0) 50 | 51 | q.times <- list() 52 | count <- 0 53 | 54 | for(quer in seq_along(queries)) { 55 | # Create an empty dataframe containing the execution times 56 | df.times <- data.frame(time=integer(), size=character(), database=character(), tune=character()) 57 | 58 | for(size in seq_along(dataset)) { 59 | for(db in seq_along(databas)) { 60 | for(tu in seq_along(tuneset)) { 61 | # Remove if else and follow folder structure if Vertica / SQL is tuned. 62 | if((databas[db] == "sqlgraph" || databas[db] == "vertica") && tuneset[tu] == "tuned") { break; } 63 | else { 64 | file <- paste(c("raw/", databas[db], "/", tuneset[tu], "/", dataset[size], "/result_query", queries[quer]), collapse = '') 65 | times <- mean(read.csv(file, header = F, skip = 2)[, 2]) # opt to use log10 scale to dampen the values and get the mean average 66 | #times <- times[!(times >= 20000000)] 67 | 68 | sx <- as.numeric(gsub("G", "", dataset[size])) 69 | df.times <- rbind(df.times, data.frame(time = times, database = databas[db], size = sx, tun = tuneset[tu])) 70 | } 71 | # Increment the progress bar, and update the progess text 72 | count <- count + 1 73 | progress$inc(1/(quer*size*db*tu), detail = paste("part", count, "/", 9*5*3*2)) 74 | } 75 | } 76 | } 77 | 78 | q.times[[queries[quer]]] <- df.times 79 | } 80 | 81 | q.times 82 | } 83 | 84 | # Returns the independent migration time from csv to database 85 | # The fastest available method was utilised for respective framework 86 | migr_times <- function(df) { 87 | gg <- ggplot(df, aes(x = factor(size), y = time, color = database)) + 88 | geom_point(size = 1.5, alpha = 1) + # set point size and transparency 89 | # facet_wrap(~database) + 90 | scale_x_discrete(limits=paste(dataset, "B", sep = '')) + # reorder by size discrete 91 | ggtitle("Database migration time") + 92 | ylab("\nMigration time in sec") + xlab("LDBC dataset size") 93 | 94 | ggplotly(gg) 95 | } 96 | 97 | 98 | # Returns the independent migration time from csv to database 99 | # The fastest available method was utilised for respective framework 100 | data_size <- function(df) { 101 | gg <- ggplot(df, aes(x = factor(size), y = store, color = database)) + 102 | geom_point(size = 1.5, alpha = 1) + # set point size and transparency 103 | # facet_wrap(~database) + 104 | scale_x_discrete(limits=paste(dataset, "B", sep = '')) + # reorder by size discrete 105 | ggtitle("Stored databse size") + 106 | ylab("\nDatabase size in GB") + xlab("LDBC dataset size") 107 | 108 | ggplotly(gg) 109 | } 110 | 111 | # Returns the independent execution times for each query across to 112 | # compare across multiple databases 113 | exec_times <- function(df, fit) { 114 | # Omit any rows that timedout 115 | df$time[df$time >= 21600000] <- NA 116 | df <- na.omit(df) 117 | 118 | # Scale the values accordingly 119 | if(min(df$time > 4500)) { 120 | df$time <- df$time / 1000 121 | ylab <- "sec" 122 | } else { ylab <- "msec" } 123 | 124 | gg <- ggplot(df, aes(x=size, y=time, color=tun)) + 125 | geom_point(size = 1.5, alpha = 1) + # set point size and transparency 126 | facet_wrap(~database) + 127 | ggtitle("Query execution times") + 128 | ylab(paste("Execution time in ", ylab, sep='')) + xlab("Dataset size") + 129 | scale_x_continuous(breaks = scales::pretty_breaks(n = 10)) 130 | 131 | if(fit != 1) { 132 | gg <- gg + 133 | # Use loess fit without confidence region, i.e. se = F 134 | stat_smooth(method = if(fit == 2) lm else loess, size = 0.5, se = F) 135 | } 136 | 137 | ggplotly(gg) 138 | } -------------------------------------------------------------------------------- /sqlgraph/resources/queries/query7.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | messageId, 3 | CONCAT(SUBSTR(IF( -- Substring the the value to restrict 4 | message.ATTR->'$.CONTENT' = "", -- output to one row selecting image 5 | message.ATTR->'$.IMAGE_FILE', -- file if empty else the content of 6 | message.ATTR->'$.CONTENT' 7 | ), 1, 20), "...") AS content, 8 | message.ATTR->>'$.CREATION_DATE' AS messageDate, 9 | likerId, 10 | person.ATTR->'$.FIRST_NAME' AS firstName, 11 | person.ATTR->'$.LAST_NAME' AS lastName, 12 | likeDate, 13 | TIMESTAMPDIFF(MINUTE, message.ATTR->>'$.CREATION_DATE', likeDate) AS latency, 14 | isFriend 15 | FROM ( 16 | SELECT 17 | likes.likeId AS likerId, -- Below is the first/least/max problem 18 | SUBSTR(MAX( -- MySQL disallows to select first item 19 | CONCAT( -- in a group, and the other row values 20 | LPAD(like_relation.ATTR->'$.CREATION_DATE', 10, '0'), -- this hack bypasses that, essentially 21 | likes.messageId -- creating same value as one we aggreg 22 | ) -- around and then substring to extract 23 | ), 11) AS messageId, 24 | MAX(like_relation.ATTR->>'$.CREATION_DATE') AS likeDate, 25 | CASE 26 | WHEN likes.likeId IN ( 27 | SELECT friends.VID 28 | FROM ( 29 | SELECT 30 | CASE 31 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 32 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 33 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 34 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 35 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 36 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 37 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 38 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 39 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 40 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 41 | END AS knows 42 | FROM OPA person 43 | WHERE person.VID = 1502199023259437 44 | ) AS person_relation 45 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 46 | JOIN OPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 47 | ) THEN 1 ELSE 0 48 | END AS isFriend 49 | FROM ( 50 | SELECT 51 | has_like_relation.messageId, 52 | COALESCE(has_like.VAL, hasLike) AS likeId, 53 | COALESCE(has_like.EID, hasLikeEID) AS likeEid 54 | FROM ( 55 | SELECT 56 | has_message.messageId, 57 | CASE 58 | WHEN message_relation.LBL1 = "LIKES" THEN message_relation.VAL1 59 | WHEN message_relation.LBL2 = "LIKES" THEN message_relation.VAL2 60 | WHEN message_relation.LBL3 = "LIKES" THEN message_relation.VAL3 61 | WHEN message_relation.LBL4 = "LIKES" THEN message_relation.VAL4 62 | WHEN message_relation.LBL5 = "LIKES" THEN message_relation.VAL5 63 | WHEN message_relation.LBL6 = "LIKES" THEN message_relation.VAL6 64 | WHEN message_relation.LBL7 = "LIKES" THEN message_relation.VAL7 65 | WHEN message_relation.LBL7 = "LIKES" THEN message_relation.VAL8 66 | WHEN message_relation.LBL9 = "LIKES" THEN message_relation.VAL9 67 | WHEN message_relation.LBL10 = "LIKES" THEN message_relation.VAL10 68 | END AS hasLike, 69 | CASE 70 | WHEN message_relation.LBL1 = "LIKES" THEN message_relation.EID1 71 | WHEN message_relation.LBL2 = "LIKES" THEN message_relation.EID2 72 | WHEN message_relation.LBL3 = "LIKES" THEN message_relation.EID3 73 | WHEN message_relation.LBL4 = "LIKES" THEN message_relation.EID4 74 | WHEN message_relation.LBL5 = "LIKES" THEN message_relation.EID5 75 | WHEN message_relation.LBL6 = "LIKES" THEN message_relation.EID6 76 | WHEN message_relation.LBL7 = "LIKES" THEN message_relation.EID7 77 | WHEN message_relation.LBL8 = "LIKES" THEN message_relation.VAL8 78 | WHEN message_relation.LBL9 = "LIKES" THEN message_relation.EID9 79 | WHEN message_relation.LBL10 = "LIKES" THEN message_relation.EID10 80 | END AS hasLikeEID 81 | FROM ( 82 | SELECT 83 | COALESCE(has_message.VAL, hasMessage) AS messageId 84 | FROM ( 85 | SELECT 86 | CASE 87 | WHEN person.LBL1 = "HAS_CREATOR" THEN person.VAL1 88 | WHEN person.LBL2 = "HAS_CREATOR" THEN person.VAL2 89 | WHEN person.LBL3 = "HAS_CREATOR" THEN person.VAL3 90 | WHEN person.LBL4 = "HAS_CREATOR" THEN person.VAL4 91 | WHEN person.LBL5 = "HAS_CREATOR" THEN person.VAL5 92 | WHEN person.LBL6 = "HAS_CREATOR" THEN person.VAL6 93 | WHEN person.LBL7 = "HAS_CREATOR" THEN person.VAL7 94 | WHEN person.LBL8 = "HAS_CREATOR" THEN person.VAL8 95 | WHEN person.LBL9 = "HAS_CREATOR" THEN person.VAL9 96 | WHEN person.LBL10 = "HAS_CREATOR" THEN person.VAL10 97 | END AS hasMessage 98 | FROM IPA person 99 | WHERE VID = 1502199023259437 100 | ) AS has_message_relation 101 | LEFT JOIN ISA has_message ON (has_message.VALID = has_message_relation.hasMessage) 102 | ) AS has_message 103 | JOIN IPA message_relation ON (message_relation.VID = has_message.messageId) 104 | ) AS has_like_relation 105 | LEFT JOIN ISA has_like ON (has_like.VALID = has_like_relation.hasLike) 106 | ) AS likes 107 | JOIN EA like_relation ON (like_relation.EID = likes.likeEid) 108 | GROUP BY likerId 109 | ) AS recent_likes 110 | JOIN VA message ON (message.VID = recent_likes.messageId) 111 | JOIN VA person ON (person.VID = likerId) 112 | ORDER BY likeDate Desc, likerId 113 | LIMIT 10; 114 | -------------------------------------------------------------------------------- /sqlgraph/script/normalise.py: -------------------------------------------------------------------------------- 1 | 2 | # coding: utf-8 3 | 4 | import os 5 | import csv 6 | import re 7 | import sys 8 | import inspect 9 | 10 | cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0])) 11 | if cmd_folder not in sys.path: 12 | sys.path.insert(0, cmd_folder) 13 | 14 | try: 15 | import pyprind 16 | installed = True 17 | except ImportError: 18 | installed = False # not installed 19 | 20 | if (len(sys.argv) >= 1): 21 | ldbcPath = sys.argv[1] 22 | outPath = sys.argv[2] 23 | else: 24 | print ("[ERROR] Wrong usage. Is it being run through the script?") 25 | exit(1) 26 | 27 | if not os.path.exists(ldbcPath): 28 | print ("[ERROR] LDBC folder " + ldbcPath + " does no exist.") 29 | exit(2) 30 | 31 | def appendUsage(data): 32 | with open(outPath + "/conversion.log", "a") as f: 33 | f.write(str(data) + '\n\n') 34 | 35 | # Set current directory 36 | print('Data will be printed to', outPath, '\n') 37 | 38 | # Make normalised directory if not already exist 39 | if not os.path.exists(outPath + '/normalised'): os.makedirs(outPath + '/normalised') 40 | 41 | # Retrieve all csv files in ldbc directory 42 | files = os.listdir(ldbcPath) 43 | lf = max([len(x) for x in files]) 44 | 45 | # Get graph entities by regex matching 46 | entities = [x for x in files if re.match(r'[a-zA-Z]*_0_0.csv', x)] 47 | 48 | # Normalise entities too, so append to list 49 | entities += ['person_complete_0_0.csv'] 50 | 51 | # Find all other files representing graph relationships 52 | relations = [x for x in files if x not in entities and x.endswith('.csv')] 53 | 54 | # print(relations) 55 | # print(entities) 56 | 57 | # #### Find the largest ID in all entities, this helps serve as basis for the id length normalization 58 | 59 | print("# Performing id normalisation across data") 60 | print("# -----------------------------------------------------------------------------------------------\n") 61 | 62 | largest = 0 63 | largestIn = '' 64 | 65 | if installed: bar = pyprind.ProgPercent(len(entities), title='Searching for largest id', monitor=True) 66 | for filename in entities: 67 | with open(ldbcPath + '/' + filename, "r") as f: 68 | reader = csv.reader(f, delimiter="|") 69 | 70 | next(reader) 71 | 72 | maxid = max([int(row[0]) for row in reader]) 73 | 74 | if maxid > largest: 75 | largest = maxid 76 | largestIn = filename 77 | 78 | if installed: bar.update(item_id = filename + " "*(lf-len(filename))) 79 | 80 | if installed: 81 | appendUsage(bar) 82 | print('\n') 83 | 84 | # print(str(largest) + " is largest ID, found in: " + largestIn, '\n') 85 | 86 | largestLength = str(len(str(largest))) + 'd' 87 | 88 | # #### Given above, normalize each ID in the tables, and prepend 'prefix' to categorise, then write out new formated data into the directory 'normalised'. This is done to avoid pk clash in SQL 89 | 90 | # Make number n in length of biggest id 91 | # prepend prefix (category) p 92 | format = lambda p,n: str(p) + (u'%0' + largestLength) % int(n) 93 | 94 | dict = {'continent': 10, 'country': 10, 'city': 10, 95 | 'place': 10, 'company': 11, 'university': 11, 96 | 'organisation': 11, 'person': 15, 'post': 25, 97 | 'tag': 30, 'tagclass': 32, 'comment': 33, 98 | 'forum': 43} 99 | 100 | # Test with num 993 101 | # print("Test normalisation: " + format('81', 993)) 102 | 103 | # For every id column, normalize length 104 | if installed: bar = pyprind.ProgPercent(len(entities), title='Normalising entitiy Id to avoid clashing', monitor=True) 105 | for filename in entities: 106 | with open(ldbcPath + "/" + filename, "r") as f,\ 107 | open(outPath + '/normalised/' + filename, "w") as g: 108 | reader = csv.reader(f, delimiter="|") 109 | writer = csv.writer(g, delimiter="|") 110 | 111 | # Make sure id in first column 112 | # print(next(reader)) 113 | 114 | # Writeout header line in CSV file 115 | # :-1 for all but last column (empty) 116 | writer.writerow(next(reader)[:-1]) 117 | 118 | # RegEx to Remove _digit_digit.csv 119 | c = re.sub(r'_.*\.csv', '', filename) 120 | 121 | # Retrieve the prefix from dict 122 | prefix = dict[c] 123 | 124 | for row in reader: 125 | fid = [format(prefix, row[0])] 126 | data = row[1:-1] 127 | 128 | # append the new ids together with old data and write 129 | writer.writerow(fid + data) 130 | 131 | if installed: bar.update(item_id = filename + " "*(lf-len(filename))) 132 | 133 | if installed: 134 | appendUsage(bar) 135 | print('\n') 136 | 137 | # #### Do same as above for all relation tables. This matches around foreign keys e.g. Person.Id and Tag.Id 138 | 139 | if installed: bar = pyprind.ProgPercent(len(relations), title='Normalising relation Id similar to above', monitor=True) 140 | for filename in relations: 141 | with open(ldbcPath + "/" + filename, "r") as f,\ 142 | open(outPath + '/normalised/' + filename, "w") as g: 143 | reader = csv.reader(f, delimiter="|") 144 | writer = csv.writer(g, delimiter="|") 145 | 146 | header = next(reader) 147 | writer.writerow(header) 148 | 149 | # For each column, check if column name contains .id (is foreign key) 150 | # Create dictionary of index in column as key and prefix as value 151 | colPrefix = {ind:dict[str.split(x, '.')[0].lower()] for ind, x in enumerate(header) if '.id' in x} 152 | 153 | # Get the range of the data 154 | r = range(len(header)) 155 | 156 | for row in reader: 157 | # List comprehension, instead of extracting column 158 | # process them, and reinsert; linearly iterate through 159 | # the rows, if it's an id, then format else keep as is 160 | newRow = [format(colPrefix[ind], row[ind]) if ind in colPrefix else row[ind] for ind in r] 161 | 162 | # Write out the data 163 | writer.writerow(newRow) 164 | 165 | if installed: bar.update(item_id = filename + " "*(lf-len(filename))) 166 | 167 | if installed: 168 | appendUsage(bar) 169 | print('\n') 170 | -------------------------------------------------------------------------------- /neo4j/neo4j-ldbc-ingester/change_headers.sh: -------------------------------------------------------------------------------- 1 | #This file changes the headers of the LDBC csv files to 2 | #the syntax requried by the neo4j bulk ingester 3 | 4 | DATALOCATION=$1 5 | echo "Changing Node Headers" 6 | ############################################ NODE CHANGES ################################################### 7 | 8 | #Person file changes 9 | sed -i '1,1s/id/id:ID(Person)/g' $DATALOCATION/person_complete_0_0.csv 10 | #City file changes 11 | sed -i '1,1s/id/id:ID(Place)/g' $DATALOCATION/city_0_0.csv 12 | #Country file changes 13 | sed -i '1,1s/id/id:ID(Place)/g' $DATALOCATION/country_0_0.csv 14 | #Continent file changes 15 | sed -i '1,1s/id/id:ID(Place)/g' $DATALOCATION/continent_0_0.csv 16 | #Forum file changes 17 | sed -i '1,1s/id/id:ID(Forum)/g' $DATALOCATION/forum_0_0.csv 18 | #Post file changes 19 | sed -i '1,1s/id/id:ID(Message)/g' $DATALOCATION/post_0_0.csv 20 | #Comment file changes 21 | sed -i '1,1s/id/id:ID(Message)/g' $DATALOCATION/comment_0_0.csv 22 | #Company file changes 23 | sed -i '1,1s/id/id:ID(Organisation)/g' $DATALOCATION/company_0_0.csv 24 | #University file changes 25 | sed -i '1,1s/id/id:ID(Organisation)/g' $DATALOCATION/university_0_0.csv 26 | #Tag file changes 27 | sed -i '1,1s/id/id:ID(Tag)/g' $DATALOCATION/tag_0_0.csv 28 | #TagClass file changes 29 | sed -i '1,1s/id/id:ID(TagClass)/g' $DATALOCATION/tagclass_0_0.csv 30 | 31 | ######################################## RELATIONSHIP CHANGES ############################################### 32 | 33 | echo "Changing relationship headers " 34 | #TagClass subclass of tagclass 35 | sed -i '1,1s/TagClass.id/:START_ID(TagClass)/' $DATALOCATION/tagclass_isSubclassOf_tagclass_0_0.csv 36 | sed -i '1,1s/TagClass.id/:END_ID(TagClass)/' $DATALOCATION/tagclass_isSubclassOf_tagclass_0_0.csv 37 | 38 | #Tag has type TagClass 39 | sed -i '1,1s/Tag.id/:START_ID(Tag)/' $DATALOCATION/tag_hasType_tagclass_0_0.csv 40 | sed -i '1,1s/TagClass.id/:END_ID(TagClass)/' $DATALOCATION/tag_hasType_tagclass_0_0.csv 41 | 42 | #person knows person 43 | sed -i '1,1s/Person.id/:START_ID(Person)/' $DATALOCATION/person_knows_person_0_0.csv 44 | sed -i '1,1s/Person.id/:END_ID(Person)/' $DATALOCATION/person_knows_person_0_0.csv 45 | 46 | #Person is located in city 47 | sed -i '1,1s/Person.id/:START_ID(Person)/' $DATALOCATION/person_isLocatedIn_place_0_0.csv 48 | sed -i '1,1s/Place.id/:END_ID(Place)/' $DATALOCATION/person_isLocatedIn_place_0_0.csv 49 | 50 | #Person has Interest Tag 51 | sed -i '1,1s/Person.id/:START_ID(Person)/' $DATALOCATION/person_hasInterest_tag_0_0.csv 52 | sed -i '1,1s/Tag.id/:END_ID(Tag)/' $DATALOCATION/person_hasInterest_tag_0_0.csv 53 | 54 | #Person likes Post 55 | sed -i '1,1s/Person.id/:START_ID(Person)/' $DATALOCATION/person_likes_post_0_0.csv 56 | sed -i '1,1s/Post.id/:END_ID(Message)/' $DATALOCATION/person_likes_post_0_0.csv 57 | 58 | #Person likes Comment 59 | sed -i '1,1s/Person.id/:START_ID(Person)/' $DATALOCATION/person_likes_comment_0_0.csv 60 | sed -i '1,1s/Comment.id/:END_ID(Message)/' $DATALOCATION/person_likes_comment_0_0.csv 61 | 62 | #Person Study At University 63 | sed -i '1,1s/Person.id/:START_ID(Person)/' $DATALOCATION/person_studyAt_organisation_0_0.csv 64 | sed -i '1,1s/Organisation.id/:END_ID(Organisation)/' $DATALOCATION/person_studyAt_organisation_0_0.csv 65 | 66 | #Person works at organisation 67 | sed -i '1,1s/Person.id/:START_ID(Person)/' $DATALOCATION/person_workAt_organisation_0_0.csv 68 | sed -i '1,1s/Organisation.id/:END_ID(Organisation)/' $DATALOCATION/person_workAt_organisation_0_0.csv 69 | 70 | #Organisation is loacted in place 71 | sed -i '1,1s/Organisation.id/:START_ID(Organisation)/' $DATALOCATION/organisation_isLocatedIn_place_0_0.csv 72 | sed -i '1,1s/Place.id/:END_ID(Place)/' $DATALOCATION/organisation_isLocatedIn_place_0_0.csv 73 | 74 | #Place is part of place 75 | sed -i '1,1s/Place.id/:START_ID(Place)/' $DATALOCATION/place_isPartOf_place_0_0.csv 76 | sed -i '1,1s/Place.id/:END_ID(Place)/' $DATALOCATION/place_isPartOf_place_0_0.csv 77 | 78 | #Comment has creator Person 79 | sed -i '1,1s/Comment.id/:START_ID(Message)/' $DATALOCATION/comment_hasCreator_person_0_0.csv 80 | sed -i '1,1s/Person.id/:END_ID(Person)/' $DATALOCATION/comment_hasCreator_person_0_0.csv 81 | 82 | #Post has creator Person 83 | sed -i '1,1s/Post.id/:START_ID(Message)/' $DATALOCATION/post_hasCreator_person_0_0.csv 84 | sed -i '1,1s/Person.id/:END_ID(Person)/' $DATALOCATION/post_hasCreator_person_0_0.csv 85 | 86 | #Comment has tag 87 | sed -i '1,1s/Comment.id/:START_ID(Message)/' $DATALOCATION/comment_hasTag_tag_0_0.csv 88 | sed -i '1,1s/Tag.id/:END_ID(Tag)/' $DATALOCATION/comment_hasTag_tag_0_0.csv 89 | 90 | #Post has tag 91 | sed -i '1,1s/Post.id/:START_ID(Message)/' $DATALOCATION/post_hasTag_tag_0_0.csv 92 | sed -i '1,1s/Tag.id/:END_ID(Tag)/' $DATALOCATION/post_hasTag_tag_0_0.csv 93 | 94 | #Comment reply of Comment 95 | sed -i '1,1s/Comment.id/:START_ID(Message)/' $DATALOCATION/comment_replyOf_comment_0_0.csv 96 | sed -i '1,1s/Comment.id/:END_ID(Message)/' $DATALOCATION/comment_replyOf_comment_0_0.csv 97 | 98 | #Comment reply of Post 99 | sed -i '1,1s/Comment.id/:START_ID(Message)/' $DATALOCATION/comment_replyOf_post_0_0.csv 100 | sed -i '1,1s/Post.id/:END_ID(Message)/' $DATALOCATION/comment_replyOf_post_0_0.csv 101 | 102 | #Comment is located in place 103 | sed -i '1,1s/Comment.id/:START_ID(Message)/' $DATALOCATION/comment_isLocatedIn_place_0_0.csv 104 | sed -i '1,1s/Place.id/:END_ID(Place)/' $DATALOCATION/comment_isLocatedIn_place_0_0.csv 105 | 106 | #Post is located in place 107 | sed -i '1,1s/Post.id/:START_ID(Message)/' $DATALOCATION/post_isLocatedIn_place_0_0.csv 108 | sed -i '1,1s/Place.id/:END_ID(Place)/' $DATALOCATION/post_isLocatedIn_place_0_0.csv 109 | 110 | #Forum has member person 111 | sed -i '1,1s/Forum.id/:START_ID(Forum)/' $DATALOCATION/forum_hasMember_person_0_0.csv 112 | sed -i '1,1s/Person.id/:END_ID(Person)/' $DATALOCATION/forum_hasMember_person_0_0.csv 113 | 114 | #Forum has moderator person 115 | sed -i '1,1s/Forum.id/:START_ID(Forum)/' $DATALOCATION/forum_hasModerator_person_0_0.csv 116 | sed -i '1,1s/Person.id/:END_ID(Person)/' $DATALOCATION/forum_hasModerator_person_0_0.csv 117 | 118 | #Forum container of Post 119 | sed -i '1,1s/Forum.id/:START_ID(Forum)/' $DATALOCATION/forum_containerOf_post_0_0.csv 120 | sed -i '1,1s/Post.id/:END_ID(Message)/' $DATALOCATION/forum_containerOf_post_0_0.csv 121 | 122 | #Forum has Tag 123 | sed -i '1,1s/Forum.id/:START_ID(Forum)/' $DATALOCATION/forum_hasTag_tag_0_0.csv 124 | sed -i '1,1s/Tag.id/:END_ID(Tag)/' $DATALOCATION/forum_hasTag_tag_0_0.csv 125 | 126 | echo "Finished changing headers" 127 | -------------------------------------------------------------------------------- /sqlgraph/resources/queries/query9multihop3.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | creator.ATTR->'$.FIRST_NAME' AS firstName, 3 | creator.ATTR->'$.LAST_NAME' AS lastName, 4 | message.VID AS commentId, 5 | IF ( 6 | message.ATTR->'$.CONTENT' = "", 7 | message.ATTR->'$.IMAGE_FILE', 8 | message.ATTR->'$.CONTENT' 9 | ) content, 10 | message.ATTR->'$.CREATION_DATE' AS creationdate 11 | FROM ( 12 | SELECT 13 | f_fof_fofof.VID AS personId, 14 | CASE 15 | WHEN f_fof_fofof.LBL1 = "HAS_CREATOR" THEN f_fof_fofof.VAL1 16 | WHEN f_fof_fofof.LBL2 = "HAS_CREATOR" THEN f_fof_fofof.VAL2 17 | WHEN f_fof_fofof.LBL3 = "HAS_CREATOR" THEN f_fof_fofof.VAL3 18 | WHEN f_fof_fofof.LBL4 = "HAS_CREATOR" THEN f_fof_fofof.VAL4 19 | WHEN f_fof_fofof.LBL5 = "HAS_CREATOR" THEN f_fof_fofof.VAL5 20 | WHEN f_fof_fofof.LBL6 = "HAS_CREATOR" THEN f_fof_fofof.VAL6 21 | WHEN f_fof_fofof.LBL7 = "HAS_CREATOR" THEN f_fof_fofof.VAL7 22 | WHEN f_fof_fofof.LBL8 = "HAS_CREATOR" THEN f_fof_fofof.VAL8 23 | WHEN f_fof_fofof.LBL9 = "HAS_CREATOR" THEN f_fof_fofof.VAL9 24 | END AS hasMessage 25 | FROM ( 26 | SELECT friends.* 27 | FROM ( 28 | SELECT 29 | CASE 30 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 31 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 32 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 33 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 34 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 35 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 36 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 37 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 38 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 39 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 40 | END AS knows 41 | FROM OPA person 42 | WHERE person.VID = 1502199023259437 43 | ) AS person_relation 44 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 45 | JOIN IPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 46 | UNION 47 | SELECT fof.* 48 | FROM ( 49 | SELECT 50 | friends.*, 51 | CASE 52 | WHEN friends.LBL1 = "KNOWS" THEN friends.VAL1 53 | WHEN friends.LBL2 = "KNOWS" THEN friends.VAL2 54 | WHEN friends.LBL3 = "KNOWS" THEN friends.VAL3 55 | WHEN friends.LBL4 = "KNOWS" THEN friends.VAL4 56 | WHEN friends.LBL5 = "KNOWS" THEN friends.VAL5 57 | WHEN friends.LBL6 = "KNOWS" THEN friends.VAL6 58 | WHEN friends.LBL7 = "KNOWS" THEN friends.VAL7 59 | WHEN friends.LBL8 = "KNOWS" THEN friends.VAL8 60 | WHEN friends.LBL9 = "KNOWS" THEN friends.VAL9 61 | WHEN friends.LBL10 = "KNOWS" THEN friends.VAL10 62 | END AS fKnows 63 | FROM ( 64 | SELECT 65 | CASE 66 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 67 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 68 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 69 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 70 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 71 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 72 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 73 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 74 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 75 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 76 | END AS knows 77 | FROM OPA person 78 | WHERE person.VID = 1502199023259437 79 | ) AS person_relation 80 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 81 | JOIN OPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 82 | ) AS friends 83 | LEFT JOIN OSA fof_relation ON (fof_relation.VALID = friends.fKnows) 84 | JOIN IPA fof ON COALESCE(fof_relation.VAL, friends.fKnows) = fof.VID 85 | UNION 86 | SELECT fofof.* 87 | FROM ( 88 | SELECT fof.*, 89 | CASE 90 | WHEN fof.LBL1 = "KNOWS" THEN fof.VAL1 91 | WHEN fof.LBL2 = "KNOWS" THEN fof.VAL2 92 | WHEN fof.LBL3 = "KNOWS" THEN fof.VAL3 93 | WHEN fof.LBL4 = "KNOWS" THEN fof.VAL4 94 | WHEN fof.LBL5 = "KNOWS" THEN fof.VAL5 95 | WHEN fof.LBL6 = "KNOWS" THEN fof.VAL6 96 | WHEN fof.LBL7 = "KNOWS" THEN fof.VAL7 97 | WHEN fof.LBL8 = "KNOWS" THEN fof.VAL8 98 | WHEN fof.LBL9 = "KNOWS" THEN fof.VAL9 99 | WHEN fof.LBL10 = "KNOWS" THEN fof.VAL10 100 | END AS fofKnows 101 | FROM ( 102 | SELECT 103 | friends.*, 104 | CASE 105 | WHEN friends.LBL1 = "KNOWS" THEN friends.VAL1 106 | WHEN friends.LBL2 = "KNOWS" THEN friends.VAL2 107 | WHEN friends.LBL3 = "KNOWS" THEN friends.VAL3 108 | WHEN friends.LBL4 = "KNOWS" THEN friends.VAL4 109 | WHEN friends.LBL5 = "KNOWS" THEN friends.VAL5 110 | WHEN friends.LBL6 = "KNOWS" THEN friends.VAL6 111 | WHEN friends.LBL7 = "KNOWS" THEN friends.VAL7 112 | WHEN friends.LBL8 = "KNOWS" THEN friends.VAL8 113 | WHEN friends.LBL9 = "KNOWS" THEN friends.VAL9 114 | WHEN friends.LBL10 = "KNOWS" THEN friends.VAL10 115 | END AS fKnows 116 | FROM ( 117 | SELECT 118 | CASE 119 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 120 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 121 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 122 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 123 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 124 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 125 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 126 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 127 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 128 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 129 | END AS knows 130 | FROM OPA person 131 | WHERE person.VID = 1502199023259437 132 | ) AS person_relation 133 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 134 | JOIN OPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 135 | ) AS friends 136 | LEFT JOIN OSA fof_relation ON (fof_relation.VALID = friends.fKnows) 137 | JOIN OPA fof ON COALESCE(fof_relation.VAL, friends.fKnows) = fof.VID 138 | ) AS fof 139 | LEFT JOIN OSA fofof_relation ON (fofof_relation.VALID = fof.fofKnows) 140 | JOIN IPA fofof ON COALESCE(fofof_relation.VAL, fof.fofKnows) = fofof.VID 141 | ) AS f_fof_fofof 142 | ) AS f_fof_fofof_messages 143 | LEFT JOIN ISA has_message ON (has_message.VALID = hasMessage) 144 | JOIN VA message ON COALESCE(has_message.VAL, hasMessage) = message.VID 145 | JOIN VA creator ON (creator.VID = personId) 146 | ORDER BY creationDate Desc, message.VID 147 | LIMIT 20; -------------------------------------------------------------------------------- /vertica/queries/query9multihop3.sql: -------------------------------------------------------------------------------- 1 | \o /dev/null 2 | 3 | SELECT /*+label(query9multihop3)*/ DISTINCT * 4 | FROM 5 | (SELECT DISTINCT message.id AS messageId, 6 | message.creationDate AS messageCreationDate, 7 | friend.id AS personId, 8 | friend.firstName AS personFirstName, 9 | friend.lastName AS personLastName, 10 | CASE 11 | WHEN message.content IS NOT NULL THEN message.content 12 | ELSE '' 13 | END AS messageContent 14 | FROM person AS p_$1 15 | JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) 16 | JOIN Person AS p_$2 ON (p_$2.id = person_knows_person.other_person_id) 17 | JOIN person_knows_person AS person_knows_person_$1 ON (person_knows_person_$1.person_id = p_$2.id) 18 | JOIN Person AS friend ON (friend.id = person_knows_person_$1.other_person_id) 19 | JOIN comment_hasCreator_person ON (comment_hasCreator_person.person_id = friend.id) 20 | JOIN COMMENT AS message ON (message.id = comment_hasCreator_person.comment_id) 21 | WHERE p_$1.id = 2199023259437 22 | AND message.creationDate < '2016-7-7' 23 | UNION SELECT DISTINCT message.id AS messageId, 24 | message.creationDate AS messageCreationDate, 25 | friend.id AS personId, 26 | friend.firstName AS personFirstName, 27 | friend.lastName AS personLastName, 28 | CASE 29 | WHEN message.content IS NOT NULL THEN message.content 30 | ELSE '' 31 | END AS messageContent 32 | FROM person AS p_$1 33 | JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) 34 | JOIN Person AS p_$2 ON (p_$2.id = person_knows_person.other_person_id) 35 | JOIN person_knows_person AS person_knows_person_$1 ON (person_knows_person_$1.person_id = p_$2.id) 36 | JOIN Person AS p_$3 ON (p_$3.id = person_knows_person_$1.other_person_id) 37 | JOIN person_knows_person AS person_knows_person_$2 ON (person_knows_person_$2.person_id = p_$3.id) 38 | JOIN Person AS friend ON (friend.id = person_knows_person_$2.other_person_id) 39 | JOIN comment_hasCreator_person ON (comment_hasCreator_person.person_id = friend.id) 40 | JOIN COMMENT AS message ON (message.id = comment_hasCreator_person.comment_id) 41 | WHERE p_$1.id = 2199023259437 42 | AND message.creationDate < '2016-7-7' 43 | UNION SELECT DISTINCT message.id AS messageId, 44 | message.creationDate AS messageCreationDate, 45 | friend.id AS personId, 46 | friend.firstName AS personFirstName, 47 | friend.lastName AS personLastName, 48 | CASE 49 | WHEN message.content IS NOT NULL THEN message.content 50 | ELSE message.imageFile 51 | END AS messageContent 52 | FROM person AS p_$1 53 | JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) 54 | JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) 55 | JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) 56 | JOIN Post AS message ON (message.id = post_hasCreator_person.post_id) 57 | WHERE p_$1.id = 2199023259437 58 | AND message.creationDate < '2016-7-7' 59 | UNION SELECT DISTINCT message.id AS messageId, 60 | message.creationDate AS messageCreationDate, 61 | friend.id AS personId, 62 | friend.firstName AS personFirstName, 63 | friend.lastName AS personLastName, 64 | CASE 65 | WHEN message.content IS NOT NULL THEN message.content 66 | ELSE message.imageFile 67 | END AS messageContent 68 | FROM person AS p_$1 69 | JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) 70 | JOIN Person AS p_$2 ON (p_$2.id = person_knows_person.other_person_id) 71 | JOIN person_knows_person AS person_knows_person_$1 ON (person_knows_person_$1.person_id = p_$2.id) 72 | JOIN Person AS p_$3 ON (p_$3.id = person_knows_person_$1.other_person_id) 73 | JOIN person_knows_person AS person_knows_person_$2 ON (person_knows_person_$2.person_id = p_$3.id) 74 | JOIN Person AS friend ON (friend.id = person_knows_person_$2.other_person_id) 75 | JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) 76 | JOIN Post AS message ON (message.id = post_hasCreator_person.post_id) 77 | WHERE p_$1.id = 2199023259437 78 | AND message.creationDate < '2016-7-7' 79 | UNION SELECT DISTINCT message.id AS messageId, 80 | message.creationDate AS messageCreationDate, 81 | friend.id AS personId, 82 | friend.firstName AS personFirstName, 83 | friend.lastName AS personLastName, 84 | CASE 85 | WHEN message.content IS NOT NULL THEN message.content 86 | ELSE message.imageFile 87 | END AS messageContent 88 | FROM person AS p_$1 89 | JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) 90 | JOIN Person AS p_$2 ON (p_$2.id = person_knows_person.other_person_id) 91 | JOIN person_knows_person AS person_knows_person_$1 ON (person_knows_person_$1.person_id = p_$2.id) 92 | JOIN Person AS friend ON (friend.id = person_knows_person_$1.other_person_id) 93 | JOIN post_hasCreator_person ON (post_hasCreator_person.person_id = friend.id) 94 | JOIN Post AS message ON (message.id = post_hasCreator_person.post_id) 95 | WHERE p_$1.id = 2199023259437 96 | AND message.creationDate < '2016-7-7' 97 | UNION SELECT DISTINCT message.id AS messageId, 98 | message.creationDate AS messageCreationDate, 99 | friend.id AS personId, 100 | friend.firstName AS personFirstName, 101 | friend.lastName AS personLastName, 102 | CASE 103 | WHEN message.content IS NOT NULL THEN message.content 104 | ELSE '' 105 | END AS messageContent 106 | FROM person AS p_$1 107 | JOIN person_knows_person ON (person_knows_person.person_id = p_$1.id) 108 | JOIN Person AS friend ON (friend.id = person_knows_person.other_person_id) 109 | JOIN comment_hasCreator_person ON (comment_hasCreator_person.person_id = friend.id) 110 | JOIN COMMENT AS message ON (message.id = comment_hasCreator_person.comment_id) 111 | WHERE p_$1.id = 2199023259437 112 | AND message.creationDate < '2016-7-7') AS unionAlias 113 | ORDER BY messageCreationDate DESC, 114 | messageId LIMIT 100; 115 | 116 | -------------------------------------------------------------------------------- /sqlgraph/resources/queries/query10.sql: -------------------------------------------------------------------------------- 1 | # Query 10: Friends Recommendation 2 | # ==================================================================================================================== 3 | 4 | SELECT 5 | personId, 6 | SUM(interest) - (count(*) - SUM(interest)) AS similarityScore, 7 | person.ATTR->'$.FIRST_NAME' AS firstName, 8 | person.ATTR->'$.LAST_NAME' AS lastName 9 | FROM ( 10 | SELECT 11 | poi_tags.personId, 12 | COUNT(interestId) AS interest 13 | FROM ( 14 | SELECT 15 | poi_has_tags.personId, 16 | COALESCE(has_tag.VAL, poi_has_tags.hasTag) AS tagId, 17 | messageId 18 | FROM ( 19 | SELECT 20 | poi_messages.personId, 21 | CASE 22 | WHEN posts.LBL1 = "HAS_TAG" THEN posts.VAL1 23 | WHEN posts.LBL2 = "HAS_TAG" THEN posts.VAL2 24 | WHEN posts.LBL3 = "HAS_TAG" THEN posts.VAL3 25 | WHEN posts.LBL4 = "HAS_TAG" THEN posts.VAL4 26 | WHEN posts.LBL5 = "HAS_TAG" THEN posts.VAL5 27 | WHEN posts.LBL6 = "HAS_TAG" THEN posts.VAL6 28 | WHEN posts.LBL7 = "HAS_TAG" THEN posts.VAL7 29 | WHEN posts.LBL8 = "HAS_TAG" THEN posts.VAL8 30 | WHEN posts.LBL9 = "HAS_TAG" THEN posts.VAL9 31 | WHEN posts.LBL10 = "HAS_TAG" THEN posts.VAL10 32 | END AS hasTag, 33 | messageId 34 | FROM ( 35 | SELECT DISTINCT 36 | fof_ex_f.VID AS personId, 37 | COALESCE(has_message.VAL, hasMessage) AS messageId 38 | FROM ( 39 | SELECT 40 | fof.VID, 41 | CASE 42 | WHEN fof.LBL1 = "HAS_CREATOR" THEN fof.VAL1 43 | WHEN fof.LBL2 = "HAS_CREATOR" THEN fof.VAL2 44 | WHEN fof.LBL3 = "HAS_CREATOR" THEN fof.VAL3 45 | WHEN fof.LBL4 = "HAS_CREATOR" THEN fof.VAL4 46 | WHEN fof.LBL5 = "HAS_CREATOR" THEN fof.VAL5 47 | WHEN fof.LBL6 = "HAS_CREATOR" THEN fof.VAL6 48 | WHEN fof.LBL7 = "HAS_CREATOR" THEN fof.VAL7 49 | WHEN fof.LBL8 = "HAS_CREATOR" THEN fof.VAL8 50 | WHEN fof.LBL9 = "HAS_CREATOR" THEN fof.VAL9 51 | END AS hasMessage 52 | FROM ( 53 | SELECT 54 | friends.*, 55 | CASE 56 | WHEN friends.LBL1 = "KNOWS" THEN friends.VAL1 57 | WHEN friends.LBL2 = "KNOWS" THEN friends.VAL2 58 | WHEN friends.LBL3 = "KNOWS" THEN friends.VAL3 59 | WHEN friends.LBL4 = "KNOWS" THEN friends.VAL4 60 | WHEN friends.LBL5 = "KNOWS" THEN friends.VAL5 61 | WHEN friends.LBL6 = "KNOWS" THEN friends.VAL6 62 | WHEN friends.LBL7 = "KNOWS" THEN friends.VAL7 63 | WHEN friends.LBL8 = "KNOWS" THEN friends.VAL8 64 | WHEN friends.LBL9 = "KNOWS" THEN friends.VAL9 65 | WHEN friends.LBL10 = "KNOWS" THEN friends.VAL10 66 | END AS fKnows 67 | FROM ( 68 | SELECT 69 | CASE 70 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 71 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 72 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 73 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 74 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 75 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 76 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 77 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 78 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 79 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 80 | END AS knows 81 | FROM OPA person 82 | WHERE person.VID = 1502199023259437 83 | ) AS person_relation 84 | LEFT JOIN OSA friends_relation ON (friends_relation.VALID = person_relation.knows) 85 | JOIN OPA friends ON COALESCE(friends_relation.VAL, person_relation.knows) = friends.VID 86 | ) AS friends 87 | LEFT JOIN OSA fof_relation ON (fof_relation.VALID = friends.fKnows) 88 | JOIN IPA fof ON COALESCE(fof_relation.VAL, friends.fKnows) = fof.VID 89 | WHERE fof.VID NOT IN ( 90 | SELECT friends.VID 91 | FROM OPA person 92 | JOIN OSA friends_relation ON CASE 93 | WHEN person.LBL1 = "KNOWS" THEN person.VAL1 94 | WHEN person.LBL2 = "KNOWS" THEN person.VAL2 95 | WHEN person.LBL3 = "KNOWS" THEN person.VAL3 96 | WHEN person.LBL4 = "KNOWS" THEN person.VAL4 97 | WHEN person.LBL5 = "KNOWS" THEN person.VAL5 98 | WHEN person.LBL6 = "KNOWS" THEN person.VAL6 99 | WHEN person.LBL7 = "KNOWS" THEN person.VAL7 100 | WHEN person.LBL8 = "KNOWS" THEN person.VAL8 101 | WHEN person.LBL9 = "KNOWS" THEN person.VAL9 102 | WHEN person.LBL10 = "KNOWS" THEN person.VAL10 103 | END = friends_relation.VALID 104 | JOIN OPA friends ON (friends_relation.VAL = friends.VID) 105 | WHERE person.VID = 1502199023259437 106 | ) 107 | GROUP BY fof.VID, hasMessage 108 | ) AS fof_ex_f 109 | JOIN VA person ON (person.VID = fof_ex_f.VID) 110 | LEFT JOIN ISA has_message ON (has_message.VALID = hasMessage) 111 | WHERE (month(person.ATTR->>'$.BIRTHDAY') = 3 AND day(person.ATTR->>'$.BIRTHDAY') >= 21) 112 | OR (month(person.ATTR->>'$.BIRTHDAY') = 4 AND day(person.ATTR->>'$.BIRTHDAY') <= 22) 113 | ) AS poi_messages 114 | JOIN OPA posts ON (posts.VID = messageId) AND posts.TYPE = "post" 115 | ) AS poi_has_tags 116 | LEFT JOIN OSA has_tag ON (has_tag.VALID = poi_has_tags.hasTag) 117 | ) AS poi_tags 118 | LEFT JOIN ( 119 | SELECT COALESCE(interests.VAL, has_interest.hasInterest) AS interestId 120 | FROM ( 121 | SELECT 122 | CASE 123 | WHEN person.LBL1 = "HAS_INTEREST" THEN person.VAL1 124 | WHEN person.LBL2 = "HAS_INTEREST" THEN person.VAL2 125 | WHEN person.LBL3 = "HAS_INTEREST" THEN person.VAL3 126 | WHEN person.LBL4 = "HAS_INTEREST" THEN person.VAL4 127 | WHEN person.LBL5 = "HAS_INTEREST" THEN person.VAL5 128 | WHEN person.LBL6 = "HAS_INTEREST" THEN person.VAL6 129 | WHEN person.LBL7 = "HAS_INTEREST" THEN person.VAL7 130 | WHEN person.LBL8 = "HAS_INTEREST" THEN person.VAL8 131 | WHEN person.LBL9 = "HAS_INTEREST" THEN person.VAL9 132 | WHEN person.LBL10 = "HAS_INTEREST" THEN person.VAL10 133 | END AS hasInterest 134 | FROM OPA person 135 | WHERE VID = 1502199023259437 136 | ) AS has_interest 137 | JOIN OSA interests ON (interests.VALID = has_interest.hasInterest) 138 | ) AS person_interests ON (person_interests.interestId = poi_tags.tagId) 139 | GROUP BY personId, messageId 140 | ) similarity 141 | JOIN VA person ON (person.VID = similarity.personId) 142 | GROUP BY personId 143 | ORDER BY similarityScore Desc, personId 144 | LIMIT 50; 145 | --------------------------------------------------------------------------------