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.

#401. Unused indexes (2)

INFORMATION_SCHEMA+system catalog base tables

Find indexes that are not used by the DBMS. Remember that indexes are not a "free lunch" and they slow down the processes of updating data.

Problem detection License: MIT (opens in new tab)

#402. Used indexes

INFORMATION_SCHEMA+system catalog base tables

Find indexes that are used by the DBMS.

General License: MIT (opens in new tab)

#403. Names of indexes that do not contain the table name

system catalog base tables only

Find indexes that do not support a declarative constraint and that are perhaps badly named. Table names make the names more expressive and user-friendly.

Problem detection License: MIT (opens in new tab)

#404. Redundant indexes

system catalog base tables only

Find indexes that may be redundant. In addition to identical indexes it also considers indexes that cover the same columns and have the same properties except uniqueness. The query considers all types of indexes, including indexes that have been automatically created to support a constraint and function-based indexes.

Problem detection License: MIT (opens in new tab)

#405. Constraint-supporting UNIQUE indexes with the same leading column

system catalog base tables only

Find indexes that support a uniqueness constraint and have the same leading column.

General License: MIT (opens in new tab)

#406. All partial indexes

INFORMATION_SCHEMA+system catalog base tables

Find indexes to a subset of table rows.

General License: MIT (opens in new tab)

#407. All gin indexes

INFORMATION_SCHEMA+system catalog base tables

Find indexes with less common access methods. Gin indexes are, for instance, used to speed up PostgreSQL's built in full text search.

General License: MIT (opens in new tab)

#408. Tables that have associated user triggers

system catalog base tables only

Find information about tables that are associated with triggers.

General License: MIT (opens in new tab)

#409. Table inheritance

system catalog base tables only

Find inheritance between base tables. Use table inheritance carefully because, for instance, certain constraints are not inherited and must be redefined on child tables.

General License: MIT (opens in new tab)

#410. Multiple inheritance

system catalog base tables only

Find instances of multiple inheriance of base tables. Make sure that multiple inheritance is indeed needed.

General License: MIT (opens in new tab)

#411. Mandatory non-primary key columns

INFORMATION_SCHEMA+system catalog base tables

Find mandatory non-primary key columns, i.e., the columns that have NOT NULL constraint.

General License: MIT (opens in new tab)

#412. NOT NULL constraint is directly associated with a column instead of the domain of the column

INFORMATION_SCHEMA+system catalog base tables

Find mandatory (NOT NULL) base table columns that have been defined based on the same domain but the NOT NULL constraint is associated directly with the column not to the domain. PostgreSQL CREATE DOMAIN statement documentation points out that it is possible to add NULL's to columns that have a NOT NULL domain and thus suggests to associate NOT NULL constraints with a column instead of the domain. However, this is a non-standard behavior and defeats the idea of domain as a reusable asset. The scenarios where NULLs can appear in columns with a NOT NULL domain are quite exotic and probably cannot appear in production environments.

Problem detection License: MIT (opens in new tab)

#413. Mandatory columns for holding large textual values (comments, descriptions, etc.)

INFORMATION_SCHEMA+system catalog base tables

Find mandatory (NOT NULL) base table columns that name, column type, and field size refers to the possibility that these are used to register large textual values like comments, descriptions, and explanations.

Problem detection License: MIT (opens in new tab)

#414. Duplicate materialized views

system catalog base tables only

Find materialized views with exactly the same subquery. There should not be multiple materialized views with the same subquery. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication.

Problem detection License: MIT (opens in new tab)

#415. Granted roles

system catalog base tables only

Find membership relations between roles.

General License: MIT (opens in new tab)

#416. CHECK constraints with the cardinality bigger than one

system catalog base tables only

Find multicolumn CHECK constraints. Such constraints must be associated directly with a base table, i.e., these cannot be associated with a domain. Enforce as much data integrity as possible at the database level and prefer declarative constraints to a trigger.

General License: MIT (opens in new tab)

#417. Duplicate rules

system catalog base tables only

Find multiple rules with the same definition (event, condition, action) on the same table. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication.

Problem detection License: MIT (opens in new tab)

#418. Unused named input parameters

INFORMATION_SCHEMA+system catalog base tables

Find named input parameters that are not referenced in the routine body. All the parameters that are presented in the routine signature declaration must be used in its body. Otherwise these are dead code elements.

Problem detection License: MIT (opens in new tab)

