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...
61Different character maximum lengths that are used to define textual base table columnsFind the number of different character maximum lengths that are used to define textual base table columns as well as list all the different lengths. Show also the total number of columns with char/varchar type. Maximum character length constrains values in a column. Thus, in case there is a small number of used lengths, it raises a question as to whether the lengths have been optimally selected.Sofware measureINFORMATION_SCHEMA only2021-03-26 11:24MIT License
62Different data types that are used to define base table columnsFind the number of different data types that are used to define base table columns as well as list all the different types. Data type constrains values in a column. Thus, in case there is a small number of used types, it raises a question as to whether the types have been optimally selected.Sofware measureINFORMATION_SCHEMA only2020-11-27 10:40MIT License
63Different non-surrogate key default valuesFind the different default values that implement something other than a surrogate key.GeneralINFORMATION_SCHEMA only2021-03-04 10:31MIT License
64Different ways how to find default timestamp valuesFind all the default values of base table, view, and foreign table columns that are expressions invoking a function that returns a timestamp. Do it only if there are different expressions, i.e., there could be possible inconsistencies.Problem detectionINFORMATION_SCHEMA only2023-12-08 16:08MIT License
65Domain CHECK constraint name contains table nameFind names of domain CHECK constraints that contain the name of the base that column the domain specifies. Domains are reusable artifacts that one should be able to use in case of defining different base tables. Thus, it is inappropriate to use the name of a particular table in the name of a domain constraint.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
66Domain CHECK constraints with the same nameFind domain check constraint names that are used more than once (within the same schema or in different schemas). Different things should have different names. However, here different constraints have the same name. Also make sure that this is not a sign of duplication of domains.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
67Domain name contains base table nameFind names of domains that contain the name of the table that column the domain specifies. Domains are reusable artifacts that one should be able to use in case of different base tables. Thus, it is inappropriate to use the name of a particular table in the name of the domain.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
68Domains 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
69Domains 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
70Domain usage in base tablesFind for each domain the number of usages in base tables. The less you have managed to reuse domains in case of different columns, the more you have wasted your time by creating the domains.GeneralINFORMATION_SCHEMA only2020-11-06 14:51MIT License
71Do not always depend on one's parent (INFORMATION_SCHEMA)Find where a hierarchical structure is implemented in a base table by having a foreign key that refers to a candidate key of the same table. This design is called adjacency list.GeneralINFORMATION_SCHEMA only2021-03-07 10:57MIT License
72Do 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
73Do not clone columns"Split a base table column into multiple columns based on the values in some other column. Each such newly created column has the name, a part of which is a data value from the original tables."(Bill Karwin) Find base tables that have more than one columns with the same type and field size and the difference between the columns are the year or month number at the end of the column name (two or four numbers, preceded by an underscore).Problem detectionINFORMATION_SCHEMA only2022-11-28 15:15MIT License
74Do 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
75Do not create multiple columns for the same attributeFind base tables that implement recording multivalued attribute values with the help of repeating group of columns. Find base tables that have more than one columns with the same type and field size and the difference between the columns are the numbers in the column names (column1, column2, etc.).Problem detectionINFORMATION_SCHEMA only2021-03-18 15:57MIT License
76Do 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
77Do not format comma-separated lists (based on default values)Find, based on default values, 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 only2023-12-30 10:59MIT License
78Do 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
79Do not use a generic attribute tableFind base tables that implement a highly generic database design (EAV design - Entiry-Attribute-Value design), according to which attribute values are recorded in a generic table that contains attribute-value pairs.Problem detectionINFORMATION_SCHEMA only2021-03-07 17:40MIT License
80Do 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