# Performance of Graph and Relational Databases in Complex Queries
## 2 Related Work
They used a schema with tables user, friends, fav_movies, and actors for testing, and they tested the databases with three queries: \"Find all friends of [PERSON]\", \"Find all favourite movies of [PERSON]\" and \"Find the lead actors of [PERSON]'s friends' favourite movies\". Queries were executed on 100 and 500 objects. Neo4j had 2-5 times faster query execution times with a 100-objects data set and 15-30 times faster query execution with a 500-objects data set. The work by [PERSON] et al. [8] was similar to that of the present study as the data were stored in an SQL database with a relational schema unlike in the work by [PERSON] et al. [7]. The work [8] by [PERSON] et al. is referenced in [5]. There also exist previous performance studies where MariaDB is involved. [PERSON] et al. compared the performance of MariaDB 10.0.21 and MySQL 5.6 [17]. They used the Sysbench and OLTP [14] software systems with OLTP-Simple and OLTP-Seats workloads. Both databases consumed the same number of resources. However, when increasing the number of threads in OLTP-Simple and the number of workers in OLTP-Seats, MySQL became clearly more efficient and outperformed MariaDB. [PERSON] et al. studied the Common Table Expression capabilities of MariaDB by comparing it to Postgres [18]. The study showed that Postgres had better results, when only a few steps of recursion were needed. However, MariaDB was a better choice for longer-executing recursive queries on huge amounts of data. [PERSON] [19] compared the performance of SQL Server 2009 and Neo4j 4.0. Four datasets were used consisting of 350,000, 700,000, 1,400,000 and 2,100,000 entries. A schema with multiple relations between entities was used. Five different query tests were performed with the different datasets. All the queries addressed relations between entities, so joins or matches between relationships were used. The results show that as query complexity and dataset complexity grew, Neo4j performed faster than the SQL Server. [PERSON] et al. [20] compared MySQL and Neo4j. Four queries were used. Three of the queries were tested with datasets containing 10, 100, 500, 1000 and 10,000 records. The fourth query was used to infer the databases' ability to handle unstructured data. In these tests, MySQL was in general faster and used less memory as the query complexity and number of records increased. Both databases were able to handle unstructured data. [PERSON] et al. [21] compared RocksDB 5.8, Hbase 2.2, Cassandra 3.11, Neo4j 3.4.6 and MySQL 5.7. Four relational datasets from TPC-H benchmark were used as well as four real graph datasets. Different types of query workloads were tested, including atomic relational queries such as projection, aggregation, join and order by, TPC-H workloads, and different graph query algorithms. The conclusion of the tests was that relational databases outperformed graph databases with workloads that mainly consisted of group by, sort, aggregation operations and their combinations. Graph databases outperformed relational databases with workloads that mainly consisted of multiple table joins, pattern matching, path identification and their combinations.