Contents
Isok is a PostgreSQL extension for monitoring anything that can be reported with an SQL query. Its expected usage targets data integrity maintenance and data cleanup. One expected use-case is addressing those corner cases where business logic is "fuzzy" and database content is monitored for unusual but not prohibited content. There is also a potential use-case for monitoring for errors in data, although it can be best to use constraints and triggers for this purpose because these prevent erroneous data from getting into the database in the first place.
Isok lets you run SQL to produce reports alerting you of suspicious or erroneous conditions, with features to suppress previously reported alerts. Unlike simply running a query, which reports the existence of questionable data patterns, this method produces reports alerting you of changes to questionable data patterns, so that only new problems need be reviewed.
It is useful when periodically probing for unusual but allowed activity, such as the purchase of more than 1,000 shoes by one person. Approved excessive shoe purchases can be individually flagged so they do not appear in future reports. To avoid being overwhelmed by numerous legitimate alerts and to allow time to resolve issues, specific rows in the reports can be deferred so they do not reappear before a designated date.
Unlike triggers and constraints, Isok does nothing until executed. This is done by SELECTing FROM a function, which runs some or all of the saved queries to check the state of the database and report the results. Report content is archived and can be queried.
Reported issues are classified as either errors or warnings. Errors are always reported when Isok is run. After execution, the warnings reported by the user-supplied queries may be manually sorted by the Isok user into one of the following categories: unclassified (the default), labeled “resolved”, or deferred until a later date. When Isok is run, unclassified warnings are reported, “resolved” warnings are not reported, and deferred warnings are not reported until the current date reaches the deferral date.
PostgreSQL supports a high degree of introspection. Isok can therefore monitor PostgreSQL itself, both the database engine's operational metrics and database schema design. In the former case system performance or usage might be monitored. In the latter, monitoring might look for things like violations of column naming conventions. However, while there may be legitimate uses of Isok for these sorts of purposes, other tools may be a better fit.
Regardless of how Isok is used, we believe some monitoring and some error checking is better than no monitoring and no error checking. Isok makes monitoring and error checking easy. If introducing triggers into your processing or running a complete performance monitoring solution is just not feasible, Isok provides a simple way to move the ball at least a little bit closer to the goal.
Page generated: 2025-06-03T21:00:20-05:00.