Get Set


In this tutorial, we will show you how to write and run Pattern Matching queries. Pattern Matching is available in TigerGraph 2.4+.

We assume you have finished GSQL 101. If not, please complete GSQL 101 first.

What is a Graph Pattern?

Pattern is a traversal trace on the graph schema. For repetitive traversal on the schema, we can use some regular expression to represent the repeating step(s). A pattern can be a linear trace, or a non-linear trace (tree, circle etc.). For example, imagine a simple schema consisting of a Person vertex type and a Friendship edge type. A pattern could be a trace on this simple schema,

or, use *2 to denote the two consecutive Friendship edges,

What is Pattern Matching?

Pattern matching is the process of finding subgraphs in a data graph that conforms to a given query pattern.

Prepare Your TigerGraph Environment

We're assuming you are running Developer Edition as the sole user with full privileges. If you are on a multiuser Enterprise Edition, consult with your DB administrator. You need to have Designer or Admin privilege on an empty graph. There are also links to download files at various points in the tutorial. Most are small, but the graph data file is 1GB when uncompressed.

First, let's check that you can access GSQL, and that your version is 2.4 or higher.

  1. Open a Linux shell.

  2. Type gsql as below. A GSQL shell prompt should appear as below.

  3. Type version in GSQL shell. It should show 2.4 or higher as below. If not, please download and install the latest developer version from

    Linux Shell
    $ gsql
    GSQL > version
    GSQL version: 2.4
  4. If the GSQL shell does not launch, try resetting the system with "gadmin start". This will take some time to launch each service if they have not been started yet. If you need further help, please see the TigerGraph Knowledge Base and FAQs.

  5. You need to start from an empty data catalog. If necessary, run "drop all" to clear the catalog first.


The following general use commands were introduced in GSQL 101.

  • The % prefix indicates Linux shell commands. You need TigerGraph admin privilege to run most gadmin commands.

  • The GSQL> prefix indicates GSQL shell commands.