PostGraph is a multi-model, graph centric query engine build on Postgres. PostGraph is designed to work fast with your OLTP, OLAP and AI Applications.
- Linux
- PostGIS 3.3
- Development Files for PostgreSQL and PostGIS
Download and Install the postgres_for_postgraph source
git clone https://github.com/PostGraphDB/postgres_for_postgraph
cd postgres_for_postgraph
./configure --prefix=($pwd)
make
sudo make install
Install PostGIS
Install PostGraph
git clone https://github.com/PostGraphDB/postgraph
cd postgraph
make POSTGIS_DIR=/path/to/postgis/source/files
sudo make install
Once PostGraph is installed, it needs to be enabled in each database you want to use it in. In the example below we use a database named postgraph
.
createdb postgraph
psql postgraph -c "CREATE EXTENSION PostGIS"
psql postgraph -c "CREATE EXTENSION LTree"
psql postgraph -c "CREATE EXTENSION PostGraph"
You can find the location of the postgresql.conf
file as given next:
$ which postgres
/usr/local/pgsql/bin/postgres
$ ls /usr/local/pgsql/data/postgresql.conf
/usr/local/pgsql/data/postgresql.conf
As can be seen, the PostgreSQL binaries are in the bin
subdirectory while the postgresql.conf
file is in the data
subdirectory.
Set the following in postgresql.conf
depending on the version of PostGraph and it's dependecy PostGIS:
shared_preload_libraries = 'postgraph'
POSTGIS Dependencies: autoconf automake libtool libxml2-devel geos-devel proj-devel protobuf-devel protobuf-c-compiler protobuf-compiler gdal-devel
Use psql
to start a command line session with your database
psql postgraph
Create a graph
CREATE GRAPH graph_name;
Set the Graph being used
USE GRAPH graph_name;
Create Data with the CREATE command
CREATE (v { name: 'Hello Graph!'}) RETURN v;
Find data with the MATCH command
MATCH (n) RETURN n;