From PostgreSQL wiki
Jump to: navigation, search


SchemaSpyis a java tool that with the aid of Graphviz can generate a rough documentation for existing database as a collection of interlinked HTML pages.

Huge tables support

As of 2012-05-18, the latest jar file with SchemaSpy 5.0.0 incorrectly handles large number of rows, i.e. if it exceeds 2^31-1 . Therefore it is necessary to compile it from the source code. It is straightforward using Eclipse. Compiled version can be exported into a jar.

Default property file for PostgreSQL does not make use of efficient row estimation. Here is the snippet let's call it that can be used in place of default property file.

# see
# for configuration / customization details


host=some host
db=some db


# Sample path to the postgresql drivers.
# Use -dp to override.

selectRowCountSql=select reltuples as row_count from pg_class where relname=:table

Note that in spite of selectRowCountSql, last binary will fail in case of huge tables.

The tool can be called like

java -jar schemaSpy.jar -t ./mypg -db mydb -u myuser -host myhost -o output_folder -p mypass -schemas "public,something,else" -noviews


Does not document table inheritance.