Filter Queries

Found 1056 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.

#181. At most one row is permitted in a table (based on check constraints)

INFORMATION_SCHEMA+system catalog base tables

Find base tables and foreign tables where based on a check constraint, a key constraint, and a NOT NULL constraint can be at most one row. Make sure that this is the real intent behind the constraint, not a mistake. Find tables where a check constraint permits only one possible value in a column, the column has NOT NULL constraint, and constitutes a key, i.e., has the PRIMARY KEY or UNIQUE constraint.

General License: MIT (opens in new tab)

#182. At most one row is permitted in a table (based on enumeration types)

INFORMATION_SCHEMA+system catalog base tables

Find base tables and foreign tables where based on the type of a column, a key constraint, and a NOT NULL constraint can be at most one row. Make sure that this is the real intent behind the constraint, not a mistake. Find tables where a column has an enumeration type with exactly one value, the column has NOT NULL constraint, and constitutes a key, i.e., has the PRIMARY KEY or UNIQUE constraint.

General License: MIT (opens in new tab)

#183. Base tables and materialized views without any index

INFORMATION_SCHEMA+system catalog base tables

Find base tables and materialized views that do not have any index.

Problem detection License: MIT (opens in new tab)

#184. Base table columns permitting temporal values that may be outside the range of logical values

INFORMATION_SCHEMA+system catalog base tables

Find base tables columns with temporal types (date and timestamp) that do not belong to a foreign key and that do not have any associated simple CHECK constraints, i.e., constraint that involves only one column. For instance, in the column registration_time that does not have any associated CHECK constraints could be values '1200-01-01 00:00' or '5900-12-31 00:00'. Rows with these values most probably represent wrong propositions and the system should restrict registration of such data.

Problem detection License: MIT (opens in new tab)

#185. Minimum tuple length required before trying to move long column values into TOAST tables has been changed

INFORMATION_SCHEMA+system catalog base tables

Find base tables in case of which toast_tuple_target storage parameter value is not the default value (2040). "Changing this value may not be useful for very short or very long rows. Note that the default setting is often close to optimal, and it is possible that setting this parameter could have negative effects in some cases. " Make sure that the parameter has an optimal value.

General License: MIT (opens in new tab)

#186. Base tables where certainly registration time is not recorded

INFORMATION_SCHEMA only

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

#187. Base tables that do not have a TOAST table

system catalog base tables only

Find base tables that (due to the types of their columns) do not have an associated TOAST table for storing out-of-line data.

General License: MIT (opens in new tab)

#188. Base tables with plenty of data

system catalog base tables only

Find base tables that have 1000 rows or more.

General License: MIT (opens in new tab)

#189. Perhaps last update time trigger is missing

INFORMATION_SCHEMA+system catalog base tables

Find base tables that have a column for last update time but the table does not have associated before update row level trigger for changing the last update time.

Problem detection License: MIT (opens in new tab)

#190. Perhaps a CHECK constraint about the combination of truth values is missing

INFORMATION_SCHEMA+system catalog base tables

Find base tables that have at least two columns that have Boolean type and have at least one Boolean column that is not covered by a CHECK constraint involving more than one Boolean column. The Boolean columns possibly mean that we want to record data about states. Often the states depend on each other. For instance, if an order is archived it must be inactive.

Problem detection License: MIT (opens in new tab)

#191. Perhaps a CHECK constraint about the order of events is missing

INFORMATION_SCHEMA+system catalog base tables

Find base tables that have at least two columns that have DATE or TIMESTAMP (with or without time zone) type and do not have any associated CHECK constraint that involves two or more of these columns. The columns mean that we want to record data about events or processes, which often have a certain order. Hence, in case of each row of such a table the values in these columns must be in a certain order. For instance, the end of a meeting cannot be earlier than the beginning of the meeting.

Problem detection License: MIT (opens in new tab)

#192. Base tables created based on a type

system catalog base tables only

Find base tables that have been created based on a composite type and thnk through as to whether it was really needed.

General License: MIT (opens in new tab)

#193. Base tables that have more than five indexes

system catalog base tables only

Find base tables that have more than five indexes. Indexes can be used to increase the speed of queries (SELECT statements). However, the amount of indexes shouldn't be too large. Otherwise it may reduce the speed of operations that are used to modify data.

Problem detection License: MIT (opens in new tab)

#194. Base tables with multiple temporal columns

INFORMATION_SCHEMA only

Find base tables that have more than one column with a temporal type (date or timestamp).

General License: MIT (opens in new tab)

#195. Base tables with multiple Boolean columns

INFORMATION_SCHEMA only

Find base tables that have more than one column with Boolean type.

General License: MIT (opens in new tab)

#196. Duplicate stored generated base table columns

INFORMATION_SCHEMA only

Find base tables that have more than one stored generated column with the same expression. The support of generated columns was added to PostgreSQL 12. 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)

#197. Multiple triggers that update tsvector values

system catalog base tables only

Find base tables that have multiple triggers to update tsvector values.

