Mysql – Visualization of MySQL/PostgreSQL table structure as a graph/UML


Is there any program, source code or API that will take a MySQL or PostgreSQL schema and
spit out a UML or some other graph visualizing of it?

Best Answer

A useful little protip - Visio is quite widely available within corporate I.T. suites and Visio Pro or higher can be used to reverse engineer and document a database.

Visio professional has a database reverse engineering tool that will read a database schema and create E-R models from it. Both PostgreSQL and MySQL support ODBC INFORMATION_SCHEMA tables so the ODBC driver for the Visio DB modeller will work with them. Start by creating a database diagram, and then look for 'Reverse Engineer' under the 'Database' menu.

As a bonus, if the physical DB has missing foreign key constraints you can add them back into the model for documentation purposes. For a more complex schema you can also create several diagrams showing different subsystems. I find myself using this to document systems at client sites on a semi-regular basis and it's often the only tool available.