Catalog of PostgreSQL queries for finding information about a PostgreSQL database and its design problems

AND
AND
AND
ANDFrom where does the query gets its information?
AND
AND

There are 961 queries.

Seq nrNameGoalTypeData sourceLast updateLicense...
881Not inherited CHECK constraints that cover at least one columnFind CHECK constraints that cover at least one column and that have been defined in a supertable (parent table) but not in its subtables. An entity that belongs to a subtype should also belong to its supertype. If a subtype entity satisfies some constraint, then logically it must also satisfy the constraints of the supertype as well. If CHECK constraints are not inherited, then this is not guaranteed. If you implement subtyping not merely reuse implementation in the subtables, then the subtables must have at least the same CHECK constraints as the supertable.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
882NOT VALID foreign key constraintsFind not valid foreign key constraints. These constraints have been created so that the existing data has not been checked against the constraint. It could be deliberate in case of legacy systems that have data quality problems. However, ideally all the data in the table conforms to the constraint.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
883Number of rows in base tablesFind the number of rows in base tables.Generalsystem catalog base tables only2022-10-27 19:44MIT License
884Number of system-generated and user-defined constraint names by constraint type (constraints that involve more than one column)Find the number of system-generated constraint names by constraint type. Names should follow the same style. If there is a mix of system-generated and user-defined names, then the style is most probably different.Sofware measuresystem catalog base tables only2023-01-10 14:53MIT License
885Number of system-generated and user-defined constraint names by constraint type (constraints that involve one column)Find the number of system-generated constraint names by constraint type. Names should follow the same style. If there is a mix of system-generated and user-defined names, then the style is most probably different.Sofware measuresystem catalog base tables only2023-01-10 14:52MIT License
886ON DELETE CASCADE is probably missing (based on the multiplicity of the relationship)Find foreign key constraints that completely overlap with a candidate key constraint (primary key or unique constraint) but the foreign key constraint does not have the ON DELETE CASCADE compensating action. In this case there is a foreign key that implements a relationship type between a strong entity type and a weak entity type (1-1 relationship type). Therefore, in this case ON DELETE CASCADE is an appropriate compensating action.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
887ON DELETE CASCADE is probably not needed (based on the relationship type)Find foreign key constraints that implement a non-identifying relationship type and have ON DELETE CASCADE compensating action. If the identity of the parent table is not a part of the identity of the child table, then there is a non-identifying relationship type and most probably the foreign key should not have ON DELETE CASCADE.Problem detectionsystem catalog base tables only2023-10-28 18:38MIT License
888ON DELETE SET NULL is probably missingFind implementations of the adjacency list design pattern, where the corresponding foreign key columns are optional but the foreign key constraint does not have ON DELETE SET NULL compensating action. Implement adjacency list correctly.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
889One-to-one relationshipsFind one-to-one relationships between base tables. In this case the foreign key columns must have primary key or unique constraint. These tables could implement inheritance hierarchy that has been specified in the conceptual data model.Generalsystem catalog base tables only2023-01-06 13:39MIT License
890One true lookup tableFind tables that contain all (or most) of the classifier values and tables that refer to these.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
891ON UPDATE CASCADE is perhaps missing (based on the compensating actions of other foreign key constraints)Find inconsistencies of using ON UPDATE CASCADE in case of foreign key constraints. An example of inconsistency is that there are two foreign key constraints in different tables that refer to the same table and its candidate key. One of the constraints has ON UPDATE CASCADE compensating action one does not. ON UPDATE CASCADE usage should be consistent, otherwise it does not allow us to change key values in the primary table. More generally, there is a set of foreign key constraints F that refer to a candidate key of table T. It cannot be the case that a proper non-empty subset of these foreign keys have ON UPDATE CASCADE compensatory action. Either all the constraints in F should have it or none of it should have it (depending on circumstances).Problem detectionsystem catalog base tables only2022-04-30 18:39MIT License
892ON UPDATE CASCADE is probably missing (based on column names)Find foreign key constraints that do not feature ON UPDATE CASCADE compensating action although people have a reason to change the key value in the primary table by assuming that the names of foreign key columns correctly point towards the use of natural keys in the table.Problem detectionsystem catalog base tables only2023-11-16 11:59MIT License
893Optional composite foreign keys that do not have MATCH FULL specifiedFind optional composite foreign keys that do not have MATCH FULL specified. Without MATCH FULL the system will permit partial foreign key valuesProblem detectionsystem catalog base tables only2021-02-25 17:29MIT License
894Overlapping non-function based indexes that have the same leading column but with different operator classFind non-function based indexes (both unique and non-unique) that have identical first column but the operator class that is used in case of the first column is different. Include unique indexes that support a constraint (primary key, unique, exclude), i.e., these indexes have been automatically created due to the constraint declaration.Generalsystem catalog base tables only2023-10-28 15:05MIT License
895Overlapping non-function based indexes that have the same leading column with the same operator classFind non-function based indexes (both unique and non-unique) that duplicate each other because their first column is identical and the operator class that is used in case of the first column is identical. Include unique indexes that support a constraint (primary key, unique, exclude), i.e., these indexes have been automatically created due to the constraint declaration.Problem detectionsystem catalog base tables only2023-11-26 15:59MIT License
896Patterns of the names of columns of simple primary keysFind the patterns of the names of columns of simple primary keys. Make sure that the naming is consistent. Ideally, the names should indicate as to whether the column is a surrogate or a natural key column. PostgreSQL 14 added primary keys, unique constraints, and foreign keys to system catalogs. Thus the query was modified to exclude the results from the system catalog.Generalsystem catalog base tables only2023-01-20 13:40MIT License
897Percentage of the total index storage size from the total database storage size (system catalog included)Get overview of disk usage.Sofware measuresystem catalog base tables only2020-11-06 14:51MIT License
898Perhaps an inconsistent use of NO ACTION and RESTRICT in the foreign key declarationsFind as to whether in case of foreign key constraints both the compensating actions RESTRICT and NO ACTION are used within the same database. If the same thing has to do in different places, then try to do it in the same way.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
899Perhaps a relationship should be irreflexiveEnforce all the constraints. A binary relation is called irreflexive, if it does not relate any element to itself.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
900Perhaps a too generic foreign key column nameFind the names of foreign key columns that are too generic. The expressive names of table columns allow database users better and more quickly understand the meaning of data in the database. A person could participate in a process or be associated with an object due to different reasons. Thus, foreign key column names like isik_id, person_id, tootaja_id, worker_id etc. are too generic. The name should refer (also) to the reason why the person is connected.Problem detectionsystem catalog base tables only2023-03-15 18:27MIT License