Skip to content

pg-index-health-sql is a set of sql-queries for analyzing and maintaining indexes and tables health in Postgresql databases.

License

Notifications You must be signed in to change notification settings

mfvanek/pg-index-health-sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pg-index-health-sql

pg-index-health-sql is a set of sql-queries for analyzing and maintaining indexes and tables health in Postgresql databases.

Lint Code Base License: Apache 2.0

Supported PostgreSQL versions

PostgreSQL 12 PostgreSQL 13 PostgreSQL 14 PostgreSQL 15 PostgreSQL 16 PostgreSQL 17

Support for previous versions of PostgreSQL

Compatibility with PostgreSQL versions 9.6, 10 and 11 is no longer guaranteed, but it is very likely.
We focus only on the currently maintained versions of PostgreSQL.
For more information please see PostgreSQL Versioning Policy.

Available checks

pg-index-health-sql allows you to detect the following problems:

  1. Invalid (broken) indexes (sql).
  2. Duplicated (completely identical) indexes (sql).
  3. Intersected (partially identical) indexes (sql).
  4. Unused indexes (sql).
  5. Foreign keys without associated indexes (sql).
  6. Indexes with null values (sql).
  7. Tables with missing indexes (sql).
  8. Tables without primary key (sql).
  9. Indexes bloat (sql).
  10. Tables bloat (sql).
  11. Tables without description (sql).
  12. Columns without description (sql).
  13. Columns with json type (sql).
  14. Columns of serial types that are not primary keys (sql).
  15. Functions without description (sql).
  16. Indexes with boolean (sql).
  17. Tables with not valid constraints (sql).
  18. B-tree indexes on array columns (sql).
  19. Sequence overflow (sql).
  20. Primary keys with serial types (sql).
  21. Duplicated (completely identical) foreign keys (sql).
  22. Intersected (partially identical) foreign keys (sql).
  23. Objects with possible name overflow (sql).
  24. Tables not linked to other tables (sql).
  25. Foreign keys with unmatched column type (sql).

Local development

Linting

macOS/Linux

To run super-linter locally:

docker run \
  -e RUN_LOCAL=true \
  -e USE_FIND_ALGORITHM=true \
  -e VALIDATE_SQLFLUFF=true \
  -v $(pwd):/tmp/lint \
  ghcr.io/super-linter/super-linter:slim-v7

Windows

Use cmd on Windows:

docker run ^
  -e RUN_LOCAL=true ^
  -e USE_FIND_ALGORITHM=true ^
  -e VALIDATE_SQLFLUFF=true ^
  -v "%cd%":/tmp/lint ^
  ghcr.io/super-linter/super-linter:slim-v7