GSQL Query Language

The GSQL ® Query Language is a language for the exploration and analysis of large scale graphs. The high-level language makes it easy to perform powerful graph traversal queries in the TigerGraph system. By combining features familiar to database users and programmers with highly expressive new capabilities, the GSQL query language offers both easy authoring and powerful execution.

What is a GSQL query?

A GSQL query is a sequence of data retrieval-and-computation statements executed as a single operation. Users can write queries to explore a data graph however they like, to read and make computations on the graph data along the way, to update the graph, and to deliver resulting data. A query is analogous to a user-defined procedure or function: it can have one or more input parameters, and it can produce output in two ways: by returning a value or by printing.

Though GSQL is SQL-like, an important distinction between SQL and GSQL queries is that a GSQL query is a sequence of statements defined as a single operation, while a SQL query tends to be a single statement that executes directly against a database.

Query syntax versions

The current default syntax version for GSQL queries is Syntax V2. Most documentation in this section describes the language in Syntax V2. To see the different between the legacy version and V2, see Query Language Syntax Versions.

Query operations

A typical workflow for working with GSQL queries is to create the query, install the query, and then run the query.

GSQL also supports interpreting a query, which allows users to skip query installation and execute the query directly.

Example graphs

It includes example queries that demonstrate the language, each of which works on one of the following six graphs: Work_Net, Social_Net, Friend_Net, Computer_Net, Minimal_Net, and Investment_Net.

The data sets are small so that you can understand the result of each query example. The following file gsql_ref_examples_2.0.tar.gz) contains all graph schemas, data files, and queries.