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.

#341. Regular expression with possibly a LIKE pattern

INFORMATION_SCHEMA+system catalog base tables

Find expressions that use a regular expression with a like predicate pattern.

Problem detection License: MIT (opens in new tab)

#342. LIKE with a regular expression pattern

INFORMATION_SCHEMA+system catalog base tables

Find expressions that use LIKE (including ILIKE) predicate with a regular expression patterns. In a LIKE pattern one can use only _ and % metasymbols to construct a pattern.

Problem detection License: MIT (opens in new tab)

#343. LIKE instead of =

INFORMATION_SCHEMA+system catalog base tables

Find expressions that use LIKE predicate for precise comparison.

Problem detection License: MIT (opens in new tab)

#344. LIKE without a pattern with % or _

INFORMATION_SCHEMA+system catalog base tables

Find expressions that use LIKE predicate witout a pattern that contains at least one % or _ sign.

Problem detection License: MIT (opens in new tab)

#345. No need to use to_date or to_timestamp function

INFORMATION_SCHEMA+system catalog base tables

Find expressions where a date literal with the ISO format is converted to date/timestamp by using to_date or to_timestamp function.

Problem detection License: MIT (opens in new tab)

#346. Extension routines in the schema "public"

system catalog base tables only

Find extensions that routines are in the schema public.

Problem detection License: MIT (opens in new tab)

#347. Prefixes in the names of database objects

INFORMATION_SCHEMA+system catalog base tables

Find for different types of database objects all the prefixes that are used in different names. One should be consistent in naming, including in the use of prefixes. If you use prefix in the name of a database object, then it could refer to the type of the database object. Do not use different prefixes in the names of database objects that have the same type.

General License: MIT (opens in new tab)

#348. Vacuum and analyze status of base tables

system catalog base tables only

Find for each base table the last time when the table has been vacuumed or analyzed (either manually or automatically).

General License: MIT (opens in new tab)

#349. Coverage by derived tables

INFORMATION_SCHEMA+system catalog base tables

Find for each base table the list of derived tables (both views and materialized views) that refer to the base table. If the database is used through the public database interface (virtual data layer), then, ideally, each table is referred from the subquery of at least one derived table.

General License: MIT (opens in new tab)

#350. Coverage by routines that have the SQL-standard body

INFORMATION_SCHEMA+system catalog base tables

Find for each base table the list of routines (functions and procedures) that refer to the base table. If the database is used through the public database interface (virtual data layer), then, ideally, each table is referred from at least one routine.

General License: MIT (opens in new tab)

#351. Usage of base tables

INFORMATION_SCHEMA+system catalog base tables

Find for each derived table the list of base tables that are used by the derived table.

General License: MIT (opens in new tab)

#352. Domain usage in base tables

INFORMATION_SCHEMA only

Find 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.

General License: MIT (opens in new tab)

#353. The number of SQL-language routines with different types of bodies

INFORMATION_SCHEMA+system catalog base tables

Find for each user schema that contain a SQL-language routine how many of these have the body that is string literal and how many have the body (possible starting from PostgreSQL 14) that is parsed at the routine definition time. Try to be consistent, i.e., use the same solution in case of all the routines.

Sofware measure License: MIT (opens in new tab)

#354. Number of underlying tables of derived tables

INFORMATION_SCHEMA+system catalog base tables

Find for each view or materialized view the number of tables based on which the derived table has been directly defined. These tables could be base tables or derived tables.

Sofware measure License: MIT (opens in new tab)

#355. Unused foreign data wrappers

INFORMATION_SCHEMA only

Find foreign data wrappers that do not have any associated foreign servers.

Problem detection License: MIT (opens in new tab)

#356. Foreign key columns that are associated with a sequence generator

INFORMATION_SCHEMA+system catalog base tables

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

#357. Foreign key column has a simple check constraint that is attached directly to the table

system catalog base tables only

Find foreign key columns that are covered by a simple check constraint, i.e., the constraint involves only one column. Look only constraints that are directly associated with the table, i.e., are not specified through a domain. Perhaps the constraint should be defined on the referenced candidate key column.

Problem detection License: MIT (opens in new tab)

#358. Foreign key columns that have no index

INFORMATION_SCHEMA+system catalog base tables

Find foreign key columns that do not have an index. Foreign key columns are often used for performing join operations. It is useful to index such columns.

