The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add Supabase + pgMustard guide
mchristofides70c4c4e586f4
diff --git a/web/docs/guides/integrations/pgmustard.mdx b/web/docs/guides/integrations/pgmustard.mdxnew file mode 100644index 00000000000..da2d915ec84--- /dev/null+++ b/web/docs/guides/integrations/pgmustard.mdx@@ -0,0 +1,65 @@+---+id: pgmustard+title: 'pgMustard'+description: 'Troubleshoot slow queries on Supabase with pgMustard, a visualization tool that also gives advice.'+---++This guide explains how to troubleshoot slow queries on Supabase using `explain` and pgMustard.++[pgMustard](https://pgmustard.com/) is a visualization tool for [`explain analyze`](https://www.postgresql.org/docs/current/using-explain.html#USING-EXPLAIN-ANALYZE) that also gives performance tips.++## Step 1: Get the query plan from Supabase++Use `explain analyze` to get a query plan from Postgres. This will run the query behind the scenes, so be careful with data modification queries.++pgMustard requires plans to be in json format, and the buffers, verbose, and settings parameters allow it to give better tips.++So a good prefix for your query would be:++```jsx+explain (analyze, format json, buffers, verbose, settings)`+```++Run the query, and copy the output.++++If you’re using the Supabase SQL Editor, this is easily copied from the cell titled `QUERY PLAN`, as seen above.++If you have any trouble, check out pgMustard’s guide for [getting a query plan](https://www.pgmustard.com/getting-a-query-plan).++## Step 2: Paste the query plan into pgMustard++Paste the json output into pgMustard and press Submit.++++## Step 3: Look through the top tips and slowest operations++Review the top tips in pgMustard. These are scored on a scale of 0 to 5 stars, based on how much time-saving potential they have (5 stars meaning lots of potential).++++Click one of the tips, or one of the operations, to see more information.++++## Step 4: Consider your options++If you get some promising suggestions, you may wish to explore them.++If you don’t get any tips, your query might be quite fast for the amount of work it’s doing.++For the example we saw in Step 3, let's try adding an index on the `customer_name` field in Supabase.++++Going through Steps 1-3 again, we now get an efficient index scan, that will scale nicely as our data grows.++++We could look into why Postgres isn’t choosing to do an index-only scan here, but pgMustard is letting us know that it doesn’t think we’ll gain much by doing so, by scoring the tip 0.3 out of 5.++## Resources+- [pgMustard](https://www.pgmustard.com) official website.+- [pgMustard explain glossary](https://www.pgmustard.com/docs/explain).diff --git a/web/sidebars.js b/web/sidebars.jsindex 1ce2c2e542d..c1baa56183b 100755--- a/web/sidebars.js+++ b/web/sidebars.js@@ -174,6 +174,7 @@ module.exports = {'guides/integrations/appsmith','guides/integrations/auth0','guides/integrations/draftbit',+ 'guides/integrations/pgmustard','guides/integrations/prisma','guides/integrations/snaplet','guides/integrations/vercel',diff --git a/web/static/img/guides/integrations/pgmustard/01-supabase-run-query.png b/web/static/img/guides/integrations/pgmustard/01-supabase-run-query.pngnew file mode 100644index 00000000000..d5797e23517Binary files /dev/null and b/web/static/img/guides/integrations/pgmustard/01-supabase-run-query.png differdiff --git a/web/static/img/guides/integrations/pgmustard/02-paste-plan-pgmustard.png b/web/static/img/guides/integrations/pgmustard/02-paste-plan-pgmustard.pngnew file mode 100644index 00000000000..231c35e564eBinary files /dev/null and b/web/static/img/guides/integrations/pgmustard/02-paste-plan-pgmustard.png differdiff --git a/web/static/img/guides/integrations/pgmustard/03-review-tips-pgmustard.png b/web/static/img/guides/integrations/pgmustard/03-review-tips-pgmustard.pngnew file mode 100644index 00000000000..d77b8bdab99Binary files /dev/null and b/web/static/img/guides/integrations/pgmustard/03-review-tips-pgmustard.png differdiff --git a/web/static/img/guides/integrations/pgmustard/04-click-tip-pgmustard.png b/web/static/img/guides/integrations/pgmustard/04-click-tip-pgmustard.pngnew file mode 100644index 00000000000..a8277a20450Binary files /dev/null and b/web/static/img/guides/integrations/pgmustard/04-click-tip-pgmustard.png differdiff --git a/web/static/img/guides/integrations/pgmustard/05-create-index-supabase.png b/web/static/img/guides/integrations/pgmustard/05-create-index-supabase.pngnew file mode 100644index 00000000000..b1bdd205b3aBinary files /dev/null and b/web/static/img/guides/integrations/pgmustard/05-create-index-supabase.png differdiff --git a/web/static/img/guides/integrations/pgmustard/06-check-pgmustard.png b/web/static/img/guides/integrations/pgmustard/06-check-pgmustard.pngnew file mode 100644index 00000000000..be599a57909Binary files /dev/null and b/web/static/img/guides/integrations/pgmustard/06-check-pgmustard.png differ