All Products
Search
Document Center

PolarDB:Visualization tool

Last Updated:Jan 17, 2026

PolarDB for PostgreSQL integrates the open source graph engine Apache AGE. This integration lets you use standard SQL and the industry-standard openCypher graph query language in the same cluster. You can efficiently store, query, and analyze graph data for complex relationship scenarios.

Step 1: Create a graph application

  1. You can create it in one of two ways:

    • Go to the PolarDB console. In the navigation pane on the left, click PolarDB AI, and then click Create AI Application.image

    • Go to the PolarDB console. In the navigation pane on the left, click Clusters. Find the destination cluster that meets the applicability requirements and navigate to the cluster details page. In the navigation pane on the left, choose AI Capabilities > AI Applications, and then click Create AI Application.image

  2. On the application purchase page, select the appropriate configurations as needed:

    Configuration item

    Description

    Billing Method

    • Subscription: An upfront billing method. When you create an application, you must select resources with defined specifications and pay for the application in advance. The longer the subscription duration, the larger the discount. This billing method is suitable for scenarios with stable long-term business requirements.

    • Pay-as-you-go: A pay-as-you-go billing method. When you create an application, you must select resources with defined specifications, but you do not need to pay for the application in advance. You are billed based on the actual usage duration. This billing method is suitable for scenarios with flexible business requirements.

    Engine

    Fixed as PolarDB.

    Region

    Select the geographic location where the application is located.

    Note
    • You cannot change the region 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 the PolarDB for PostgreSQL cluster.

    • We recommend that you create the application and the ECS instance that you want to connect to in the same region. Otherwise, they cannot communicate with each other over the internal network (private network) and can only communicate over the external network (public network), which prevents optimal performance.

    Architecture

    Select AI Application.

    Ecosystem

    The database ecosystem of the source PolarDB cluster is automatically filled in. You do not need to fill it in manually.

    Source PolarDB Cluster

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

    Version

    The database version of the source PolarDB cluster is automatically filled in. You do not need to fill it in manually.

    AI Application

    Select Graph Management.

    Component Set

    Customize the number and specifications of Backend Components as needed.

    AI Application Name

    You can enter a custom application name.

    Note

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

    Network Type

    Fixed as VPC.

    VPC

    The VPC of the source PolarDB cluster is automatically filled in. You do not need to fill it in manually.

    Zone and vSwitch

    Configure the vSwitch for the VPC. We recommend that you select a vSwitch in the same primary zone as the PolarDB for PostgreSQL cluster for optimal network performance.

    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.

    Duration

    Select the subscription duration for the application.

    Note

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

    Auto-renewal

    Configure whether to enable auto-renewal. To prevent business interruptions caused by forgetting to renew, we recommend that you enable auto-renewal.

    Note

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

  3. After the purchase is complete, return to the AI Applications page of the cluster to view the new application.

    Note

    The system takes 3 to 5 minutes to create the application. Please wait.

Step 2: Connect to the graph application

  • Configure the application whitelist: On the AI Applications list page, click your Application ID to navigate to the application details page. On the Whitelist tab, you can 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, you can view the IP address of the ECS instance on the ECS Instance Details page and add it 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 its VPC CIDR block.

      • 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 where the ECS instance is located.

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

    image

  • Obtain the endpoint: On the AI Applications list page, click your Application ID to navigate to the application details page. On the Basic Information tab, you can view the Private Endpoint in the Topology section.

    Note
    • You must request a public endpoint separately. Click the Request button to submit a request.

    • The public endpoint provides only an IP address and a port, not a domain name. If you need a domain name, you can bind one yourself.

    image

Step 3: Create the extension and configure the database

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

    Note

    The age extension does not currently support manual creation. To use this feature, submit a ticket to request its creation.

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

    Note

    When you use a Data Management Service (DMS) client to set the search_path, compatibility issues may occur. You can use PolarDB-Tools to run the relevant statements.

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

    Use a privileged account to set the database parameters to permanently load the extension. This simplifies the process because you do not need to repeat the preceding operations for each 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 has only read and write permissions, you must also grant the CREATE permission to create tables.

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

Step 4: Create a graph and insert data

  1. Create a graph: 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 includes six nodes, three with the label Movie and three with the label Person. It also includes three edges, two with the label ACTED_IN and one with the label DIRECTED. The relationship graph is shown below:

    image

Step 5: Develop the application

  1. Develop the application: You can access the application directly over the Internet. On the AI Applications list page, click Develop Application to open the public endpoint of the graph application's visualization tool. Alternatively, you can enter the public IP address and port of the application in your browser's address bar to access the visualization tool.

    Note

    First, add your public IP address to the application whitelist.

    image

  2. On the visualization tool's logon page, enter the following information:

    • host: Select the endpoint of your PolarDB cluster.

    • Database Name: Enter 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 it has the necessary access permissions for the database.

    • password: Enter the password for the database account.

    image

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

    • MATCH performs pattern matching to find content that matches the specified pattern.

    • The RETURN keyword specifies the values or results you want to return from the 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);

    image

  4. Verification: After the statement is successfully executed, the three Person nodes of the moviedb graph appear in the visualization area below.image

Step 6: (Optional) Release the graph application

When the visualization tool is no longer needed, you can release it to save costs. In the AI Applications list, find the destination graph application, and in the Actions column, click Release Application.

Important

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