Filter Queries

Found 1053 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 relatively small amount of data, which is in the system catalog of a database.
  • Statistics about the catalog content and project home in GitHub that has additional information.

#941. The same database object name is used repeatedly in case the same database object type

INFORMATION_SCHEMA+system catalog base tables

Find what database object names are used more than once in case the objects of the same type. If the names differ from each other only by digits or underscores, then consider these the same name. For instance, if there are base tables Person and Person2 (in the same schema or different schemas), then the query returns the name Person. Make sure that there is no duplication of implementation elements in the database.

General License: MIT (opens in new tab)

#942. The same name is used in different contexsts

INFORMATION_SCHEMA+system catalog base tables

Find the names that are used in case of different types of elements

Problem detection License: MIT (opens in new tab)

#943. The same sequence generator is used in case of multiple columns

INFORMATION_SCHEMA only

Do not 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 (for instance the owner column or step), i.e., it increases coupling between tables. By having a shared sequence it is impossible to specify the owner (table column) to the sequence generator.

Problem detection License: MIT (opens in new tab)

#944. The same trigger function is used in case of multiple tables

INFORMATION_SCHEMA only

Find trigger functions that are used in case of more than one table. Although it is legal, one must be careful when changing the functions in order to avoid unwanted consequences.

General License: MIT (opens in new tab)

#945. The shortest names of database objects by object type

INFORMATION_SCHEMA+system catalog base tables

"Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) Names should be expressive. Find the shortest (identifiers) names of user-defined objects by their type. These could be the first candidates of renaming in order to give to database objects better names.

General License: MIT (opens in new tab)

#946. The size of base tables and their indexes

system catalog base tables only

Find the size of base tables without indexes, size of the indexes of the table, total size of the table (including its indexes) and percentage of the index size from the total size. If the size of indexes of a table is relatively high, then check as to whether all the indexes are needed.

General License: MIT (opens in new tab)

#947. The SQL-language routines with the body that is string literal

INFORMATION_SCHEMA+system catalog base tables

Find SQL-language routines that have the body that is string literal, i.e., the body is not SQL-standard function body. Routines with a SQL-standard body are permitted starting from PostgreSQL 14.

Problem detection License: MIT (opens in new tab)

#948. The storage size of each index (the system catalog excluded)

system catalog base tables only

Get overview of disk usage.

Sofware measure License: MIT (opens in new tab)

#949. The storage size of each schema data object (the system catalog excluded)

system catalog base tables only

Get overview of disk usage by different schema objects that contain user data.

Sofware measure License: MIT (opens in new tab)

#950. The storage size of each table (including indexes) (the system catalog excluded)

system catalog base tables only

Get overview of disk usage.

Sofware measure License: MIT (opens in new tab)

#951. The total number of physical lines of code in the bodies of user-defined SQL and PL/pgSQL functions/procedures

INFORMATION_SCHEMA+system catalog base tables

Find a numerical measure that describes the extent of the database public interface (virtual data layer) through which users access the database.

Sofware measure License: MIT (opens in new tab)

#952. The total size of all indexes (system catalog excluded)

system catalog base tables only

Sofware measure License: MIT (opens in new tab)

#953. The total size of all tables (system catalog excluded)

system catalog base tables only

Sofware measure License: MIT (opens in new tab)

#954. The total storage size of all indexes (the system catalog excluded)

system catalog base tables only

Get overview of disk usage.

Sofware measure License: MIT (opens in new tab)

#955. The total storage size of the database (the system catalog included)

system catalog base tables only

Get overview of disk usage.

Sofware measure License: MIT (opens in new tab)

#956. The usage of data type formatting functions

INFORMATION_SCHEMA+system catalog base tables

Find expressions that use a data type formatting function - to_char, to_number, to_date, to_timestamp.

General License: MIT (opens in new tab)

#957. The usage of double vs singular underscores or spaces in names as separator of name components

INFORMATION_SCHEMA+system catalog base tables

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 License: MIT (opens in new tab)

#958. The use of xmin hidden column in views and routines

INFORMATION_SCHEMA+system catalog base tables

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 License: MIT (opens in new tab)

#959. Three-valued logic (Boolean columns)

INFORMATION_SCHEMA only

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 License: MIT (opens in new tab)

#960. Three-valued logic (non-Boolean columns)

INFORMATION_SCHEMA+system catalog base tables

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 License: MIT (opens in new tab)
# Name Goal Type Data source Last update (sorted descending) License Actions
941 The same database object name is used repeatedly in case the same database object type Find what database object names are used more than once in case the objects of the same type. If the names differ from each other only by digits or underscores, then consider these the same name. For instance, if there are base tables Person and Person2 (in the same schema or different schemas), then the query returns the name Person. Make sure that there is no duplication of implementation elements in the database. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
942 The same name is used in different contexsts Find the names that are used in case of different types of elements Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
943 The same sequence generator is used in case of multiple columns Do not 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 (for instance the owner column or step), i.e., it increases coupling between tables. By having a shared sequence it is impossible to specify the owner (table column) to the sequence generator. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
944 The same trigger function is used in case of multiple tables Find trigger functions that are used in case of more than one table. Although it is legal, one must be careful when changing the functions in order to avoid unwanted consequences. General INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
945 The shortest names of database objects by object type "Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) Names should be expressive. Find the shortest (identifiers) names of user-defined objects by their type. These could be the first candidates of renaming in order to give to database objects better names. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
946 The size of base tables and their indexes Find the size of base tables without indexes, size of the indexes of the table, total size of the table (including its indexes) and percentage of the index size from the total size. If the size of indexes of a table is relatively high, then check as to whether all the indexes are needed. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
947 The SQL-language routines with the body that is string literal Find SQL-language routines that have the body that is string literal, i.e., the body is not SQL-standard function body. Routines with a SQL-standard body are permitted starting from PostgreSQL 14. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
948 The storage size of each index (the system catalog excluded) Get overview of disk usage. Sofware measure system catalog base tables only MIT (opens in new tab) View (opens in new tab)
949 The storage size of each schema data object (the system catalog excluded) Get overview of disk usage by different schema objects that contain user data. Sofware measure system catalog base tables only MIT (opens in new tab) View (opens in new tab)
950 The storage size of each table (including indexes) (the system catalog excluded) Get overview of disk usage. Sofware measure system catalog base tables only MIT (opens in new tab) View (opens in new tab)
951 The total number of physical lines of code in the bodies of user-defined SQL and PL/pgSQL functions/procedures Find a numerical measure that describes the extent of the database public interface (virtual data layer) through which users access the database. Sofware measure INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
952 The total size of all indexes (system catalog excluded) Sofware measure system catalog base tables only MIT (opens in new tab) View (opens in new tab)
953 The total size of all tables (system catalog excluded) Sofware measure system catalog base tables only MIT (opens in new tab) View (opens in new tab)
954 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 (opens in new tab)
955 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 (opens in new tab)
956 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 (opens in new tab)
957 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 (opens in new tab)
958 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 (opens in new tab)
959 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 (opens in new tab)
960 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 (opens in new tab)