Overview of pgModeler for PostgreSQL

Tram Ho


When a project is being designed, the first thing to think about is what its purpose will be … what is the best solution and what is the alternative solution. In software development, everything is done to serve data, so the process of building and designing databases is very important.


PgModeler is an acronym for PostgreQuery Database Modeler and is an open source database modeling tool designed specifically for PostgresSQL. This fully featured tool allows users to quickly create database models (ERDs) that export them into multiple modes, from PNG images, SQL files to be able to run directly on the postgresSql server. . In addition, this software has the ability to compare models and databases from which to create SQL scripts that can be used to synchronize existing databases. Homepage: https://pgmodeler.io/ Github: https://github.com/pgmodeler/pgmodeler

main function

  • Automatically create columns and constraints
  • Export models with 5 different ways: SQL script file, PNG, SVG, HTML Format or directly to Sql Server
  • Automatically create models from existing databases
  • Support XML-based directories
  • Create SQL scripts to synchronize both the model and the database
  • Existing PostgresSql Management ……


The installation process is very simple, just download it from the website and proceed to run like normal software

Design Entity Relationship Diagram model in PgModeler

Once PgModeler has been successfully installed, proceed to set up the ERD in PgModeler to establish the relationship between the tables. The examples here are customer, film, rental tables.

Constraints representing keys that can be seen, such as pk, fk and even NOT NULL, are represented in green on the right of each table. The relationships between the tables are fully and clearly described making the model very clear to look at

Establish a connection to PostgresSql

As mentioned before, one of the features of PgModeler is linking to the PostgresSq database system. To link to the SQL database system, just configure the connection with the information as shown below.

Export data

PgModeler supports many types of data export from PgModeler to PostgresSql or to other formats.

Export to PostgresSql

Open the Export Model screen, select the Database Server version in the Connection section, specify the PostgresSql table version you want to export, select the options to delete the DB or Object, and then click Export as shown below.

Export to SQL File

Open the Export Model screen, select the path to save the SQL file, specify the version of the PostgresSql table you want to export, and then click Export as shown below.

Export to Graphics file

PgModeler supports exporting two popular Graphic File formats, PNG and SVG.

Open the Export Model screen, select the path to save the file to export, specify the type of file to export: PNG or SVG. Specify additional options such as size, grid …. and then click export

Export to HTML

Open the Export Model screen, select the path to save the HTML file, specify the file type to export: Standalone or Splitted. Also can add options attached to the index. Then click export


The process of building and designing databases is very important in every project. Hopefully, this article can help you understand how to build and design databases using PgModeler. See you in the next article

Share the news now

Source : Viblo