Skip to content

MichaelDBA/pg_match

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pg_match

Schema Summary Comparison Tool

(c) 2022-2023 SQLEXEC LLC
GNU V3 and MIT licenses are conveyed accordingly.
Bugs can be reported @ michaeldba@sqlexec.com

Example Usage:

pg_match.py -t simplescan --Shost localhost --Sport 5414 --Suser postgres --Sdb clone_testing --Sschema sample --Thost localhost --Tport 5414 --Tuser postgres --Tdb clone_testing --Tschema clone1

Screen Shot

image

Overview

Regarding the scantype parameter (-t or --scantype), SimpleScan uses row estimates (pg_class/pg_stat_user_tables) whereas DetailedScan uses actual row count SQL. So for SimpleScan you should analyze all your schema tables beforehand or you will get a lot of differences.

Parameters

-t --scantype SimpleScan or DetailedScan
-H --Shost Source host
-P --Sport Source port
-U --Suser Source DB user
-D --Sdb Source databae
-S --Sschema Source schema
-h --Thost Target host
-p --Tport Target port
-u --Tuser Target DB user
-d --Tdb Target databae
-s --Tschema Target schema
-r --ignore_rowcounts Bypass row count check
-i --ignore_indexes Bypass index check
-f --ignore_funcs Bypass function/procedure check
-l --log log diffs to specified output file
-v --verbose verbose output (useful for debugging)
-x --print_help print help message for program

Requirements

  1. python 2.7 or above
  2. python packages: psycopg2
  3. Works on Linux and Windows.
  4. PostgreSQL versions 10+

Assumptions

Currently works for the following objects:

  • tables
  • views
  • columns
  • indexes and constraints
  • functions and procedures
  • row counts (implicit and direct)

About

Schema Comparison Tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages