pg_stat_monitor do the same as "supabase" stats?
does the pg_stats_monitor extension basically do the same as the supabase stats that are in reports etc, does it need to be "enabled"?
7 Replies
If you are referring to this:
https://docs.percona.com/pg-stat-monitor/
This is more of a query-level performance monitoring tool, tracking individual SQL queries, execution times, plan details etc. as per docs. Supbase stats is more platform-level metrics, info like API usage, database size, connections, auth stats, storage I believe.
They should complement each other rather than replace each other. Most users only need the Supabase dashboard reports. You'd use pg_stats_monitor if you're doing deeper performance optimization and need to identify problematic queries?
I could not find much about enabling access to this third party extension within supabase, and it is not available in the official list of supported extensions in docs:
https://supabase.com/docs/guides/database/extensions. Did you find some way to enable it or?
But there seems to be an official way to switch on Postgres official solution for query level performance stats called "pg_stat_statements", if it helps:
https://supabase.com/docs/guides/database/extensions/pg_stat_statements
pg_stat_statements: Query Performance Monitoring | Supabase Docs
Track planning and execution statistics of all SQL statements executed on the database.
you can enable it in db extensions, but it also seems to error out on the table. Thats why i'm trying to find out what the difference is, if its 70% the same, i'll just disable it and live without it, rtaher than using resources on it


Was this on by default? Or did it start erroring out when you just turned it on?
If it was off by default and you just turned it on, you can just disable it and leave it off. The Supabase dashboard stats are sufficient for most monitoring needs.
If you ever do need query-level performance info. (like identifying specific slow queries), you can enable
pg_stat_statements instead - it's the official PostgreSQL extension.was off by default, started erroring when turned on "enabled"
do these db extensions need a "restart" to take effect on change?
Hey apologies for the late reply, that cannot hurt to try. If a restart does not do anything, you should be fine leaving it off as it was to start with.
If you ever need that level of detail and query performance analysis, you can definitely try pg_stat_statements as well. As mentioned earlier, this is the official postgres solution.
Let me know how it goes.
@chamath does it need a restart after disabling though, to stop/ clear any resources it is/ was uising?
Yep, from what I was able to find, a restart would help.
Extentions are loaded at db start, so disabling it in Supabase settings is enough to make it stop collecting stats, but the loaded libs can stay in memory.
But FYI, it's not a lot of resources for just a library loading on memory, so you can do it leisurely, turning it off is enough to stop it from engaging with your project further.
Let me know how it goes!