#419. Perhaps a too long name, which has been automatically shortened

INFORMATION_SCHEMA+system catalog base tables

Find names (identifiers) of user-defined database objects that are 63 bytes long. This is the longest permitted length of identifiers if the default value of the NAMEDATALEN parameter has not been changed. PostgreSQL shortens too long identifiers automatically. Automatic code modification could break it somewhere.

Problem detection License: MIT (opens in new tab)

#420. Names of database objects (regular identifiers) that contain $

INFORMATION_SCHEMA+system catalog base tables

Find names (identifiers) of user-defined database objects that are regular identifiers and contain the $ sign starting from the second position. "Note that dollar signs are not allowed in identifiers according to the letter of the SQL standard, so their use might render applications less portable." (PostgreSQL manual)

Problem detection License: MIT (opens in new tab)
# Name Goal (sorted ascending) Type Data source Last update License Actions
401 Unused indexes (2) Find indexes that are not used by the DBMS. Remember that indexes are not a "free lunch" and they slow down the processes of updating data. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
402 Used indexes Find indexes that are used by the DBMS. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
403 Names of indexes that do not contain the table name Find indexes that do not support a declarative constraint and that are perhaps badly named. Table names make the names more expressive and user-friendly. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
404 Redundant indexes Find indexes that may be redundant. In addition to identical indexes it also considers indexes that cover the same columns and have the same properties except uniqueness. The query considers all types of indexes, including indexes that have been automatically created to support a constraint and function-based indexes. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
405 Constraint-supporting UNIQUE indexes with the same leading column Find indexes that support a uniqueness constraint and have the same leading column. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
406 All partial indexes Find indexes to a subset of table rows. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
407 All gin indexes Find indexes with less common access methods. Gin indexes are, for instance, used to speed up PostgreSQL's built in full text search. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
408 Tables that have associated user triggers Find information about tables that are associated with triggers. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
409 Table inheritance Find inheritance between base tables. Use table inheritance carefully because, for instance, certain constraints are not inherited and must be redefined on child tables. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
410 Multiple inheritance Find instances of multiple inheriance of base tables. Make sure that multiple inheritance is indeed needed. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
411 Mandatory non-primary key columns Find mandatory non-primary key columns, i.e., the columns that have NOT NULL constraint. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
412 NOT NULL constraint is directly associated with a column instead of the domain of the column Find mandatory (NOT NULL) base table columns that have been defined based on the same domain but the NOT NULL constraint is associated directly with the column not to the domain. PostgreSQL CREATE DOMAIN statement documentation points out that it is possible to add NULL's to columns that have a NOT NULL domain and thus suggests to associate NOT NULL constraints with a column instead of the domain. However, this is a non-standard behavior and defeats the idea of domain as a reusable asset. The scenarios where NULLs can appear in columns with a NOT NULL domain are quite exotic and probably cannot appear in production environments. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
413 Mandatory columns for holding large textual values (comments, descriptions, etc.) Find mandatory (NOT NULL) base table columns that name, column type, and field size refers to the possibility that these are used to register large textual values like comments, descriptions, and explanations. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
414 Duplicate materialized views Find materialized views with exactly the same subquery. There should not be multiple materialized views with the same subquery. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
415 Granted roles Find membership relations between roles. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
416 CHECK constraints with the cardinality bigger than one Find multicolumn CHECK constraints. Such constraints must be associated directly with a base table, i.e., these cannot be associated with a domain. Enforce as much data integrity as possible at the database level and prefer declarative constraints to a trigger. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
417 Duplicate rules Find multiple rules with the same definition (event, condition, action) on the same table. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
418 Unused named input parameters Find named input parameters that are not referenced in the routine body. All the parameters that are presented in the routine signature declaration must be used in its body. Otherwise these are dead code elements. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
419 Perhaps a too long name, which has been automatically shortened Find names (identifiers) of user-defined database objects that are 63 bytes long. This is the longest permitted length of identifiers if the default value of the NAMEDATALEN parameter has not been changed. PostgreSQL shortens too long identifiers automatically. Automatic code modification could break it somewhere. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
420 Names of database objects (regular identifiers) that contain $ Find names (identifiers) of user-defined database objects that are regular identifiers and contain the $ sign starting from the second position. "Note that dollar signs are not allowed in identifiers according to the letter of the SQL standard, so their use might render applications less portable." (PostgreSQL manual) Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)