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...
601Mixing the use of TEXT and VARCHAR type in case of base table columnsDeclaring a column to have the type TEXT or the type VARCHAR (without the maximum number of characters) has the same end result in terms of what data can be recorded in the column. Nevertheless, one should try to stick with using one of the type names in order to cause less confusion. "If you do something a certain way, do all similar things in the same way." (Robert C. Martin, Clean Code)Problem detectionINFORMATION_SCHEMA only2021-03-12 15:06MIT License
602Do not format comma-separated lists (based on user data)Find, based on the data that users have recoreded in a database, cases where a multi-valued attribute in a conceptual data model is implemented as a textual column of a base table. Expected values in the column are strings that contain attribute values, separated by commas or other separation characters.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-12 15:02MIT License
603Do not register durationFind columns of base and foreign tables that based on the column name and type are used to register duration (including the age).Problem detectionINFORMATION_SCHEMA only2021-03-12 14:48MIT License
604Different foreign key column names in case of referencing the same candidate keyFind the cases when the names of columns in different foreign keys that reference to the same candidate key are different. If different names reflect different roles, then it is legitimate. However, there could also be accidental differences that makes it more difficult to use the database.Problem detectionsystem catalog base tables only2021-03-12 11:21MIT License
605Referential degree of tablesThis metric represents the number of foreign keys in a base table.Sofware measureINFORMATION_SCHEMA only2021-03-12 11:07MIT License
606Referential degree of tables (ver 2)Find how many base tables are referenced from a base table by using foreign keys.Sofware measuresystem catalog base tables only2021-03-12 11:06MIT License
607The number of referencing base tablesFind how many base tables reference to a base table by using foreign keys. The more references there are the more impact the change of the table could have to the overall system.Sofware measuresystem catalog base tables only2021-03-12 11:02MIT License
608Potentially a classifier is missing (based on field sizes)Find columns that are not covered by a primary key, unique, and foreign key constraint but have a textual type with the maximum field size 3 or less.GeneralINFORMATION_SCHEMA+system catalog base tables2021-03-10 13:07MIT License
609Do 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
610Do not format comma-separated lists (based on column names)Find, based on column names, cases where a multi-valued attribute in a conceptual data model is implemented as a textual column of a base table or a foreign table. Expected values in the column are strings that contain attribute values, separated by commas or other separation characters.Problem detectionINFORMATION_SCHEMA only2021-03-10 12:57MIT License
611Do not leave out the referential constraints (islands)Try to find missing foreign key constraints. Find base tables that do not participate in any referential constraint (as the referenced table or as the referencing table). These tables are like "islands" in the database schema.Problem detectionsystem catalog base tables only2021-03-10 12:20MIT License
612Inconsistency of using column data types/field sizes in case of columns that implement relationshipsFind foreign key constraints where the candidate key columns (belong to a PRIMARY KEY/UNIQUE constraint) and foreign key columns do not have the same data type and field size. Primary key/unique columns and foreign key columns should have the same data type and field size. If, for instance, the primary key column has type INTEGER and foreign key column has type SMALLINT, then one cannot use all the primary key values as foreign key values.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-10 12:13MIT License
613Some candidate key values cannot be used as foreign key valuesFind foreign key constraints in case of which some candidate key values cannot be used as foreign key values. Primary key/unique columns and foreign key columns should have the same data type and field size. If, for instance, the primary key column has type INTEGER and foreign key column has type SMALLINT, then one cannot use all the primary key values as foreign key values.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-10 12:13MIT License
614Foreign key references a non-key (has optional columns)Find foreign key constraints that referenced column is optional.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-10 12:12MIT License
615Simple natural primary keysFind primary keys that consist of one column and that values are not generated by the system.GeneralINFORMATION_SCHEMA+system catalog base tables2021-03-08 00:47MIT License
616Potentially missing sequence generators (based on column names and types)Find surrogate key columns that do not have an associated sequence generator. Surrogate key values must be generated by using the system (the sequence generator mechanism in case of PostgreSQL). If there are no sequence generators, then there is a question as to whether there are no surrogate keys in the database at all (could be possible and OK) or (more probable) developers have forgotten to implement the generation of surrogate keys.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-08 00:44MIT License
617Foreign key columns that are associated with a sequence generatorFind foreign key columns that are associated with a sequence generator. Foreign key values are selected amongst the values that are registered as corresponding primary key/unique key values. Values in the foreign key columns are not directly generated by the system. These values might be system generated indirectly - generated when a row is added to the primary (parent) table.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-08 00:42MIT License
618Mixing different mechanisms to generate surrogate valuesUse the same mechanism of generating surrogate key values throughout the database. The use of SERIAL notation/explicitly creating a sequence generator and declaration of a column as an identity column will cause the creation of an external and internal sequence generator, respectively. Nevertheless, one should try to stick with using one of the mechanisms in order to cause less confusion. "If you do something a certain way, do all similar things in the same way." (Robert C. Martin, Clean Code)Problem detectionINFORMATION_SCHEMA only2021-03-08 00:42MIT License
619Base 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
620Multiple columns in the same base table that are associated with a sequence generatorFind base tables where multiple columns are associated with a sequence generator. Do not create unnecessary sequence generators. If one uses in a table a surrogate key, then it is enough to have one column where the values are generated by using a (external or internal) sequence generator.Problem detectionINFORMATION_SCHEMA only2021-03-08 00:41MIT License