Filter Queries
- All the queries about database objects contain a subcondition to exclude from the result information about the system catalog.
- Although the statements use SQL constructs (common table expressions; NOT in subqueries) that could cause performance problems in case of large datasets, it shouldn't be a problem in case of the relatively small amount of data in the system catalog of a database.
#961. The total size of all tables (system catalog excluded)
system catalog base tables only#962. The total storage size of all indexes (the system catalog excluded)
system catalog base tables onlyGet overview of disk usage.
#963. The total storage size of the database (the system catalog included)
system catalog base tables onlyGet overview of disk usage.
#964. The usage of data type formatting functions
INFORMATION_SCHEMA+system catalog base tablesFind expressions that use a data type formatting function - to_char, to_number, to_date, to_timestamp.
#965. The usage of double vs singular underscores or spaces in names as separator of name components
INFORMATION_SCHEMA+system catalog base tablesImprove the readability of names. Find the number of names (identifiers) of user-defined database objects that contain two or more consecutive underscores or spaces as the separator of name components vs. the number of names that contain a single underscore or space to separate name components. Try to be consistent in the usage of underscores.
#966. The use of xmin hidden column in views and routines
INFORMATION_SCHEMA+system catalog base tablesFind the number of views and materialized views that have a column with the xid type and the number of routines that contain a UPDATE or a DELETE statement that search condition refers to the xmin column. If one uses optimistic approach for dealing with the concurrent modifications of data, then xmin values should be presented by views and used in routines that modify or delete rows.
#967. Three-valued logic (Boolean columns)
INFORMATION_SCHEMA onlyFind base table columns that have Boolean type and do not have NOT NULL constraint. Use two-valued logic (TRUE, FALSE) instead of three-valued logic (TRUE, FALSE, UNKNOWN). Because NULL in a Boolean column means unknown make all the Boolean columns mandatory.
#968. Three-valued logic (non-Boolean columns)
INFORMATION_SCHEMA+system catalog base tablesFind non-foreign key columns of base tables that probably (based on the column name) contain values that represent truth values but do not have NOT NULL constraint. Use two-valued logic (TRUE, FALSE) instead of three-valued logic (TRUE, FALSE, UNKNOWN). Because NULL in a Boolean column means unknown make all the columns mandatory.
#969. Timezone-aware logic on timezone-unaware columns
system catalog base tables onlyThis query identifies logically flawed CHECK constraints on columns with timezone-unaware data types (DATE and TIMESTAMP WITHOUT TIME ZONE). It specifically targets constraints that contain timezone-aware logic (e.g., using AT TIME ZONE). This represents a critical semantic mismatch: the data type stores a "naive" or "local" time with no timezone context, while the constraint attempts to evaluate it within a specific timezone. The outcome of such a check is non-deterministic, as it depends on the session's current TimeZone setting, leading to unpredictable and unreliable data validation. This is a design flaw; if timezone-aware logic is required, the column should use the TIMESTAMP WITH TIME ZONE (TIMESTAMPTZ) data type.
#970. Too few rounds in case of calculating the hash
INFORMATION_SCHEMA+system catalog base tablesFind user-defined routines where gen_salt function is used with the number of rounds that is smaller than 12. The number should be adjusted based on the hardware where the system resides. Password hashing should take at least 250 ms.
#971. Too generic names (candidate key columns)
system catalog base tables onlyFind 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.
#972. Too generic names (columns)
INFORMATION_SCHEMA+system catalog base tablesThis query audits the schema for semantically weak column identifiers. It identifies columns named with generic nouns (e.g., data, info, value) or context-free technical terms (e.g., id, type, code, date, fk, pk). Such names violate the principle of self-documenting schema design, as they fail to describe the specific domain attribute being stored. To prevent ambiguity—especially in complex joins—column names should carry sufficient semantic context (e.g., product_type instead of type, creation_date instead of date).
#973. Too generic names (columns) (aggregate view)
INFORMATION_SCHEMA+system catalog base tablesThis query generates a frequency distribution of semantically weak column identifiers within the schema. It aggregates the occurrences of generic names (e.g., id, type, data) to quantify their prevalence across the database. This statistical view serves as a prioritization tool for refactoring, highlighting the most ubiquitous violations of naming conventions that contribute to schema ambiguity.
#974. Too generic names (columns) (aggregate view)(2)
INFORMATION_SCHEMA+system catalog base tablesThis query calculates the total cardinality of semantically weak column identifiers across the entire schema, encompassing both base tables and views. It applies a uniform definition of "generic" (e.g., flagging identifiers like id, type, date) regardless of the underlying object type. By treating table and view columns equivalently, the query provides a holistic metric of naming ambiguity, quantifying the overall prevalence of non-descriptive attributes within the database's public interface.
#975. Too generic names (columns) (there is a column with a more specific name in the table)
INFORMATION_SCHEMA+system catalog base tablesThis query identifies columns that appear overly generic because the same table also contains a more specialized sibling column whose name includes the original column's name as a prefix or suffix. For example, if a table defines both parent and root_parent, the standalone name parent becomes ambiguous and should likely be clarified (e.g., renamed to immediate_parent or direct_parent). The query excludes columns whose names indicate they are codes or identifiers (such as _id or _code), as those commonly follow distinct naming patterns.
#976. Too generic names (domain constraints)
INFORMATION_SCHEMA onlyFind domain CHECK constraints that have a too generic name - for instance, the name contains word "data" ) or the name is an abbreviation of the constraint type name (for instance, "chk" or "chk1").
#977. Too generic names (foreign key columns)
system catalog base tables onlyFind foreign key columns with the names like id, identifikaator, code, kood, number, etc. The names should have a prefix or a suffix that describes the nature of relationship with the referenced table or at least referes to the referenced table. These are too generic names.
#978. Too generic names (many-to-many relationship types that do not have additional attributes)
INFORMATION_SCHEMA+system catalog base tablesThis query identifies junction tables with semantically redundant names, specifically targeting those whose names contain the word "join". The structure of a many-to-many table (typically two foreign keys forming a composite primary key) is inherently declarative of its role as a join mechanism. Including the word "join" in the name is superfluous and violates the principle of naming based on the entity or relationship being modeled, not the implementation detail.
#979. Too generic names (parameters)
INFORMATION_SCHEMA+system catalog base tablesFind the names of parameters that are too generic. The routines work with data/information. Thus, it is not a good style to use generic words like data, information, parameter, etc. In the names of parameters. Moreover, avoid too generic parameter names like: id, tyyp, kood, aeg, kp,type, code, time, date, fk, pk, param.
#980. Too generic names (parameters) (there is a parameter with a more specific name in the routine)
INFORMATION_SCHEMA+system catalog base tablesFind parameter names in case of which the same routine has another parameter with the same mode but with more specific name, i.e., the name contains the parameter name in the end or in the beginning.
| # | Name(sorted ascending, activate to sort descending) | Goal(activate to sort ascending) | Type(activate to sort ascending) | Data source(activate to sort ascending) | Last update(activate to sort ascending) | License | Actions |
|---|---|---|---|---|---|---|---|
| 961 | The total size of all tables (system catalog excluded) | Sofware measure | system catalog base tables only | MIT (opens in new tab) | View | ||
| 962 | The total storage size of all indexes (the system catalog excluded) | Get overview of disk usage. | Sofware measure | system catalog base tables only | MIT (opens in new tab) | View | |
| 963 | The total storage size of the database (the system catalog included) | Get overview of disk usage. | Sofware measure | system catalog base tables only | MIT (opens in new tab) | View | |
| 964 | The usage of data type formatting functions | Find expressions that use a data type formatting function - to_char, to_number, to_date, to_timestamp. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 965 | The usage of double vs singular underscores or spaces in names as separator of name components | Improve the readability of names. Find the number of names (identifiers) of user-defined database objects that contain two or more consecutive underscores or spaces as the separator of name components vs. the number of names that contain a single underscore or space to separate name components. Try to be consistent in the usage of underscores. | Sofware measure | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 966 | The use of xmin hidden column in views and routines | Find the number of views and materialized views that have a column with the xid type and the number of routines that contain a UPDATE or a DELETE statement that search condition refers to the xmin column. If one uses optimistic approach for dealing with the concurrent modifications of data, then xmin values should be presented by views and used in routines that modify or delete rows. | Sofware measure | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 967 | Three-valued logic (Boolean columns) | Find base table columns that have Boolean type and do not have NOT NULL constraint. Use two-valued logic (TRUE, FALSE) instead of three-valued logic (TRUE, FALSE, UNKNOWN). Because NULL in a Boolean column means unknown make all the Boolean columns mandatory. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 968 | Three-valued logic (non-Boolean columns) | Find non-foreign key columns of base tables that probably (based on the column name) contain values that represent truth values but do not have NOT NULL constraint. Use two-valued logic (TRUE, FALSE) instead of three-valued logic (TRUE, FALSE, UNKNOWN). Because NULL in a Boolean column means unknown make all the columns mandatory. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 969 | Timezone-aware logic on timezone-unaware columns | This query identifies logically flawed CHECK constraints on columns with timezone-unaware data types (DATE and TIMESTAMP WITHOUT TIME ZONE). It specifically targets constraints that contain timezone-aware logic (e.g., using AT TIME ZONE). This represents a critical semantic mismatch: the data type stores a "naive" or "local" time with no timezone context, while the constraint attempts to evaluate it within a specific timezone. The outcome of such a check is non-deterministic, as it depends on the session's current TimeZone setting, leading to unpredictable and unreliable data validation. This is a design flaw; if timezone-aware logic is required, the column should use the TIMESTAMP WITH TIME ZONE (TIMESTAMPTZ) data type. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View | |
| 970 | Too few rounds in case of calculating the hash | Find user-defined routines where gen_salt function is used with the number of rounds that is smaller than 12. The number should be adjusted based on the hardware where the system resides. Password hashing should take at least 250 ms. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 971 | Too 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 detection | system catalog base tables only | MIT (opens in new tab) | View | |
| 972 | Too generic names (columns) | This query audits the schema for semantically weak column identifiers. It identifies columns named with generic nouns (e.g., data, info, value) or context-free technical terms (e.g., id, type, code, date, fk, pk). Such names violate the principle of self-documenting schema design, as they fail to describe the specific domain attribute being stored. To prevent ambiguity—especially in complex joins—column names should carry sufficient semantic context (e.g., product_type instead of type, creation_date instead of date). | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 973 | Too generic names (columns) (aggregate view) | This query generates a frequency distribution of semantically weak column identifiers within the schema. It aggregates the occurrences of generic names (e.g., id, type, data) to quantify their prevalence across the database. This statistical view serves as a prioritization tool for refactoring, highlighting the most ubiquitous violations of naming conventions that contribute to schema ambiguity. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 974 | Too generic names (columns) (aggregate view)(2) | This query calculates the total cardinality of semantically weak column identifiers across the entire schema, encompassing both base tables and views. It applies a uniform definition of "generic" (e.g., flagging identifiers like id, type, date) regardless of the underlying object type. By treating table and view columns equivalently, the query provides a holistic metric of naming ambiguity, quantifying the overall prevalence of non-descriptive attributes within the database's public interface. | Sofware measure | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 975 | Too generic names (columns) (there is a column with a more specific name in the table) | This query identifies columns that appear overly generic because the same table also contains a more specialized sibling column whose name includes the original column's name as a prefix or suffix. For example, if a table defines both parent and root_parent, the standalone name parent becomes ambiguous and should likely be clarified (e.g., renamed to immediate_parent or direct_parent). The query excludes columns whose names indicate they are codes or identifiers (such as _id or _code), as those commonly follow distinct naming patterns. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 976 | Too generic names (domain constraints) | Find domain CHECK constraints that have a too generic name - for instance, the name contains word "data" ) or the name is an abbreviation of the constraint type name (for instance, "chk" or "chk1"). | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 977 | Too generic names (foreign key columns) | Find foreign key columns with the names like id, identifikaator, code, kood, number, etc. The names should have a prefix or a suffix that describes the nature of relationship with the referenced table or at least referes to the referenced table. These are too generic names. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View | |
| 978 | Too generic names (many-to-many relationship types that do not have additional attributes) | This query identifies junction tables with semantically redundant names, specifically targeting those whose names contain the word "join". The structure of a many-to-many table (typically two foreign keys forming a composite primary key) is inherently declarative of its role as a join mechanism. Including the word "join" in the name is superfluous and violates the principle of naming based on the entity or relationship being modeled, not the implementation detail. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 979 | Too generic names (parameters) | Find the names of parameters that are too generic. The routines work with data/information. Thus, it is not a good style to use generic words like data, information, parameter, etc. In the names of parameters. Moreover, avoid too generic parameter names like: id, tyyp, kood, aeg, kp,type, code, time, date, fk, pk, param. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 980 | Too generic names (parameters) (there is a parameter with a more specific name in the routine) | Find parameter names in case of which the same routine has another parameter with the same mode but with more specific name, i.e., the name contains the parameter name in the end or in the beginning. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View |