All Products
Search
Document Center

PolarDB:Visualization tool

Last Updated:Sep 22, 2026

PolarDB for PostgreSQLintegrates Apache AGE, an open-source graph engine, enabling you to use both standard SQL and the widely-used openCypher graph query language within the same cluster. This allows you to efficiently store, query, and analyze graph data with ease, even in complex relationship scenarios.

Step 1: Create a graph application

  1. You can create the application in one of the following two ways:

    • Go to the PolarDB console, click PolarDB AI in the left-side navigation pane, and then click Create AI Application.

    • Go to the PolarDB console. In the left-side navigation pane, click Clusters. Find the target cluster that meets the requirements and go to the cluster details page. In the left-side navigation pane, click AI Capability > AI Application, and then click Create AI Application.

  2. On the application purchase page, select the appropriate configurations based on your requirements:

    Parameter

    Description

    Billing Method

    • subscription: A prepaid billing method where you pay for resources for a fixed period. This method is suitable for long-term, stable business scenarios. Longer subscriptions offer greater discounts.

    • pay-as-you-go: A postpaid billing method that bills you based on your actual usage. This method is ideal for scenarios with flexible resource requirements.

    Database Engine

    Fixed to Apsara PolarDB.

    Region

    Select the geographic location for the application.

    Note
    • The region cannot be changed after the application is purchased.

    • The application must be in the same region as the PolarDB for PostgreSQL cluster. Therefore, select the same region as your PolarDB for PostgreSQL cluster.

    • For optimal performance, create the application in the same region as the ECS instance it will connect to. Otherwise, they must communicate over the slower public network instead of the private network.

    Architecture

    Select AI Application.

    Ecosystem

    The system automatically populates this field with the database ecosystem of the source PolarDB cluster. You do not need to configure it.

    Source PolarDB Cluster

    Select the PolarDB cluster for which you want to create the application.

    Edition

    The system automatically populates this field with the database version of the source PolarDB cluster. You do not need to configure it.

    AI Application

    Select Graph Management.

    Component Set

    Customize the number and specifications of the Backend Components based on your business requirements.

    AI Application Name

    Enter a custom name for the application.

    Note

    The name cannot start with http:// or https:// and must be 2 to 256 characters in length.

    Network Type

    Fixed to VPC.

    VPC

    The system automatically populates this field with the VPC of the source PolarDB cluster. You do not need to configure it.

    Zone and vSwitch

    For optimal network performance, select a vSwitch in the same primary zone as the PolarDB for PostgreSQL cluster.

    If the existing vSwitches do not meet your requirements, you can create a vSwitch.

    Security group

    Configure the security group for the application.

    Quantity

    Select the number of applications to purchase.

    Note
    • You can purchase only one AI application of the same type for each PolarDB for PostgreSQL cluster.

    • This parameter is available only when Billing Method is set to subscription.

    Subscription Duration

    Select the subscription duration for the application.

    Note

    This parameter is available only when Billing Method is set to subscription.

    Auto-renewal

    Specifies whether to enable auto-renewal. To prevent service interruptions caused by an overdue payment, we recommend that you enable this feature.

    Note

    This parameter is available only when Billing Method is set to subscription.

  3. After purchasing, return to the AI Applications page of the cluster to view your new application.

    Note

    Application creation takes 3 to 5 minutes.

Step 2: Connect to the graph application

  • Configure the application whitelist: On the AI Applications list page, click the Application ID of your application to go to the application details page. On the Whitelist tab, Add Whitelist, Select Security Groups, or Configure an existing whitelist group.

    Note
    • The application whitelist is independent of the cluster whitelist and must be configured separately.

    • If your ECS instance needs to access the application, go to the Instance Details page of the ECS instance to view its IP address and add the IP address to the IP whitelist.

      • If your ECS instance and the application are in the same VPC, you can add the private IP address of the ECS instance or the CIDR block of its VPC.

      • If your ECS instance and the application are not in the same VPC, you can add the public IP address of the ECS instance or the security group to which the ECS instance belongs.

    • If your on-premises server, computer, or other cloud server needs to access the application, add its public IP address to the IP whitelist.

  • Get the endpoint: On the AI Applications list page, click the Application ID of your application to go to the application details page. On the Basic Information tab, view the Private Endpoint in the Topology section.

    Note
    • A public endpoint must be requested separately. Click the Apply button to apply for one.

    • The public endpoint provides only an IP address and port, not a domain name. If you require a domain name, you must bind it yourself.

