Accumulators vs SQL GROUP BY Aggregation

Graph query language has always been among the top considerations when users choose a graph database for serious production use. Some considerations include but not limited to ease-of-use, expressiveness, and conformance to ISO standard. When it comes to putting graph databases into production, our experience shows that sufficient expressive power comes first. 

In our previous blog, we anatomize the basic semantics and usage pattern of accumulators. We got a lot of feedback. One of the most frequently asked questions is that Can you do all accumulator-based aggregation in SQL GroupBy style aggregation? 

Accumulator 101

Motivation

GSQL is a Turing complete Graph Database query language. Compared to other graph query languages, the biggest advantage is its support of Accumulators — global or attachable to each vertex.

In addition to providing the classic pattern match syntax, which is easy to master, GSQL supports powerful run-time vertex attributes (a.k.a local accumulators) and global state variables (a.k.a global accumulators). I have seen users learning and adopting pattern match syntax within ten minutes. However, I also witnessed the uneasiness of learning and adopting accumulators for beginners.

What Are the Major Advantages of Using a Graph Database?

A graph database is a data management system software. The building blocks are vertices and edges. To put it in a more familiar context, a relational database is also a data management software in which the building blocks are tables. Both require loading data into the software and using a query language or APIs to access the data.

Relational databases boomed in the 1980s. Many commercial companies (i.e. Oracle, Ingres, IBM) backed the relational model (tabular organization) of data management. In that era, the main data management need was to generate reports.