Catalog of PostgreSQL queries for finding information about a PostgreSQL database and its design problems

AND
AND
AND
ANDFrom where does the query gets its information?
AND
AND

There are 961 queries.

Seq nrNameGoalTypeData sourceLast updateLicense...
181The number of domains by schema and in totalIdentify the number of domains in different schemas.Sofware measureINFORMATION_SCHEMA only2020-11-06 14:51MIT License
182The number of sequence generators in different schemasIdentify the number of sequence generators in different schemas. Surrogate key values must be generated by using the system (the sequence generator mechanism in case of PostgreSQL). If there are no sequence generators, then there is a question as to whether there are no surrogate keys in the database at all (could be possible and OK) or (more probable) developers have forgotten to implement the generation of surrogate keys at the database level. An alternative is to implement generation of unique values at the application level or at the database level by using triggers. However, such implementation would most probably lead to the performance penalty because adding new rows to the table must be serialized, i.e., it can be done in one session at a time.Sofware measureINFORMATION_SCHEMA only2021-03-07 20:55MIT License
183The number of user defined triggers by different characteristicsFind the number of user defined triggers by action orientation (ROW, STATEMENT), action timing (BEFORE, AFTER, INSTEAD OF), and event type (INSERT, UPDATE, DELETE) and their combinations.Sofware measureINFORMATION_SCHEMA only2024-01-14 17:41MIT License
184The proportion of mandatory and optional textual base table columnsFind the number of textual base table columns, the number of optional textual base table columns (permit NULLs), and the number of mandatory textual base table columns (do not permit NULLs).Sofware measureINFORMATION_SCHEMA only2021-01-15 17:39MIT License
185The proportion of using different integer types as types of base table columnsFind the number of base table columns that use different integer types (SMALLINT, INTEGER, BIGINT) and their proportion from the overall set of columns that use an integer type.Sofware measureINFORMATION_SCHEMA only2021-03-03 12:41MIT License
186The same sequence generator is used in case of multiple columnsDo not 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 (for instance the owner column or step), i.e., it increases coupling between tables. By having a shared sequence it is impossible to specify the owner (table column) to the sequence generator.Problem detectionINFORMATION_SCHEMA only2021-03-07 21:07MIT License
187The same trigger function is used in case of multiple tablesFind trigger functions that are used in case of more than one table. Although it is legal, one must be careful when changing the functions in order to avoid unwanted consequences.GeneralINFORMATION_SCHEMA only2020-12-25 14:50MIT License
188Three-valued logic (Boolean columns)Find base table columns that have Boolean type and do not have NOT NULL constraint. Use two-valued logic (TRUE, FALSE) instead of three-valued logic (TRUE, FALSE, UNKNOWN). Because NULL in a Boolean column means unknown make all the Boolean columns mandatory.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
189Too generic names (domain constraints)Find domain CHECK constraints that have a too generic name - for instance, the name contains word "data" ) or the name is an abbreviation of the constraint type name (for instance, "chk" or "chk1").Problem detectionINFORMATION_SCHEMA only2021-10-31 17:39MIT License
190Too short domain constraint namesFind names of domain constraints that are shorter than the length of the name of the domain + two characters.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
191Too short view namesNames should be expressive. Find views that name is shorter than the average length of the the names of its directly underlying tables (both base tables and derived tables).Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
192Unnecessary usage of the numeric type in case of base table columnsFind base table columns that have type NUMERIC and the scale is 0, i.e., one can record in the column only integer values. Arithmetic operations are slower in case of the numeric type compared to an integer type. Thus, in order to record integer values, one should use columns with the type SMALLINT, INTEGER, or BIGINT instead of NUMERIC(p,0).Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
193Unused foreign data wrappersFind foreign data wrappers that do not have any associated foreign servers.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
194Unused foreign serversFind foreign servers that do not have any associated foreign tables.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
195Updatable views that do not have WITH CHECK OPTION constraintFind updatable views that do not have WITH CHECK OPTION constraint. WITH CHECK OPTION constraint prevents updates through the view that violate the predicate of the view. Such updates must be prevented.Problem detectionINFORMATION_SCHEMA only2023-10-29 10:33MIT License
196Updatable views with WHERE clause that do not have WITH CHECK OPTION constraintFind updatable views that restrict rows, i.e., have WHERE clause, but do not have WITH CHECK OPTION constraint. WITH CHECK OPTION constraint prevents updates through the view that violate the predicate of the view. Such updates must be prevented.Problem detectionINFORMATION_SCHEMA only2024-01-14 17:11MIT License
197Updataple foreign tables that refer to another PostgreSQL tableFind foreign tables that have been defined based on postgresql_fwd foreign data wrapper and that are updatable. Make sure that updatability is in this case needed.GeneralINFORMATION_SCHEMA only2020-11-06 17:15MIT License
198UPDATE triggersFind all UPDATE triggers. Make sure that they specify a correct set of columns in which data modification will fire the trigger.GeneralINFORMATION_SCHEMA only2023-12-22 09:47MIT License
199UPDATE triggers that maybe execute too oftenDo not let the system to do extra work. Ensure that trigger procedures are executed only if there is a real need of that. Find UPDATE triggers that could be executed too often because unneeded executions are not prevented.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
200Use invocation of a precise function instead of casting in a default value expressionBe precise and write as little code as possible. Prefer expressions with simple invocations of functions like localtimestamp, current_timestamp, and current_date over expressions like (now())::date. Find table columns that have a default value that casts the type of the returned value of a non-deterministic function (now, localtimestamp, current_timestamp, and current_date).Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License