Problem detection License: MIT (opens in new tab)

#359. Foreign key columns that do not have an integer or varchar type

INFORMATION_SCHEMA+system catalog base tables

Find foreign key columns that do not have smallint, integer, bigint, or varchar(n) type. These are the most commonly used types in case of key/foreign key columns. Although the use of other types would be perfectly legal as well, make sure that you have selected the best possible data type for each and every column.

General License: MIT (opens in new tab)

#360. Optional foreign key columns

INFORMATION_SCHEMA only

Find foreign key columns that do not have the NOT NULL constraint. It is better to limit the use of NULLs and optional columns due to the problems that it causes in interpreting the query results, making queries, and enforcing constraints. In addition, one should check as to whether this kind of design is consistent with the multiplicities in the conceptual data model.

General License: MIT (opens in new tab)
# Name Goal (sorted ascending) Type Data source Last update License Actions
341 Regular expression with possibly a LIKE pattern Find expressions that use a regular expression with a like predicate pattern. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
342 LIKE with a regular expression pattern Find expressions that use LIKE (including ILIKE) predicate with a regular expression patterns. In a LIKE pattern one can use only _ and % metasymbols to construct a pattern. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
343 LIKE instead of = Find expressions that use LIKE predicate for precise comparison. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
344 LIKE without a pattern with % or _ Find expressions that use LIKE predicate witout a pattern that contains at least one % or _ sign. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
345 No need to use to_date or to_timestamp function Find expressions where a date literal with the ISO format is converted to date/timestamp by using to_date or to_timestamp function. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
346 Extension routines in the schema "public" Find extensions that routines are in the schema public. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
347 Prefixes in the names of database objects Find for different types of database objects all the prefixes that are used in different names. One should be consistent in naming, including in the use of prefixes. If you use prefix in the name of a database object, then it could refer to the type of the database object. Do not use different prefixes in the names of database objects that have the same type. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
348 Vacuum and analyze status of base tables Find for each base table the last time when the table has been vacuumed or analyzed (either manually or automatically). General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
349 Coverage by derived tables Find for each base table the list of derived tables (both views and materialized views) that refer to the base table. If the database is used through the public database interface (virtual data layer), then, ideally, each table is referred from the subquery of at least one derived table. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
350 Coverage by routines that have the SQL-standard body Find for each base table the list of routines (functions and procedures) that refer to the base table. If the database is used through the public database interface (virtual data layer), then, ideally, each table is referred from at least one routine. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
351 Usage of base tables Find for each derived table the list of base tables that are used by the derived table. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
352 Domain usage in base tables Find 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. General INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
353 The number of SQL-language routines with different types of bodies Find for each user schema that contain a SQL-language routine how many of these have the body that is string literal and how many have the body (possible starting from PostgreSQL 14) that is parsed at the routine definition time. Try to be consistent, i.e., use the same solution in case of all the routines. Sofware measure INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
354 Number of underlying tables of derived tables Find for each view or materialized view the number of tables based on which the derived table has been directly defined. These tables could be base tables or derived tables. Sofware measure INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
355 Unused foreign data wrappers Find foreign data wrappers that do not have any associated foreign servers. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
356 Foreign key columns that are associated with a sequence generator Find 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 detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
357 Foreign key column has a simple check constraint that is attached directly to the table Find foreign key columns that are covered by a simple check constraint, i.e., the constraint involves only one column. Look only constraints that are directly associated with the table, i.e., are not specified through a domain. Perhaps the constraint should be defined on the referenced candidate key column. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
358 Foreign key columns that have no index Find foreign key columns that do not have an index. Foreign key columns are often used for performing join operations. It is useful to index such columns. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
359 Foreign key columns that do not have an integer or varchar type Find foreign key columns that do not have smallint, integer, bigint, or varchar(n) type. These are the most commonly used types in case of key/foreign key columns. Although the use of other types would be perfectly legal as well, make sure that you have selected the best possible data type for each and every column. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
360 Optional foreign key columns Find foreign key columns that do not have the NOT NULL constraint. It is better to limit the use of NULLs and optional columns due to the problems that it causes in interpreting the query results, making queries, and enforcing constraints. In addition, one should check as to whether this kind of design is consistent with the multiplicities in the conceptual data model. General INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)