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...
681The number of names that use different writing stylesFind the number of names of user-defined database objects that use snake_case, ALL CAPS, Sentence case, camelCase or PascalCase style. Make sure that the naming style is consistent.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-03-18 16:44MIT License
682The number of routines by the number of input parametersFind the number of user-defined non-trigger routines by the number of input parameters.Sofware measureINFORMATION_SCHEMA+system catalog base tables2024-01-16 09:43MIT License
683The number of SQL-language routines with different types of bodiesFind for each user schema that contain a SQL-language routine how many of these have the body that is string literal and how many have the body (possible starting from PostgreSQL 14) that is parsed at the routine definition time. Try to be consistent, i.e., use the same solution in case of all the routines.Sofware measureINFORMATION_SCHEMA+system catalog base tables2022-12-02 11:33MIT License
684The number of tables based on the number of columnsFind how many tables with a certain range of the number of columns there are in the database.Sofware measureINFORMATION_SCHEMA+system catalog base tables2021-03-25 11:17MIT License
685The number of tables by schema, by type, and in totalFind the number of tables (base, foreign, and derived) in different schemas.Sofware measureINFORMATION_SCHEMA+system catalog base tables2021-03-07 10:57MIT License
686The number of user-defined non-trigger routines by schema, by language, and by routine typeFind the number of user-defined non-trigger routines based on their schema, language, and routine type. The routines can be used to implement virtual data layer. Thus the queriy gives some indications about the possible extent of the layer.Sofware measureINFORMATION_SCHEMA+system catalog base tables2024-01-14 20:53MIT License
687The number of user-defined non-trigger routines by schema, by security type, and by being deterministicFind the number of user-defined non-trigger routines based on their schema, security type, and being deterministic. The routines can be used to implement virtual data layer. Thus the queriy gives some indications about the possible extent of the layer.Sofware measureINFORMATION_SCHEMA+system catalog base tables2024-01-14 20:52MIT License
688The number of user-defined routines based on their database usageFind the number of non-extension routines in a database that modify data. The routines can be used to implement virtual data layer. Thus the queriy gives some indications about the possible extent of the layer. The query distinguishes trigger and non-trigger routines, thus it also gives information about triggers that modify data.Sofware measureINFORMATION_SCHEMA+system catalog base tables2024-01-15 00:38MIT License
689The number of user-defined triggersTriggers can be used to maintain data integrity in a database by causing rejection of data that does not conform to certain rules. Therefore, the number of triggers in a database gives some indications about the state of enforcing constraints at the database level. The query does not count internal triggers.Sofware measureINFORMATION_SCHEMA+system catalog base tables2020-11-06 14:51MIT License
690The number of user-defined triggers by schema, by type, and in totalTriggers can be used to maintain data integrity in a database by causing rejection of data that does not conform to certain rules. Therefore, the number of triggers in a database gives an indication about the state of enforcing constraints at the database level.Sofware measureINFORMATION_SCHEMA+system catalog base tables2020-11-06 14:51MIT License
691The reference to a database operation is missing from a commentFind user-defined routines that comment does not contain a reference to a database operation that the routine implements. In case of routines that have been created based on the contracts of database operations, one should refer to the short identifier of the operation in the comment of the routine. The operation identifier must be in this case in the form OP, but other forms could be used as well.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:39MIT License
692There is no reason to use PL/pgSQL if you do not use one or more features of a procedural languageUsing PL/pgSQL may cause context switching between declarative SQL and procedural PL/pgSQL. Thus use PL/pgSQL only if you truly need some of its constructs (variables, conditional statements, cycles, cursors, exception handling).Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 16:32MIT License
693There is no reason to use PL/pgSQL to write table functionsUsing PL/pgSQL may cause context switching between declarative SQL and procedural PL/pgSQL. Thus use PL/pgSQL only if you truly need some of its constructs. You can create table functions by using SQL.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:28MIT License
694The same database object name is used repeatedly in case the same database object typeFind what database object names are used more than once in case the objects of the same type. If the names differ from each other only by digits or underscores, then consider these the same name. For instance, if there are base tables Person and Person2 (in the same schema or different schemas), then the query returns the name Person. Make sure that there is no duplication of implementation elements in the database.GeneralINFORMATION_SCHEMA+system catalog base tables2023-03-17 01:12MIT License
695The same name is used in different contexstsFind the names that are used in case of different types of elementsProblem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-17 10:33MIT License
696The shortest names of database objects by object type"Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) Names should be expressive. Find the shortest (identifiers) names of user-defined objects by their type. These could be the first candidates of renaming in order to give to database objects better names.GeneralINFORMATION_SCHEMA+system catalog base tables2023-03-18 16:54MIT License
697The SQL-language routines with the body that is string literalFind SQL-language routines that have the body that is string literal, i.e., the body is not SQL-standard function body. Routines with a SQL-standard body are permitted starting from PostgreSQL 14.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-24 18:20MIT License
698The total number of physical lines of code in the bodies of user-defined SQL and PL/pgSQL functions/proceduresFind a numerical measure that describes the extent of the database public interface (virtual data layer) through which users access the database.Sofware measureINFORMATION_SCHEMA+system catalog base tables2021-11-04 21:02MIT License
699The usage of data type formatting functionsFind expressions that use a data type formatting function - to_char, to_number, to_date, to_timestamp.GeneralINFORMATION_SCHEMA+system catalog base tables2020-11-06 14:51MIT License
700The usage of double vs singular underscores or spaces in names as separator of name componentsImprove the readability of names. Find the number of names (identifiers) of user-defined database objects that contain two or more consecutive underscores or spaces as the separator of name components vs. the number of names that contain a single underscore or space to separate name components. Try to be consistent in the usage of underscores.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-03-17 11:11MIT License