Step 3: Create extension and set up database

  1. Create the extension: Run the following statement as a privileged account.

    Note

    The age extension cannot be created manually. To use this feature, submit a ticket.

    CREATE EXTENSION age;
  2. Set up the database: For each connection, you need to add ag_catalog to search_path to simplify queries, and load the extension by using the get_cypher_keywords function:

    Note

    You may encounter compatibility issues when you use the Data Management Service (DMS) client to set search_path. You can use PolarDB-Tools to execute the statements.

    SET search_path = ag_catalog, "$user", public;

    To simplify the workflow, permanently load the extension by setting the database parameters as a privileged account. This avoids running the SET command for each new connection.

    ALTER DATABASE <dbname> SET search_path = "$user", public, ag_catalog;
    ALTER DATABASE <dbname> SET session_preload_libraries TO 'age';
  3. (Optional) Allow regular users to use AGE: Grant the USAGE permission to regular users in the ag_catalog schema.

    GRANT USAGE ON SCHEMA ag_catalog TO <username>;

    If a regular user only has read and write permissions, you must also grant them the CREATE permission to create tables.

    GRANT CREATE ON DATABASE <dbname> TO <username>;

Step 4: Create a graph and insert data

  1. You must create a graph before you can use it. To do this, use the create_graph function in the ag_catalog namespace.

    Syntax:

    SELECT create_graph('<graph_name>');

    Example:

    SELECT ag_catalog.create_graph('moviedb');
  2. Insert data: Use the following SQL statement to insert sample data into the moviedb graph:

    SELECT * FROM cypher('moviedb', $$
      CREATE (matrix:Movie {title: 'The Matrix', released: 1997})
      CREATE (cloudAtlas:Movie {title: 'Cloud Atlas', released: 2012})
      CREATE (forrestGump:Movie {title: 'Forrest Gump', released: 1994})
      CREATE (keanu:Person {name: 'Keanu Reeves', born: 1964})
      CREATE (robert:Person {name: 'Robert Zemeckis', born: 1951})
      CREATE (tom:Person {name: 'Tom Hanks', born: 1956})
      CREATE (tom)-[:ACTED_IN {roles: ['Forrest']}]->(forrestGump)
      CREATE (tom)-[:ACTED_IN {roles: ['Zachry']}]->(cloudAtlas)
      CREATE (robert)-[:DIRECTED]->(forrestGump)
    $$) AS (result1 agtype);

    This dataset contains six nodes (three with the Movie label and three with the Person label) and three edges (two with the ACTED_IN label and one with the DIRECTED label). The relationship graph is shown in the following figure:

    image

Step 5: Develop the application

  1. Develop the application: You can access the application directly over the public network. On the AI Applications list page, click Develop Application to go to the public URL of the visualization tool. Alternatively, enter the application's public IP address and port in your browser.

    Note

    Before you proceed, make sure you have added your public IP address to the application whitelist.

  2. On the login page of the visualization tool, enter the following information:

    • Host: Select the endpoint of your PolarDB cluster.

    • Database Name: Enter the name of a database within the cluster. If you do not have a suitable database, return to the cluster details page to create a database.

    • User name: Enter a database account within the cluster. Make sure that the account has the required access permissions on the database.

    • Password: Enter the password for the database account.

  3. Query data: In Cypher, use the MATCH and RETURN keywords to query data:

    • MATCH is used for pattern matching to find content that matches a specified pattern.

    • The RETURN keyword specifies the values or results to return from a Cypher query.

    Syntax:

    SELECT * FROM cypher('graph_name', $$
      MATCH <patterns>RETURN <variables>
    $$) AS (result1 agtype);

    Example: Enter the following Cypher query statement at the top of the visualization tool:

    SELECT * FROM cypher('moviedb', $$
      MATCH (m:Person)
      RETURN m
    $$) AS (result1 agtype);

    After you enter the query, click the Run button in the upper-right corner of the editor. If the query is successful, the results area below shows the following: Node Label displays *(6), Movie(3), Person(3); Edge Label displays *(3), ACTED_IN(2), DIRECTED(1); and Properties is empty. In the right-side panel, the Current Graph drop-down list is set to moviedb.

  4. Verification: After the operation is successful, you can see three Person nodes from moviedb in the visualization area below. After you execute the query, the results are displayed graphically in the Graph view. The returned Person nodes, such as Tom Hanks and Keanu Reeves, are displayed as circular nodes.

Step 6: (Optional) Release the graph application

To save costs, release the visualization tool when you no longer need it. In the AI Applications list, find the target graph application, and in the Actions column, click Release Application.

Important

Releasing a graph application only deletes the visualization tool for the web interface and does not delete any of your graph data stored in the PolarDB cluster. After the application is released, its configurations, such as the public network address, are lost and cannot be recovered.