Code to Report Table Index Schema or Database Fragmentation in PostgreSQL

We are always asked by a client or our manager about how fragmented a table, an index, a schema or whole database is in PostgreSQL database. The following code will answer this question with the following information reported for a schema.

Toal 7415.00 MB, Free 1918.87 MB, Fragmentation 25.88 Percent

Please do NOT run the code during busy or peak hours, ideally run the code in after hours or off-peak hours.

Subscribe to get access

Read more of this content when you subscribe today.

Advertisement

2 thoughts on “Code to Report Table Index Schema or Database Fragmentation in PostgreSQL”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: