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.
#101. Base tables that have no uniqueness requirement for rows whatsoever
INFORMATION_SCHEMA+system catalog base tablesFind base tables without any unique constraints and primary key as well as any unique index, whether it is created explicitly by a developer or automatically by the DBMS. The only legitimate reason of such a table is if it is an abstract table that is used to define common columns of subtables.
#102. Base tables that have only the surrogate key and do not have any other column
INFORMATION_SCHEMA onlyDo not create unnecessary tables. If a table has cardinality 1 (one column), then most probably the values in this column should not be system generated unique values.
#103. Base tables where all the columns are optional
INFORMATION_SCHEMA onlyFind 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.
#104. Base tables where all the unique columns are optional
INFORMATION_SCHEMA+system catalog base tablesFind the base tables where all the unique columns are optional. In such tables there can be rows without values that identify these rows. In this case there can be rows in the table where the values that should identify the row are missing.
#105. Base tables where certainly registration time is not recorded
INFORMATION_SCHEMA onlyFind 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.
#106. Base tables where uniqueness is achieved by using only unique indexes
INFORMATION_SCHEMA+system catalog base tablesFind base tables where uniqueness is achieved by using only unique indexes, i.e., there is at least one unique index but no uniqueness constraints (PRIMARY KEY, UNIQUE, EXCLUDE)
#107. Base tables, which statistics is probably not up to date
INFORMATION_SCHEMA+system catalog base tablesFind base tables where statistics has not been collected at all or it has been lastly collected more than 40 days ago.
#108. Base tables with exactly one key
system catalog base tables onlyFind all base tables that have exactly one PRIMARY KEY or UNIQUE constraint. Find and enforce all the keys. Are you sure there are not more keys in the table?
#109. Base tables with multiple Boolean columns
INFORMATION_SCHEMA onlyFind base tables that have more than one column with Boolean type.
#110. Base tables with multiple comment columns
INFORMATION_SCHEMA onlyFind base tables with more than one comment columns
#111. Base tables with multiple name columns
INFORMATION_SCHEMA onlyFind base tables with more than one name columns. Perhaps the normalization level of the table is low.
#112. Base tables with multiple temporal columns
INFORMATION_SCHEMA onlyFind base tables that have more than one column with a temporal type (date or timestamp).
#113. Base tables with plenty of data
system catalog base tables onlyFind base tables that have 1000 rows or more.
#114. Base tables with the biggest number of rows
system catalog base tables onlyFind the base tables that belong to the top 5 in terms of the number of rows in the table. There should be test data in the tables.
#115. BOOLEAN base table and foreign table columns with a CHECK constraint that involves olnly this column
INFORMATION_SCHEMA+system catalog base tablesFind base table and foreign table columns with the Boolean type that has a CHECK constraint that involves only this column. Avoid unnecessary CHECK constraints. The Boolean type contains only two values and there is nothing to check. By creating a check that determines that possible values in the column are TRUE and FALSE, one duplicates the attribute constraint (column has a type). This is a form of duplication.
#116. BOOLEAN base table and foreign table columns with a PRIMARY KEY, UNIQUE, or FOREIGN KEY constraint that involves olnly this column
INFORMATION_SCHEMA+system catalog base tablesFind base table columns with the Boolean type that has a PRIMARY KEY, UNIQUE, or FOREIGN KEY constraint that involves only this column. Avoid unnecessary constraints. It is quite improbable that there must be such constraints. For instance, a table with PRIMARY KEY (
#117. Boolean column for gender
INFORMATION_SCHEMA onlyFind base table columns that have Boolean type and based on the column name are meant for recording data about gender.
#118. Boolean state columns missing default values
INFORMATION_SCHEMA onlyThis query identifies boolean columns in base tables that lack a default value, but whose names suggest they implement a state machine or act as state flags. In good database design, such boolean state indicators should typically have a default value (false or true) to ensure a predictable initial state when new records are created.
#119. B-tree index fillfactor has been explicitly set to 90
system catalog base tables onlyThis query identifies B-tree indexes where the FILLFACTOR has been explicitly set to 90. Since 90 is the default FILLFACTOR for B-tree indexes in PostgreSQL, this explicit declaration is superfluous. Removing such redundant settings simplifies the schema definition, improves maintainability, and makes intentionally non-default configurations more apparent.
#120. Candidate key columns that have a static default value
INFORMATION_SCHEMA+system catalog base tablesFind base table columns that are covered by a primary key or a unique constraint and that probably have a static default value.
| # | Name (sorted ascending) | Goal | Type | Data source | Last update | License | Actions |
|---|---|---|---|---|---|---|---|
| 101 | Base tables that have no uniqueness requirement for rows whatsoever | Find base tables without any unique constraints and primary key as well as any unique index, whether it is created explicitly by a developer or automatically by the DBMS. 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 detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 102 | Base tables that have only the surrogate key and do not have any other column | Do not create unnecessary tables. If a table has cardinality 1 (one column), then most probably the values in this column should not be system generated unique values. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 103 | Base tables where all the columns are optional | Find 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 detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 104 | Base tables where all the unique columns are optional | Find the base tables where all the unique columns are optional. In such tables there can be rows without values that identify these rows. In this case there can be rows in the table where the values that should identify the row are missing. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 105 | Base tables where certainly registration time is not recorded | Find 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. | General | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 106 | Base tables where uniqueness is achieved by using only unique indexes | Find base tables where uniqueness is achieved by using only unique indexes, i.e., there is at least one unique index but no uniqueness constraints (PRIMARY KEY, UNIQUE, EXCLUDE) | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 107 | Base tables, which statistics is probably not up to date | Find base tables where statistics has not been collected at all or it has been lastly collected more than 40 days ago. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 108 | Base tables with exactly one key | Find all base tables that have exactly one PRIMARY KEY or UNIQUE constraint. Find and enforce all the keys. Are you sure there are not more keys in the table? | General | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 109 | Base tables with multiple Boolean columns | Find base tables that have more than one column with Boolean type. | General | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 110 | Base tables with multiple comment columns | Find base tables with more than one comment columns | General | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 111 | Base tables with multiple name columns | Find base tables with more than one name columns. Perhaps the normalization level of the table is low. | General | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 112 | Base tables with multiple temporal columns | Find base tables that have more than one column with a temporal type (date or timestamp). | General | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 113 | Base tables with plenty of data | Find base tables that have 1000 rows or more. | General | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 114 | Base tables with the biggest number of rows | Find the base tables that belong to the top 5 in terms of the number of rows in the table. There should be test data in the tables. | General | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 115 | BOOLEAN base table and foreign table columns with a CHECK constraint that involves olnly this column | Find base table and foreign table columns with the Boolean type that has a CHECK constraint that involves only this column. Avoid unnecessary CHECK constraints. The Boolean type contains only two values and there is nothing to check. By creating a check that determines that possible values in the column are TRUE and FALSE, one duplicates the attribute constraint (column has a type). This is a form of duplication. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 116 | BOOLEAN base table and foreign table columns with a PRIMARY KEY, UNIQUE, or FOREIGN KEY constraint that involves olnly this column | Find base table columns with the Boolean type that has a PRIMARY KEY, UNIQUE, or FOREIGN KEY constraint that involves only this column. Avoid unnecessary constraints. It is quite improbable that there must be such constraints. For instance, a table with PRIMARY KEY ( |
Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 117 | Boolean column for gender | Find base table columns that have Boolean type and based on the column name are meant for recording data about gender. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 118 | Boolean state columns missing default values | This query identifies boolean columns in base tables that lack a default value, but whose names suggest they implement a state machine or act as state flags. In good database design, such boolean state indicators should typically have a default value (false or true) to ensure a predictable initial state when new records are created. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 119 | B-tree index fillfactor has been explicitly set to 90 | This query identifies B-tree indexes where the FILLFACTOR has been explicitly set to 90. Since 90 is the default FILLFACTOR for B-tree indexes in PostgreSQL, this explicit declaration is superfluous. Removing such redundant settings simplifies the schema definition, improves maintainability, and makes intentionally non-default configurations more apparent. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 120 | Candidate key columns that have a static default value | Find base table columns that are covered by a primary key or a unique constraint and that probably have a static default value. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) |