After you have built and installed it, you add a couple of settings to the postgresql.conf file, like this:
Then if the planner estimates the cost as higher than the statement_cost_limit it will raise an error rather than allowing the query to run.
shared_preload_libraries = 'plan_filter' plan_filter.statement_cost_limit = 100000.0
This module follows an idea from a discussion on the postgresql-hackers mailing list some time ago. It was developed by PostgreSQL Experts Inc for our client Twitch.TV, who have generously allowed us to make it publicly available.