DB functions for production
Hello everyone ! I noticed that recently a warning indicating that “DB functions” are not production ready, that was the case before for Edge Functions, which now these don’t have the warning.
So I’m a little bit confused on what should I use for production? DB functions or Edge Functions.
4 Replies
Usually, "not production ready" just means the feature is in beta and may change/break in the future, and/or hasn't been fully tested yet. I'm sure supabase will do their best to not break things and will move the feature from beta to GA (general availability) sometime in the (hopefully near) future.
as far as what to use, it depends on your use case. DB functions are generally designed to react to things that change in your database. Say you insert something and want that insert to trigger a webhook (or a edge function) where as an edge function is a bit of javascript that's executed when a https request is made to it's url
Database functions are just postgresql sql functions https://www.postgresql.org/docs/current/sql-createfunction.html
Which exists since very very long and are very stable.
What supabase means by beta is probably the UI for creating functions.
PostgreSQL Documentation
CREATE FUNCTION
CREATE FUNCTION CREATE FUNCTION — define a new function Synopsis CREATE [ OR REPLACE ] FUNCTION name ( [ [ …
On the other hand if you are referring to Database Webhook, it’s basically a postgresql trigger which gets triggered on database events and run another function
supabase_functions.http_request
, so again it’s stable.
If anything not production ready, it’s possibly the code of supabase_functions.http_request
.thanks a lot for both, now I have a clear picture of what was that warning! 🙂