DEV Community

Sadeed Ahmad
Sadeed Ahmad

Posted on

More on AGE with PostgreSQL

Initialization of Database

The database cluster is initialized


cd postgresql-11.18/
bin/initdb demo

Enter fullscreen mode Exit fullscreen mode

Kickstarting the server

Make a database named dbyo


bin/pg_ctl -D demo -l logfile start
bin/createdb dbyo

Enter fullscreen mode Exit fullscreen mode

The files and the database can now be seen in your terminal.

Start Querying

AGE has been added to pg. You can connect to the database and start exploring it.


bin/psql dbyo

Enter fullscreen mode Exit fullscreen mode

AGE extension is loaded in order to start using it.

CREATE EXTENSION age;
LOAD 'age';
SET search_path = ag_catalog, "$user", public;
Enter fullscreen mode Exit fullscreen mode

Queries with Cypher commands can be run like creating a graph, adding a node to it, and then displaying the node.

SELECT create_graph('demo_graph');
SELECT * FROM cypher('demo_graph', $$ CREATE (n:Person {name : "james", bornIn : "US"}) $$) AS (a agtype);
SELECT * FROM cypher('demo_graph', $$ MATCH (v) RETURN v $$) as (v agtype);
Enter fullscreen mode Exit fullscreen mode

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs