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...
41Depth of relational tree of a tableDepth of relational tree of a table T (DRT(T)) is defined by Piattini et al. (2001) as "the longest referential path between tables, from the table T to any other table in the schema". The result may help to classify the data. If the depth is 0, then probably the table contains classifers. Tables with the largest depth probably contain some extra information about main entities.Sofware measuresystem catalog base tables only2020-11-14 16:13MIT License
42CHECK constraints that use non-deterministic functionsDiscover incorrect usage of non-deterministic functions in CHECK constraints. Find base table columns and foreign table columns that have a CHECK constraint that refers to a non-deterministic function that returns current date/time/timestamp.GeneralINFORMATION_SCHEMA only2020-11-06 14:51MIT License
43Unnecessary domainsDomain is a reusable artifact. Effort of its creation should be paid off by the advantages that it offers. If a domain is used in case of at most one column of a base table or even if it is used in case of more than one column but it does not specify neither a default value nor a check constraint, then there is no point of creating the domain.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
44Domains with the same name in different schemasDomains are like words that can be used to construct generalized claims about the real world (table predicates). Better not to duplicate the words in the dictionary.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
45Domains that are associated with a sequence generatorDomains are reusable artifacts. By associating a domain with a sequence generator, one essentially starts to share sequence generators between tables. It may cause a potential performance bottleneck by having a shared resource. By having a shared sequence it is not possible to change properties of sequences of different tables independently, i.e., it increases coupling between tables.Problem detectionINFORMATION_SCHEMA only2021-03-07 21:08MIT License
46Derived table on top of another derived tableDo not build multiple levels of derived tables (views and materialized views) because it will hamper evolvability and understandability of the tables.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
47The same sequence generator is used in case of multiple columnsDo not cause a potential performance bottleneck by having a shared resource. By having a shared sequence it is not possible to change properties of sequences of different tables independently (for instance the owner column or step), i.e., it increases coupling between tables. By having a shared sequence it is impossible to specify the owner (table column) to the sequence generator.Problem detectionINFORMATION_SCHEMA only2021-03-07 21:07MIT License
48Recursive rules that directly modify their home tableDo not cause potentially infinite loops. Recursive rules would fire itself over and over again. Although the system is able to detect these after executing a data modification statement it is better to avoid creating these altogether.Problem detectionsystem catalog base tables only2022-10-21 15:59MIT License
49Recursive triggers that directly modify their home tableDo not cause potentially infinite loops. Recursive trigger fire themselves over and over again. If the system is not able to stop these, then it eventually consumes all the resources of the system. Although the system is able to detect these it is better to avoid creating these altogether.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
50Incorrect use of non-deterministic functions in CHECK constraintsDo not create a constraint in case of which data that satisfied a constraint c at the registration time suddenly does not satisfy it any more as the time goes by. Find all the check constraints that use non-deterministic functions (now, current_timestamp, localtimestamp, current_date, current_time) in a way that makes this situation possible. Fort instance, localtimestamp(0)>end_date is an example of such constraint.Problem detectionINFORMATION_SCHEMA only2023-11-29 14:59MIT License
51Potential duplication of sequence generatorsDo not create unnecessary sequence generators.Problem detectionINFORMATION_SCHEMA only2022-11-21 11:01MIT License
52Base tables that have only the surrogate key and do not have any other columnDo not create unnecessary tables. If a table has cardinality 1 (one column), then most probably the values in this column should not be system generated unique values.Problem detectionINFORMATION_SCHEMA only2021-03-08 00:41MIT License
53Double checking of the maximum character lengthDo not duplicate code. In this case a CHECK constraint duplicates the restriction that is already enforced with the help of the declaration of the maximum field size (for instance, VARCHAR(100)).Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-18 13:27MIT License
54Tables without columnsDo not have in a database elements that are not useful. PostgreSQL permits tables with no columns. Such tables can be used to implement Boolean variables (tables TABLE_DEE and TABLE_DUM). On the other hand, such tables might be a result of database evolution, where developers have not noticed that they have dropped all the columns of a table or have not noticed that they have created such a table in the first place.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
55Unused schemasDo not keep in your database elements that are not needed by anybody. These should be put in use or dropped, otherwise these are dead code.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
56Unused trigger functionsDo not keep in your database elements that are not needed by anybody. These should be put in use or dropped, otherwise these are dead code.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
57Using AFTER triggers to enforce constraintsDo not let the system to do extra work. Checking a constraint with an AFTER trigger means that the trigger procedure will be executed after the data modification and if the check fails, then the system has to do extra work to roll back the changes.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
58UPDATE triggers that maybe execute too oftenDo not let the system to do extra work. Ensure that trigger procedures are executed only if there is a real need of that. Find UPDATE triggers that could be executed too often because unneeded executions are not prevented.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
59Using BEFORE triggers to log data changesDo not let the system to do extra work. Logging changes with a BEFORE trigger means extra work for rolling back the changes in case the logged data modification fails.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
60ROW level BEFORE DELETE and INSTEAD OF DELETE triggers that procedures refer to the row variable NEWDo not write incorrect code. Variable NEW: "Data type RECORD; variable holding the new database row for INSERT/UPDATE operations in row-level triggers. This variable is null in statement-level triggers and for DELETE operations." (PostgreSQL documentation)Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-12-20 14:25MIT License