Query goal: | 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. |
Notes about the query: | In case of the string_agg function, the line break (br) tag is used as a part of the separator for the better readability in case the query result is displayed in a web browser. |
Query type: | Problem detection (Each row in the result could represent a flaw in the design) |
Query reliability: | Medium (Medium number of false-positive results) |
Query license: | MIT License |
Fixing suggestion: | Do not associate a sequence generator with a domain. Use for each table a separate sequence generator. |
Data source: | INFORMATION_SCHEMA only |
SQL query: | Click on query to copy it
SELECT domain_schema, domain_name , domain_default, string_agg(table_schema || '.' || table_name || '.' || column_name, ';<br>' ORDER BY table_schema, table_name) AS columns FROM information_schema.columns c RIGHT JOIN information_schema.domains d USING (domain_schema, domain_name) INNER JOIN information_schema.schemata s ON d.domain_schema=s.schema_name WHERE d.domain_default ILIKE '%nextval%' AND (d.domain_schema = 'public' OR s.schema_owner<>'postgres') GROUP BY domain_schema, domain_name , domain_default ORDER BY domain_schema, domain_name; |
Collection name | Collection description |
---|---|
Find problems automatically | Queries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not . |
Category name | Category description |
---|---|
Comfortability of data management | Queries of this category provide information about the means that have been used to make the use or management of database more comfortable and thus, more efficient. |
Default value | Queries of this catergory provide information about the use of default values. |
Domains | Queries of this category provide information about reusable specifications of column properties. |
Performance | Queries of this category provide information about indexes in a database. |
Sequence generators | Queries of this category provide information about sequence generators and their usage. |