The list of all the queries

The number of user defined triggers by different characteristics

Query goal: Find 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.
Query type: Sofware measure (Numeric values (software measures) about the database)
Query license: MIT License
Data source: INFORMATION_SCHEMA only
SQL query: Click on query to copy it

SELECT action_orientation, action_timing, event_manipulation, Count(DISTINCT trigger_schema ||'.'||event_object_table ||'.'|| trigger_name) AS nr_of_different_triggers
FROM information_schema.triggers AS Tr
INNER JOIN information_schema.schemata S
ON Tr.trigger_schema=S.schema_name 
WHERE (Tr.trigger_schema = 'public'
OR S.schema_owner<>'postgres')
GROUP BY ROLLUP (action_orientation, action_timing, event_manipulation)
ORDER BY action_orientation, action_timing, event_manipulation, nr_of_different_triggers DESC;

Collections where the query belongs to

Collection nameCollection description
Find problems by overviewQueries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not .
Find quick numeric overview of the databaseQueries that return numeric values showing mostly the number of different types of database objects in the database

Categories where the query belongs to

Category nameCategory description
Triggers and rulesQueries of this category provide information about triggers and rules in a database.

The list of all the queries