Top
Enterprise Postgres 17 SP1 Knowledge DataManagement FeatureUser's Guide

4.3 Creating a Graph

Graphs are stored in Fujitsu Enterprise Postgres as a single virtual data object called a graph. Internally, they are saved as multiple database objects under a schema that has one-to-one correspondence with the graph. Graphs are created and deleted using the create_graph and drop_graph functions, which are SQL functions provided by the graph management feature. If the second argument of the drop_graph function is set to true, the database object under the schema that corresponds to the graph will also be deleted.

Example) Creating a graph

SELECT create_graph('new_graph');
NOTICE:  graph "new_graph" has been created
 create_graph
--------------

(1 row)

Example) Deleting a graph

SELECT drop_graph('new_graph', true);
NOTICE: drop cascades to 2 other objects
DETAIL: drop cascades to table new_graph._ag_label_vertex
drop cascades to table new_graph._ag_label_edge
NOTICE: graph "new_graph" has been dropped
 drop_graph
------------

(1 row)

Information

When you create a graph, a schema with the same name as the graph is created. Specify a name that does not overlap with existing schemas. In particular, you cannot use reserved names beginning with pg_. Also, do not use names beginning with pgx_.

The schema corresponding to a graph will be deleted when the graph is deleted. Do not create objects under this schema.

You can view a list of graphs and their corresponding schemas (namespaces) stored in a database with the graph management feature enabled by using the following method.

Example) Graph list

SELECT * FROM ag_catalog.ag_graph ;
 graphid |    name    | namespace
---------+------------+------------
   81957 | new_graph  | new_graph
   82576 | new_graph2 | new_graph2
   82598 | sample     | sample
(3 rows)