GSQL Language Reference

The GSQL™ software program is the TigerGraph comprehensive environment for designing graph schemas, loading and managing data to build a graph, and querying the graph to perform data analysis. In short, TigerGraph users do most of their work via the GSQL program. This document presents the syntax and features of the GSQL language.

The GSQL Language Reference is divided into two major parts:

What sets GSQL apart

GSQL is the choice for fast and scalable graph operations and analytics. GSQL’s similarity to SQL, high-level syntax, Turing completeness, and built-in parallelism brings faster performance, faster development and the ability to describe any algorithm.

Designed for analytics

GSQL is designed for complex graph analytics. By taking advantage of a unique feature of the GSQL query language - accumulators - users can leverage TigerGraph’s Massively Parallel Processing (MPP) capability without the pain and fuss traditionally associated with parallel programming.

Turing-complete

GSQL is Turing-complete with full support for imperative and procedural programming, ideal for algorithmic computation. The Turing completeness of the language, especially with the conventional control flow statements, allows users to describe any algorithm with GSQL.

TigerGraph offers an open-source data science library of algorithms implemented entirely in GSQL, including Louvain algorithm for community detection and the PageRank algorithm, demonstrating GSQL’s ability to describe complex algorithms.

Fast loading and querying

Data loading procedures and queries written in GSQL take full advantage of TigerGraph’s MPP capability, enabling blazing-fast data ingestion as well as querying.

In a benchmark test, TigerGraph used the Data Benchmark Council (LDBC) Social Network Benchmark (SNB) Scale Factor 30k dataset. The results show that TigerGraph can run deep-link OLAP style queries on 36 TB of raw data with 73 billion vertices and 534 billion edges, returning results in a few minutes or less.

SQL-like

GSQL features an SQL-like syntax that reduces the learning curve for SQL programmers.

The following are two queries that retrieve a list of products in alphabetical order. We can see the similarities between the two languages especially in the SELECT statements:

SQL GSQL
SELECT p.*
FROM Product p
ORDER BY p.ProductName;
CREATE QUERY products_abc() {
  products = {Product.*};

  results =
    SELECT p
    FROM products:p
    ORDER BY p.productName;

  PRINT results;
}