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...
801The number and percentage of different 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. Different objects should have different names. The smaller the percentage the less descriptive are the names in the database. Find the number of different names (identifiers) of user-defined database objects by the object type and compare it with the total number of database objects with this type. The values could be used to compare different databases.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-03-16 15:38MIT License
802The number and percentage of optinal columns in base tablesFind the number and percentage of optinal columns in base tablesSofware measureINFORMATION_SCHEMA only2020-11-08 21:17MIT License
803The number of base table columns based on data typeFind the number of base table columns based on data type.Sofware measureINFORMATION_SCHEMA only2020-11-19 15:30MIT License
804The number of base table columns by type categoryFind the number of base table columns based on the category of data type that the columns have.Sofware measureINFORMATION_SCHEMA only2021-03-20 12:27MIT License
805The number of columns based on table typeFind the total number of columns in the different types of tables as well as average number of columns in the tables as well as minimal and maximal number of columns.Sofware measureINFORMATION_SCHEMA+system catalog base tables2022-11-10 14:12MIT License
806The number of commented routinesFind the number of commented routines based on the way how the comments have been added (as a COMMENT object or as a comment in the routine body).Sofware measureINFORMATION_SCHEMA+system catalog base tables2024-01-14 20:49MIT License
807The number of compensating actions of foreign key constraintsFind the number of compensating actions that are specified in case of foreign key constraints.Sofware measuresystem catalog base tables only2020-11-16 10:11MIT License
808The number of constraints by schema, by type, and in totalFind the number of constraints in different schemas. The number of constraints 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
809The number of default valuesFind the total number of columns with a default value as well as the number of columns with different kinds of default values (the number of columns where the default is used to implement surrogate key, the number of columns where the default is not used to implement surrogate key, the number of columns with a static default value, the number of columns with a dynamic default value).Sofware measureINFORMATION_SCHEMA only2021-11-22 13:26MIT License
810The number of derived table columns with an array, a user-defined, XML, JSON, or JSONB typeFind the number of derived table columns with json, xml, array, or user-defined types. Such columns may contain data that has been aggregated/composed based on values in base tables.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-01-14 20:22MIT License
811The number of direct and indirect child tables (foreign keys)Find the number of direct and all (direct+indirect) child tables of a base table based on the foreign keys. The result may help to classify the data. If the number of direct children is small but the number of all children is large, then the table probably contains classifiers. If both the number of direct and all children is large, then the table probably contains master data. If the number of all children is small, then the table probably contains transactional data, logs, or descriptive information of main entities.Sofware measuresystem catalog base tables only2020-11-14 16:10MIT License
812The number of direct and indirect child tables (table inheritance)Find the number of direct and all (direct+indirect) child tables of a base table based on the table inheritance.Sofware measuresystem catalog base tables only2020-11-14 19:59MIT License
813The number of domains by schema and in totalIdentify the number of domains in different schemas.Sofware measureINFORMATION_SCHEMA only2020-11-06 14:51MIT License
814The number of names of database objects by the number of subcomponents in the names"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 number of names (identifiers) of user-defined database objects by the number of subcomponents in the names. The values could be used to compare different databases.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-03-18 17:02MIT License
815The 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
816The number of referencing base tablesFind how many base tables reference to a base table by using foreign keys. The more references there are the more impact the change of the table could have to the overall system.Sofware measuresystem catalog base tables only2021-03-12 11:02MIT License
817The 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
818The number of rules by different characteristicsFind the number of rules by event (SELECT, INSERT, UPDATE, and DELETE) and in total.Sofware measuresystem catalog base tables only2024-01-14 16:10MIT License
819The number of schema objects by schema, by type, and in totalFind the number of different types of schema objects in different schemas as well as the total number of schema objects. Show the number of objects that belong to an extension as well as the number of (user-defined) objects that do not belong to an extension.Sofware measuresystem catalog base tables only2020-11-06 14:51MIT License
820The 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