{"repo":"andyatkinson/pg_scripts","free":true,"listed":false,"github":"https://github.com/andyatkinson/pg_scripts","clone":"git clone https://github.com/andyatkinson/pg_scripts.git","description":"PostgreSQL queries and scripts","language":"PLpgSQL","stars":166,"topics":["postgresql","sql"],"license":null,"category":"databases-storage","readme_excerpt":"PostgreSQL Scripts ( pg scripts ) Scripts and queries for PostgreSQL to help with analysis, maintenance, and other \"Application DBA\" concerns. These are copied from elsewhere on the Internet and the original source was credited. Or they were adapted by me. General Tips - Use \\watch on the end of a query to keep running it psql \\dn - list schemas Names and Descriptions table with column.sql - Find all tables with specified column name list 10 largest tables.sql - List 10 largest tables list long running queries.sql - List long running queries find indexed columns high null frac.sql - From Haki, identify partial index opportunities list comments.sql - List fields that have been commented, and their comment content index analysis and bloat estimate.sql - I use this to check index bloat estimate and index scans find unused indexes.sql - I use this to find unused indexes that can likely be removed relation size.sql - I use this to check that an index build completed fully and is not a zero bytes index relation size extended.sql - More complicated queries for partitioned tables create index create statement.sql - get the CREATE INDEX statement from an existing index. I use this when an index build fails but the same index exists in another environment (e.g. pre-prod) and I want to manually apply the same statement table stats.sql - pg stats docs get statistics on the rows in the table PG collects, such as the most common values, and the most common frequencies. I use this to see if","default_branch":null,"files":null,"tree":[],"storefront":"/r/andyatkinson","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/andyatkinson/pg_scripts/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}