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...
241Base tables that have neither a unique constraint nor the primary keyFind base tables without any unique constraints and the primary key. In such tables there are no restrictions for recording duplicate rows. Each row represents a true proposition about the real world. It does not make the proposition truer if one presents it more than once. Moreover, duplicate rows increase data size. Without keys the DBMS lacks vital information about data in the database that it can internally use to choose better execution plans and in this way improve performance of database operations. The only legitimate reason of such a table is if it is an abstract table that is used to define common columns of subtables.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
242Perhaps incorrect use of 'NULL'Find Boolean expressions, queries, routines, and default values that refer to value 'NULL'. Perhaps NULL was intended instead. 'NULL' is a string (a value) but NULL is a special marker for denoting missing value.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 13:19MIT License
243Too generic names (candidate key columns)Find candidate key columns with the names like id, identifikaator, code, kood, number, etc. The names should have a prefix or a suffix. These are too generic names.Problem detectionsystem catalog base tables only2023-01-20 12:35MIT License
244Do not clone tablesFind cases where a base table has been split horizontally into multiple smaller base tables based on the distinct values in one of the columns of the original table. Each such newly created table has the name, a part of which is a data value from the original tables. Find base tables that have the same columns (column name, column order, data type) and the difference between the tables are the numbers in the table names (table1, table2, etc.).Problem detectionINFORMATION_SCHEMA only2021-03-18 14:43MIT License
245Unique index definition instead of a key declarationFind cases where a unique constraint (that is not case-insensitive or partial, i.e., applies only to certain rows) has been enforced by using a CREATE UNIQUE INDEX statement instead declaring a PRIMARY KEY, UNIQUE, or EXCLUDE constraint. You should try to work on as high level of abstraction as possible. According to the ANSI-SPARC Architecture indexes are a part of internal database schema whereas constraints are a part of conceptual schema, i.e., at the higher level of abstraction.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
246Mixing Concat and ||Find cases where different means are used to concatenate text within the same object.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-12-03 14:36MIT License
247Mixing Concat and CoalesceFind cases where different means are used to deal with NULLs in case of concatenating texsts.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-12-08 14:25MIT License
248Enumerated or range types with the same name in different schemasFind cases where in different schemas there are enumerated or range types with the same name. Types 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. Also make sure that this is not a duplication.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
249Multiple tables share the same state classifierFind cases where multiple tables share the same state classifier. For each main entity type one should create a separate state classifier table. Even if the classifier values are the same in case of two entity types for now these may become different in the future. Having a shared state classifier table usually means very simplistic state machines (states active and inactive) that could point to the gaps in analysis.Problem detectionsystem catalog base tables only2023-12-30 15:51MIT License
250Optional columns before mandatory columnsFind cases where optional columns are before a mandatory column. Place mandatory columns before optional columns to improve comprehensibility of the table.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
251Some CHECKS are associated with a domain and some with the base table columns that have the domainFind cases where some CHECKS are associated with a domain and some with the base table columns that have the domain. Avoid duplication of code. Write as little code as possible. If possible, move things "before the brackets" so to say. In this case it means declaring CHECKS at the level of the domain and not at the level of base table columns.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
252Function in a function-based index of a column is different from the function that is used in the subquery of a derived tableFind cases where the function of a function-based index of a column is different from the function that is used in the query in a derived table based on the column.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
253Do not specify a list of values in a table column definitionFind cases where the list of valid data values in the column is specified in the column definition (in addition to specifying the type of the column) by using, for instance, check constraints or enumerated types. The check constraint is either associated directly with a table or is associated with a domain.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-06-09 14:30MIT License
254Do not use dual-purpose foreign keysFind cases where the same column of a base table T is used to record references to multiple base tables. In addition, one has to add additional column to T for holding metadata about the parent table, referenced by the current row.Problem detectionINFORMATION_SCHEMA only2021-03-07 10:56MIT License
255Duplicate triggersFind cases where the same table has multiple triggers with the same type (row-level, statement-level) that react to the same event with the same WHEN condition and with the same way (by invoking the same function).Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
256Short cycle (columns)Find cases where two candidate keys of the same table that are also foreign keys reference to each other.Problem detectionsystem catalog base tables only2021-11-28 02:08MIT License
257Do not assume you must use filesFind cases where you store images and other media as files outside the database and store in the database only paths to the files.Problem detectionINFORMATION_SCHEMA only2021-03-27 16:55MIT License
258Do not assume you must use files (based on user data)Find cases where you store images and other media as files outside the database and store in the database only paths to the files.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-10 12:58MIT License
259Perhaps too many subconditions in a CHECK constraintFind check constraints of base table and foreign table columns that are either associated with more than one column and have at least one AND operation or are associated with exactly one column and have two or more AND operations.Problem detectionINFORMATION_SCHEMA only2024-01-01 12:23MIT License
260Table columns with NOT VALID CHECK constraintsFind CHECK constraints of base table and foreign table columns that are not valid. 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 detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License