44

I am looking for a GUI program that can generate database table diagrams from a PostgreSQL database. I am aware of SchemaSpy, SchemaCrawler and PostgreSQL Autodoc but they are CLI. Any OS, price and license is fine.


A similar question was asked on SO but was closed: tools to generate database tables diagram with postgresql?

2
  • Here is the list of recommended GUI tools in the postgres wiki. GUI database design tools May 17, 2017 at 11:17
  • 2
    @SudipBhandari: Among those what is the tool that you recommend to generate a tables diagram? Please post an answer for that particular tool and don't forget to include a screenshot of the generated diagram, thanks!
    – Nicolas Raoul
    May 18, 2017 at 3:43

9 Answers 9

35

DBeaver free, multi-platform universal SQL client. Supports all popular databases: MySQL, PostgreSQL, MariaDB, SQLite, Oracle, DB2, SQL Server, Sybase, MS Access, Teradata, Firebird, Derby, etc.

You can do all crud operations as well as Advances operations from here. Supports N number of database types (Relational/NoSQL)

enter image description here

4
  • 4
    Gets the job done in the community edition. Used for Postgres. Recomended
    – amar
    Apr 30, 2019 at 6:26
  • 1
    <1 min to set up and connect to PostgreSQL database. Here's the documentation on bringing up the ER diagram as in @Akshay-Gupta's answer. github.com/dbeaver/dbeaver/wiki/ER-Diagrams May 24, 2019 at 23:19
  • Thanks, worked well with Postgres in mac. Had to download and attach dependencies though. Aug 30, 2019 at 9:28
  • amazing works great!
    – pyramation
    Apr 25, 2021 at 22:38
8

Inspired by the answer by @arman-fatahi, here is a more detailed instruction how to create DB diagrams using draw.io:

  1. Dump the schema of your database - e.g. for PostgreSQL, the command might be:
pg_dump -s mydb > mydb_dump.sql
  1. Create a blank diagram on draw.io. Choose from the dropdown menu: Arrange > Insert > Advanced > SQL...

Insert SQL

  1. Paste the dumped database schema in the window that opens:

Sample SQL code

  1. The tables' diagrams will be automatically generated, you can rearrange them and add the arrows representing the relations between them:

enter image description here

2
  • i love this one
    – Carlost
    Nov 10, 2023 at 14:43
  • i think the only missing thing is maintaining the schema during time. I had a database with > 100 tables, and it would be a hell to arrange and adjust colors for every table (and usually you need a diagram for the actual DB, not for something you had 3 months ago) Dec 9, 2023 at 14:29
6

You may use "Microolap Database Designer for PostgreSQL" aka PgMDD

It's a commercial software with 30-day trial though. Personal\Educational license will cost $124.95, however you may get a free license also (details on the order page).

Here is a quick tutorial on how to Reverse Engineer (Import) PostgreSQL database: https://www.youtube.com/watch?v=pj3-3VkW3qM

  1. Select File | Reverse Engineer | PostgreSQL database or press Ctrl-R. PgMDD Reverse Engineer

  2. If connection for the current diagram has not been established, Database Connection Manager will be shown. Select a profile from the list of the available ones or create a new profile to connect to the database you want to revere engineer. PgMDD Connection Manager

  3. The PostgreSQL Database Reverse Engineering tool will be shown. You can set the reverse engineering options in the Options tab. PostgreSQL Database Reverse Engineering tool

  4. In the Selection tab of the PostgreSQL Database Reverse Engineering tool you can choose the objects you want to reverse engineer. Selection tab of the PostgreSQL Database Reverse Engineering tool

  5. Click OK to start the database reverse engineering process. reverse engineering process

  6. The reversed database objects will be placed in your diagram. Chinook database diagram

5

You can use SQL Power Architect:

  • Most features are free, including the ER schema generation
  • Microsoft Windows / Mac OS X / Linux
  • Supports most commonplace DBMS suggest MySQL and PostgreSQL

You just need to drag-and-drop to generate the visual schema:

enter image description here

enter image description here

3
  • Worked well for a quick and dirty reverse-engineered diagram. Threw a lot of exceptions in the process though. :) Mar 2, 2017 at 17:06
  • You can also export it as a pdf or generate an HTML document with description of each of the table along with the hyperlink to the linked tables.. neat May 18, 2017 at 9:00
  • SQL Power Architect needs Java to run (which I can't use)
    – Gawin
    Sep 21, 2017 at 9:49
4

Datagrip by Jetbrains. Apart from PostgreSQL it works with various RDBMS (MYSQL, SQL Server, MongoDB,...).

They have a 30 day trial and there are various pricing options.

Here's how to do it: https://www.jetbrains.com/help/datagrip/creating-diagrams.html

enter image description here

0
3

Here is the best way that I found:

  1. Export your database schema as SQL. Most databases have a tool for that.
  2. Go to Draw.io and open an empty file.
  3. Click the plus on the top ( help )
  4. Select from SQL and paste your sql script.
  5. Rearrange your tables.

This is easiest way to do it without installing any software.

1
  • 2
    This sounds good. Can you post a screenshot?
    – pir
    Jul 9, 2020 at 0:42
1

Try DbSchema, it's commercial software with free trial. It works with a couple of RDBMS and NoSQL databases. It generates interactive diagrams with clear layout and can export to SVG/png/jpg.

2
  • Please add a screenshot, thanks! The screenshot must show the step when you generate a diagram from an existing database.
    – Nicolas Raoul
    Feb 23, 2017 at 9:41
  • DbSchema needs Java to run (which I can't use)
    – Gawin
    Sep 21, 2017 at 9:48
0

You may use PgModeler. It is open source software and works fine on Linux. http://www.pgmodeler.com.br/

  1. run pgmodeler, click on import, select connection and database then click on import. (don't forget to edit connections to set your db-user and password)

run pgmodeler, click on import, select connection and database then click on import.

  1. Once done you may work on your model.

Once done you may work on your Model.

after working on your model you can export it to an .sql file or export the changes to your connected database

2
0

I am currently using Valentina Studio

Here is a diagram I created. I noticed if the foreign keys had the same name (in different tables) it would only show one of the links. When I named the foreign key constraints with different names it fixed the diagram.

jpg of Valintina diagram

1
  • good luck if you don't have permission to rename foreign key names...
    – Michael
    Oct 2, 2023 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.