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...
641Perhaps a redundant column (based on sequence generators)Find base tables where more than one column gets the default value by using the sequence generator mechanism.Problem detectionINFORMATION_SCHEMA only2021-03-05 09:42MIT License
642Perhaps the type of a base table column/domain should be INTEGER/SMALLINT/BIGINT (based on sequence generators)Specify for each column/domain a right data type that takes into account expected values in the column/domain. Find base table columns and domains that refer to the nextval function by using the default value mechanism but do not have the type INTEGER, SMALLINT, or BIGINT. This check is performed in case of identity columns: ERROR: identity column type must be smallint, integer, or bigint.Problem detectionINFORMATION_SCHEMA only2021-03-04 11:24MIT License
643Different 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
644The proportion of using different integer types as types of base table columnsFind the number of base table columns that use different integer types (SMALLINT, INTEGER, BIGINT) and their proportion from the overall set of columns that use an integer type.Sofware measureINFORMATION_SCHEMA only2021-03-03 12:41MIT License
645Base tables where certainly registration time is not recordedFind base tables that do not have any column with a timestamp type. In such tables certainly registration time is not recorded. Make sure as to whether recording registration time is necessary.GeneralINFORMATION_SCHEMA only2021-02-26 00:41MIT License
646All the non-primary key columns are optionalFind base tables where all he non-primary key columns are optional. Avoid too many optional columns. You have to be extra careful with NULLs in case of formulating search conditions of data manipulation statements.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
647A table has the same name as a routineFind table names that are the same as some routine name. Use different names to avoid confusion.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
648Base tables that have a unique constraint but not the primary keyA common style is to declare in each base table one of the candidate keys as the primary key. All the other candidate keys would be alternate keys that will be enforce with the help of UNIQUE + NOT NULL constraints.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
649Base 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
650Base tables where all the columns are optionalFind base tables where all the columns are optional, i.e., permit NULLs. In such tables can be rows with no identity value and thus indistinguishable from other rows.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
651Base tables, which statistics is probably not up to dateFind base tables where statistics has not been collected at all or it has been lastly collected more than 40 days ago.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
652Cannot accommodate all the fractional seconds in case of table columnsThe precision of a timestamp type of a column must be able to accommodate all the fractional seconds of the default value of the column. Find table columns with the type timestamp without time zone(m) or timestamp with time zone(m) that have a default value LOCALTIMESTAMP(n) or CURRENT_TIMESTAMP(n) WHERE n>m.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
653CHAR columns have a default value that length is shorter from the character maximum length of the columnChoose a suitable data type, field size, and default value. If the default value is shorter from the character maximum length, then spaces will be added to the end of the registered value.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
654CHECK constraints with IS NULLFind CHECK constraints to one column (associated with a base table directly or through domain) that check that the value is missing (IS NULL). Write as simple constraint definitions as possible. By default columns are optional, i.e., they permit NULLs. NULL in a column means that checking of a CHECK constraint on the column results with UNKNOWN. CHECK constraints permit rows in case of which checking results with TRUE or UNKNOWN. In case of a CHECK constraint there is no need to check separately that a value in the column could be missing, i.e., be NULL. Thus, for instance, instead of writing CHECK (price>0 OR price IS NULL) write CHECK (price>0).Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
655Completely overlapping foreign keysFind completely overlapping foreign keys, i.e., the same set of columns of a table is covered by more than one foreign key constraint. These constraints could refer to the same table/key or different tables/keys.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
656Constraints that are not redefined in a subtable and there is no CHECK constraint that compensates thisFind primary key, unique, foreign key, and exclude constraints that have been defined in a supertable (parent table) but not in its subtable. Additional condition is that in case of the subtable there is no CHECK that permits only one specific value in the constraint column. The presence of such check would make the design acceptable. Unfortunately, PostgreSQL table inheritance is implemented in a manner that some constraints (CHECK, NOT NULL) are inherited from the supertable but others are not. "All check constraints and not-null constraints on a parent table are automatically inherited by its children, unless explicitly specified otherwise with NO INHERIT clauses. Other types of constraints (unique, primary key, and foreign key constraints) are not inherited." (PostgreSQL documentation)Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
657Cycle in a hierarchyThere should not be cycles in hierarchies meaning that the parent must always be specified. In this case a parent must reference to a child or to itself, otherwise it cannot be registered.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
658Database object that belong to the public interface (virtual data layer) and that names contain the letters õäöüÕÄÖÜFind database object that belong to the database public interface (virtual data layer - consists of routines and derived tables) and that names contain the letters õäöüÕÄÖÜ (Estonian letters with a diacritic). These letters belong to the Estonian alphabet but do not belong to the ASCII character set. Although permitted by the DBMS, such letters might make it more difficult to use the interface by other programs.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
659Database object that do not belong to the public interface (virtual data layer) and that names contain the letters õäöüÕÄÖÜFind database object that do not belong to the database public interface (virtual data layer - consists of routines and derived tables) and that names contain the letters õäöüÕÄÖÜ (Estonian letters with a diacritic). These letters belong to the Estonian alphabet but do not belong to the ASCII character set. Although permitted by the DBMS, such letters might make the naming style inconsistent with the naming style of elements that belong to the public interface. If applications access base tables directly, then the letters can cause the same problems as in case of derived tables, i.e., applications may have difficulties with such names.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
660Declaratively partitioned tables without partitionsFind declaratively partitioned tables that do not have any partitions. Declarative partitioning is implemented in PostgreSQL starting from PostgreSQL 10.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License