Generate the ERD for an existing database

233,981

Solution 1

We used DBVisualizer for that.

Description: The references graph is a great feature as it automatically renders all primary/foreign key mappings (also called referential integrity constraints) in a graph style. The table nodes and relations are layed out automatically, with a number of layout modes available. The resulting graph is unique as it displays all information in an optimal and readable layout. from its site

Solution 2

You can use dbeaver to do this. It allows you to export the ER diagram as png/svg etc.

DBeaver - https://dbeaver.io/

Double click on a schema (eg, Schemas->public->Tables) and open the "ER Diagram" tab (next to "Properties" tab)

Solution 3

pgAdmin 4 version 30 and newer can generate the ERD from an existing database. Just right-click on the database and select Generate ERD.

enter image description here

Solution 4

pgModeler can generate nice ER diagram from PostgreSQL databases.

It seems there is no manual, but it is easy enough without manual. It's QT application. AFAIK, Fedora and Ubuntu has package. (pgmodeler)

In the latest version of pgModeler (0.9.1) the trial version allows you to create ERD (the design button is not disabled). To do so:

  1. Click Design button to first create an empty 'design model'
  2. Then click on Import and connect to the server and database you want (unless you already set that up in Manage, in which case all your databases will be available to select in step 3)
  3. Import all objects (it will warn that you are importing to the current model, which is fine since it is empty).
  4. Now switch back to the Design tab to see your ERD.

Solution 5

I wrote this utility, it automatically generates the DSL code from a postgres database which you can then paste into dbdiagram.io/d website to get ER diagrams

https://github.com/nsingla/dbdiagrams

Share:
233,981

Related videos on Youtube

Badr
Author by

Badr

I am a java enthusiast with 6 years of J2EE development experience, it includes development of custom frameworks and working with famous frameworks like Spring, Hibernate, Jersey etc. I also love to work as a full stack developer with Java as server side technology and HTML5, CSS3 and Javascript for front end development. For front end I like work with angular.js and backbone.js and for styling My choice is less css. I am reachable at [email protected]

Updated on December 23, 2021

Comments

  • Badr
    Badr over 2 years

    I have a PostgreSQL database. I want to generate ERD from that database. Are there any built-in tools to do it or maybe some third-party tools?

  • Frank Heikens
    Frank Heikens over 11 years
    Doesn't work for PostgreSQL or other databases, it's MySQL-only
  • Victoria Stuart
    Victoria Stuart about 6 years
    Second this! While l I generally prefer the psql terminal, at times I also use DBeaver CE (Community Edition; dbeaver.jkiss.org/download ; an excellent, free and open source platform) for viewing data and visualizing the ERDs.
  • Adam Lehenbauer
    Adam Lehenbauer about 6 years
    I don't see any options like this, pgAdmin 4, version 2.1. There is no "select statement" or "statement" in the context menu for a table
  • honor
    honor almost 6 years
    Just installed DBeaver and was able to get the E-R diagram of my database. A tool that works. If you have more than 100 tables, then the generated E-R diagram will need some manual arrangement though...
  • qräbnö
    qräbnö almost 6 years
    404 Ooops! That page doesn't exists.
  • Jose1755
    Jose1755 almost 6 years
    The free Community version does have this feature available
  • denis.peplin
    denis.peplin over 5 years
    Not that easy. "Design" button is disabled, and there are no hints how to enable it.
  • Andrey Kotov
    Andrey Kotov over 5 years
    Thanks, works for me. After you are connected - double-click on 'TABLE' and go to 'References' tab. Here is the link for details.
  • dpmott
    dpmott almost 5 years
    Here's the DBeaver ER Diagrams wiki page, which includes helpful tips for layout and exporting to image file format:
  • Jose V
    Jose V over 4 years
    And it is opensource, meanwhile the accepted answer is for a product (DBVisualizer) that gives a limited trial and after you need to purchase a license
  • jhnatr
    jhnatr over 4 years
    To find the graph in postgres, I had to click into the schema, then click TABLE, and, in the window on the right, click the 'References' tab. This feature is available in the free version, too.
  • Lucio Mollinedo
    Lucio Mollinedo over 4 years
    This tool just works. Unlike the accepted answer. Thank you for this.
  • tandrewnichols
    tandrewnichols about 4 years
    Started with DBVisualizer because it was higher on the page, but this is CLEARLY the right answer here. DBVisualizer's free version is immensely limited AND it looks like it was designed by a DBA in 1992. Meanwhile DBeaver, while not a design marvel, is quite nice looking, and the ERDs it generates are SIGNIFICANTLY easier to read/follow/look at.
  • Mauricio
    Mauricio almost 4 years
    Just point out that DBeaver Community Edition allows : double click on table to open ER diagram limited to related tables ; save manual arrangements you do to each autogenerated ER diagram ; create custom diagrams (.erd files) with a subset of tables ; add table to existing diagrams and auto add relationships ; export diagrams as .png
  • Diego Frehner
    Diego Frehner almost 4 years
    Maybe this is a temporary problem, but the tool was unusable for me in v 11.0.4 on Win 10. The GUI had drawing problems which makes it unable to use.
  • Learner
    Learner over 3 years
    Consider the perfect answer below too
  • ceving
    ceving over 3 years
    It is a pain to configure a proxy server in DBeaver.
  • ceving
    ceving over 3 years
    pgModeler seems to be the only one, which supports table inheritance.
  • ceving
    ceving over 3 years
    This tool does not support Postgres' table inheritance. Parent and child tables are shown in the diagram without any visual relation.
  • ceving
    ceving over 3 years
    No open source. Just 15 days trial.
  • Nícolas Iensen
    Nícolas Iensen about 3 years
    I just tried the ERD feature of DBeaver, and it is awesome!
  • Alan47
    Alan47 about 3 years
    I just tried it (on a small DB with 5 tables) and it seems to work fairly well!
  • GeoGyro
    GeoGyro about 3 years
    Good start but that doesn't generate everything. It would be usefull to also design views for example.
  • Shahid
    Shahid about 2 years
    Can we generate ERD for some tables ?