Filter 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.
#261. Different ways how to find default timestamp values
INFORMATION_SCHEMA onlyFind all the default values of base table, view, and foreign table columns that are expressions invoking a function that returns a timestamp. Do it only if there are different expressions, i.e., there could be possible inconsistencies.
#262. Disabled rules
system catalog base tables onlyIdentify disabled rules. These should be enabled or dropped, otherwise these are dead code.
#263. Disabled system triggers (i.e., disabled enforcement of constraints)
system catalog base tables onlyThese triggers should be enabled because otherwise some important functionality regarding constraints like enforcing referential integrity does not work.
#264. Disabled user triggers
system catalog base tables onlyIdentify disabled triggers. These should be enabled or dropped, otherwise these are dead code.
#265. Distinct functional tasks implemented by triggers
INFORMATION_SCHEMA+system catalog base tablesThis query identifies and categorizes the distinct functional tasks implemented via triggers across the database schema. Rather than simply listing individual trigger instances, it aggregates triggers on the same or multiple tables that execute identical logic or share the same underlying routine (for example, maintaining audit timestamps or logging change history) into a single functional responsibility. This high-level inventory provides developers and database architects with a clear overview of the responsibilities delegated to the database tier, helping identify opportunities for code consolidation and standardization.
#266. Domain based on another domain
INFORMATION_SCHEMA+system catalog base tablesFind domains that have been defined based on another domain. Do not specify domains based on existing domains. This would unnecessarily increase dependencies and complexity.
#267. Domain candidates
INFORMATION_SCHEMA+system catalog base tablesFind column descriptions that are candidates for describing a domain.
#268. Domain CHECK constraint name contains table name
INFORMATION_SCHEMA onlyThis query identifies violations of modular design principles within user-defined domains. It detects CHECK constraints belonging to a domain where the constraint's name incorporates the identifier of a specific base table that utilizes that domain. Since domains are intended as reusable, abstract data types applicable across multiple entities, embedding a specific implementation context (like a table name) into the constraint's identifier creates semantic coupling. This makes the domain confusing to reuse in other contexts. Constraint identifiers should reflect the inherent logic of the domain (e.g., check_email_format), not the object to which it is applied.
#269. Domain CHECK constraints with the same name
INFORMATION_SCHEMA onlyFind domain check constraint names that are used more than once (within the same schema or in different schemas). Different things should have different names. However, here different constraints have the same name. Also make sure that this is not a sign of duplication of domains.
#270. Domain declares the same default value for multiple independent foreign keys
INFORMATION_SCHEMA+system catalog base tablesFind domains that declare a default value and that are used in case of multiple foreign key constraints that point to different tables. Domains should be used in a manner that does not cause unnecessary coupling of concerns. For instance, let us assume that columns client_state_type_code of table Client (that is used to implement the relationship with table Client_state_type) and worker_state_type_code of table Worker (that is used to implement the relationship with table Worker_state_type) have been defined based on the same domain. It the domain has a default value, then it determines the initial state of both clients and workers. However, it must be possible to determine the initial state independently in case of clients and workers.
#271. Domain name and type name are the same
INFORMATION_SCHEMA+system catalog base tablesUse different names to avoid confusion.
#272. Domain name contains base table name
INFORMATION_SCHEMA onlyFind names of domains that contain the name of the table that column the domain specifies. Domains are reusable artifacts that one should be able to use in case of different base tables. Thus, it is inappropriate to use the name of a particular table in the name of the domain.
#273. Domains that are associated with a sequence generator
INFORMATION_SCHEMA onlyDomains are reusable artifacts. By associating a domain with a sequence generator, one essentially starts to share sequence generators between tables. It may 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, i.e., it increases coupling between tables.
#274. Domains with the same name in different schemas
INFORMATION_SCHEMA onlyDomains are like words that can be used to construct generalized claims about the real world (table predicates). Better not to duplicate the words in the dictionary.
#275. Domain usage in base tables
INFORMATION_SCHEMA onlyFind 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.
#276. Do not always depend on one's parent
system catalog base tables onlyFind where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table.
#277. Do not always depend on one's parent - column names are ot sufficiently different
system catalog base tables onlyFind where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table. Find only cases where the candidate key and foreign key column names are very similar (Levenshtein distance shorter than four).
#278. Do not always depend on one's parent (INFORMATION_SCHEMA)
INFORMATION_SCHEMA onlyFind where a hierarchical structure is implemented in a base table by having a foreign key that refers to a candidate key of the same table. This design is called adjacency list.
#279. Do not assume you must use files
INFORMATION_SCHEMA onlyFind cases where you store images and other media as files outside the database and store in the database only paths to the files.
#280. Do not assume you must use files (based on user data)
INFORMATION_SCHEMA+system catalog base tablesFind cases where you store images and other media as files outside the database and store in the database only paths to the files.
| # | Name(sorted ascending, activate to sort descending) | Goal(activate to sort ascending) | Type(activate to sort ascending) | Data source(activate to sort ascending) | Last update(activate to sort ascending) | License | Actions |
|---|---|---|---|---|---|---|---|
| 261 | Different ways how to find default timestamp values | Find all the default values of base table, view, and foreign table columns that are expressions invoking a function that returns a timestamp. Do it only if there are different expressions, i.e., there could be possible inconsistencies. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 262 | Disabled rules | Identify disabled rules. These should be enabled or dropped, otherwise these are dead code. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View | |
| 263 | Disabled system triggers (i.e., disabled enforcement of constraints) | These triggers should be enabled because otherwise some important functionality regarding constraints like enforcing referential integrity does not work. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View | |
| 264 | Disabled user triggers | Identify disabled triggers. These should be enabled or dropped, otherwise these are dead code. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View | |
| 265 | Distinct functional tasks implemented by triggers | This query identifies and categorizes the distinct functional tasks implemented via triggers across the database schema. Rather than simply listing individual trigger instances, it aggregates triggers on the same or multiple tables that execute identical logic or share the same underlying routine (for example, maintaining audit timestamps or logging change history) into a single functional responsibility. This high-level inventory provides developers and database architects with a clear overview of the responsibilities delegated to the database tier, helping identify opportunities for code consolidation and standardization. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 266 | Domain based on another domain | Find domains that have been defined based on another domain. Do not specify domains based on existing domains. This would unnecessarily increase dependencies and complexity. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 267 | Domain candidates | Find column descriptions that are candidates for describing a domain. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 268 | Domain CHECK constraint name contains table name | This query identifies violations of modular design principles within user-defined domains. It detects CHECK constraints belonging to a domain where the constraint's name incorporates the identifier of a specific base table that utilizes that domain. Since domains are intended as reusable, abstract data types applicable across multiple entities, embedding a specific implementation context (like a table name) into the constraint's identifier creates semantic coupling. This makes the domain confusing to reuse in other contexts. Constraint identifiers should reflect the inherent logic of the domain (e.g., check_email_format), not the object to which it is applied. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 269 | Domain CHECK constraints with the same name | Find domain check constraint names that are used more than once (within the same schema or in different schemas). Different things should have different names. However, here different constraints have the same name. Also make sure that this is not a sign of duplication of domains. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 270 | Domain declares the same default value for multiple independent foreign keys | Find domains that declare a default value and that are used in case of multiple foreign key constraints that point to different tables. Domains should be used in a manner that does not cause unnecessary coupling of concerns. For instance, let us assume that columns client_state_type_code of table Client (that is used to implement the relationship with table Client_state_type) and worker_state_type_code of table Worker (that is used to implement the relationship with table Worker_state_type) have been defined based on the same domain. It the domain has a default value, then it determines the initial state of both clients and workers. However, it must be possible to determine the initial state independently in case of clients and workers. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 271 | Domain name and type name are the same | Use different names to avoid confusion. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 272 | Domain name contains base table name | Find names of domains that contain the name of the table that column the domain specifies. Domains are reusable artifacts that one should be able to use in case of different base tables. Thus, it is inappropriate to use the name of a particular table in the name of the domain. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 273 | Domains that are associated with a sequence generator | Domains are reusable artifacts. By associating a domain with a sequence generator, one essentially starts to share sequence generators between tables. It may 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, i.e., it increases coupling between tables. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 274 | Domains with the same name in different schemas | Domains are like words that can be used to construct generalized claims about the real world (table predicates). Better not to duplicate the words in the dictionary. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 275 | 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 | |
| 276 | Do not always depend on one's parent | Find where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table. | General | system catalog base tables only | MIT (opens in new tab) | View | |
| 277 | Do not always depend on one's parent - column names are ot sufficiently different | Find where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table. Find only cases where the candidate key and foreign key column names are very similar (Levenshtein distance shorter than four). | Problem detection | system catalog base tables only | MIT (opens in new tab) | View | |
| 278 | Do not always depend on one's parent (INFORMATION_SCHEMA) | Find where a hierarchical structure is implemented in a base table by having a foreign key that refers to a candidate key of the same table. This design is called adjacency list. | General | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 279 | Do not assume you must use files | Find cases where you store images and other media as files outside the database and store in the database only paths to the files. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 280 | Do not assume you must use files (based on user data) | Find cases where you store images and other media as files outside the database and store in the database only paths to the files. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View |