Problem detection License: MIT (opens in new tab)

#198. Perhaps a CHECK constraint about required personal name components is missing

INFORMATION_SCHEMA+system catalog base tables

Find base tables that have optional columns for recording both given name and surname and do not have a CHECK constraint that requires that at least one of the name components must be registered in case of each person.

Problem detection License: MIT (opens in new tab)

#199. Perhaps a unneccessary surrogate key

INFORMATION_SCHEMA+system catalog base tables

Find base tables that have the primary key that is not a surrogate key and an alternate key that is a surrogate key. Perhaps the surrogate key column is not needed.

Problem detection License: MIT (opens in new tab)

#200. Do not use a generic attribute table

INFORMATION_SCHEMA only

Find base tables that implement a highly generic database design (EAV design - Entiry-Attribute-Value design), according to which attribute values are recorded in a generic table that contains attribute-value pairs.

Problem detection License: MIT (opens in new tab)
# Name(activate to sort ascending) Goal(sorted ascending, activate to sort descending) Type(activate to sort ascending) Data source(activate to sort ascending) Last update(activate to sort ascending) License Actions
181 At most one row is permitted in a table (based on check constraints) Find base tables and foreign tables where based on a check constraint, a key constraint, and a NOT NULL constraint can be at most one row. Make sure that this is the real intent behind the constraint, not a mistake. Find tables where a check constraint permits only one possible value in a column, the column has NOT NULL constraint, and constitutes a key, i.e., has the PRIMARY KEY or UNIQUE constraint. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
182 At most one row is permitted in a table (based on enumeration types) Find base tables and foreign tables where based on the type of a column, a key constraint, and a NOT NULL constraint can be at most one row. Make sure that this is the real intent behind the constraint, not a mistake. Find tables where a column has an enumeration type with exactly one value, the column has NOT NULL constraint, and constitutes a key, i.e., has the PRIMARY KEY or UNIQUE constraint. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
183 Base tables and materialized views without any index Find base tables and materialized views that do not have any index. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
184 Base table columns permitting temporal values that may be outside the range of logical values Find base tables columns with temporal types (date and timestamp) that do not belong to a foreign key and that do not have any associated simple CHECK constraints, i.e., constraint that involves only one column. For instance, in the column registration_time that does not have any associated CHECK constraints could be values '1200-01-01 00:00' or '5900-12-31 00:00'. Rows with these values most probably represent wrong propositions and the system should restrict registration of such data. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
185 Minimum tuple length required before trying to move long column values into TOAST tables has been changed Find base tables in case of which toast_tuple_target storage parameter value is not the default value (2040). "Changing this value may not be useful for very short or very long rows. Note that the default setting is often close to optimal, and it is possible that setting this parameter could have negative effects in some cases. " Make sure that the parameter has an optimal value. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
186 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)
187 Base tables that do not have a TOAST table Find base tables that (due to the types of their columns) do not have an associated TOAST table for storing out-of-line data. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
188 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)
189 Perhaps last update time trigger is missing Find base tables that have a column for last update time but the table does not have associated before update row level trigger for changing the last update time. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
190 Perhaps a CHECK constraint about the combination of truth values is missing Find base tables that have at least two columns that have Boolean type and have at least one Boolean column that is not covered by a CHECK constraint involving more than one Boolean column. The Boolean columns possibly mean that we want to record data about states. Often the states depend on each other. For instance, if an order is archived it must be inactive. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
191 Perhaps a CHECK constraint about the order of events is missing Find base tables that have at least two columns that have DATE or TIMESTAMP (with or without time zone) type and do not have any associated CHECK constraint that involves two or more of these columns. The columns mean that we want to record data about events or processes, which often have a certain order. Hence, in case of each row of such a table the values in these columns must be in a certain order. For instance, the end of a meeting cannot be earlier than the beginning of the meeting. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
192 Base tables created based on a type Find base tables that have been created based on a composite type and thnk through as to whether it was really needed. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
193 Base tables that have more than five indexes Find base tables that have more than five indexes. Indexes can be used to increase the speed of queries (SELECT statements). However, the amount of indexes shouldn't be too large. Otherwise it may reduce the speed of operations that are used to modify data. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
194 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)
195 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)
196 Duplicate stored generated base table columns Find base tables that have more than one stored generated column with the same expression. The support of generated columns was added to PostgreSQL 12. 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 INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
197 Multiple triggers that update tsvector values Find base tables that have multiple triggers to update tsvector values. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
198 Perhaps a CHECK constraint about required personal name components is missing Find base tables that have optional columns for recording both given name and surname and do not have a CHECK constraint that requires that at least one of the name components must be registered in case of each person. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
199 Perhaps a unneccessary surrogate key Find base tables that have the primary key that is not a surrogate key and an alternate key that is a surrogate key. Perhaps the surrogate key column is not needed. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
200 Do not use a generic attribute table Find base tables that implement a highly generic database design (EAV design - Entiry-Attribute-Value design), according to which attribute values are recorded in a generic table that contains attribute-value pairs. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)