Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Adds the community blog posts

Copple6de72d173b6f
diff --git a/apps/www/_blog/2022-12-16-new-in-postgres-15.mdx b/apps/www/_blog/2022-12-16-new-in-postgres-15.mdx
new file mode 100644
index 00000000000..bb0d61e9c1a
--- /dev/null
+++ b/apps/www/_blog/2022-12-16-new-in-postgres-15.mdx
@@ -0,0 +1,70 @@
+---
+title: What's new in Postgres 15?
+description: Describes the release of Postgres 15, new features and reasons to use it
+author: Pavel Borisov
+image:
+thumb:
+tags:
+ - postgres
+ - launch-week
+date: '2022-12-16'
+toc_depth: 3
+---
+
+The PostgreSQL community [released](https://www.postgresql.org/docs/current/release-15.html) version 15 (stable) in October 2022. Let's review some of the new features.
+
+## **The permission model is more secure**
+
+CREATE permission is revoked from all users except the database owner. It makes permission assigning more tunable (for details see [https://www.postgresql.org/docs/15/ddl-schemas.html#DDL-SCHEMAS-PATTERNS](https://www.postgresql.org/docs/15/ddl-schemas.html#DDL-SCHEMAS-PATTERNS)). And for the migrated database don't forget to revoke CREATE permission on the public schema manually to fit the new policy.
+
+There is a useful option CREATE VIEW .. WITH security_invoker=on to create a view that uses permissions of a view caller rather than a view creator to access underlying tables. With this, you should not worry that a user that doesn't have access to a table could see its data through a view.
+
+## **Performance speed-up**
+
+Sorting rows of data is a frequent operation inside the PostgreSQL code. It is used not only when you use the ORDER BY clause, but also in indices creation, table partitioning, etc. Furthermore, sorting is one of the most algorithmically expensive operations. So increasing speed up to 4 times of both in-memory and on-disk sorts in version 15 is one of the main reasons to upgrade.
+
+Window functions performance is also improved.
+
+## The **MERGE operation was introduced**
+
+A new MERGE operation is to modify target table data according to the provided source with many available conditional processing options. This allows data processing without writing procedural language functions or complex CTE queries. Essentially merge can work as conditional delete/insert/update and also this makes PostgreSQL syntax implementation closer to SQL:2008 standard. For details on MERGE uses see: [https://www.postgresql.org/docs/15/sql-merge.html](https://www.postgresql.org/docs/15/sql-merge.html)
+
+## **New features for logical replication**
+
+Logical replication is one of the fast-developing parts of PostgreSQL. Since version 15 two-phase commits are supported in logical replication. Also now you can choose parts of table data to logically replicate using i.e. some sets of rows and columns. In the case of replication conflict i.e. replicated data violate some constraint or there is a permission violation on a subscriber server user can choose to skip the conflicting transaction or disable the subscription until the user can decide how to handle the conflict.
+
+## **Increase parallelization**
+
+Parallel execution of queries using several worker processes is another part of PostgreSQL that develops fast. In version 15 _SELECT DISTINCT_ queries that drop duplicate rows from output can improve performance by using parallel workers.
+
+## **JSON logging**
+
+Output log data as JSON structure helps logs processing and structured output on the client's side.
+
+## **Compressing options**
+
+In version 15 _Zstandard_ and _ZL4_ can be chosen instead of _pglz_ as a WAL compression method. WAL compression is useful to decrease disk space usage while safeguarding data integrity.
+
+When you make a database backup with the provided pg*basebackup extension you can also choose \_Zstandard* or _ZL4_ to compress database backups on the server side, to transfer less data over the network.
+
+## **New POSIX regexp functions**
+
+There are several new regular expressions functions that you may find useful for strings processing i.e. regexp_substr(), regexp_count(), etc. For details see: [https://www.postgresql.org/docs/15/functions-matching.html#FUNCTIONS-POSIX-REGEXP](https://www.postgresql.org/docs/15/functions-matching.html#FUNCTIONS-POSIX-REGEXP)
+
+## Full Changelog
+
+You can find a full changelog and full list of new features: [https://www.postgresql.org/docs/15/release-15.html#id-1.11.6.6.5](https://www.postgresql.org/docs/15/release-15.html#id-1.11.6.6.5)
+
+# **How to upgrade to PG15?**
+
+The main reason to switch to a new PostgreSQL version is the large number of bug fixes that each new version delivers. Bug fixes aren't as prominent as new features or performance improvements, but they often have a greater impact. While some bug fixes are applied to previous versions, these changes require modifications to the ABI, interface functions, and system catalog structures, often not possible in an already-released major version.
+
+So, the TL;DR: yes, you should update to improve stability.
+
+Upgrading is safe thanks to the half-year stabilization period between April's code freeze of every new feature and October's stable release. Generally, you'd rather find a bug in an old version than in a new one.
+
+Before choosing to upgrade, don't forget to check the list of rare cases that need [manual actions](https://www.postgresql.org/docs/current/release-15.html#id-1.11.6.6.4) before or after the upgrade.
+
+- If you're self-hosting, upgrading between major PostgreSQL is easily done with [pg_upgrade](https://www.postgresql.org/docs/current/pgupgrade.html) utility or a set of recommended practices in the [official docs](https://www.postgresql.org/docs/current/upgrading.html).
+- If you're starting a new project on Supabase, you'll already be on PG15.
+- If you want to upgrade an existing project, check out our [Upgrading](https://supabase.com/docs/guides/platform/migrating-and-upgrading-projects#upgrade-your-project) documentation.
diff --git a/apps/www/_blog/2022-12-16-postgrest-11-prerelease.mdx b/apps/www/_blog/2022-12-16-postgrest-11-prerelease.mdx
new file mode 100644
index 00000000000..ce85b34ec97
--- /dev/null
+++ b/apps/www/_blog/2022-12-16-postgrest-11-prerelease.mdx
@@ -0,0 +1,200 @@
+---
+title: PostgREST 11 pre-release
+description: Describes new features of PostgREST 11 pre-release
+author: Steve Chavez
+image:
+thumb:
+tags:
+ - postgres
+ - launch-week
+date: '2022-12-16'
+toc_depth: 3
+---
+
+PostgREST 11 is not wrapped up yet, however a pre-release with the **[latest features and fixes](https://github.com/PostgREST/postgrest/releases/tag/v10.1.1.20221212)**
+is available on the Supabase CLI.
+
+In this blog post we'll cover some of the improved querying capabilities: spreading related tables, related orders and anti-joins**.**
+
+## Spreading related tables
+
+Very often the way we structure a database is not the way we want to present it to the frontend application. For example, let's assume we have a `films` and `technical_specs` tables and
+they form a one-to-one relationship.
+
+Using PostgREST resource embedding, we can query them in one request like so
+
+```http
+GET /films?select=title,technical_specs(camera,laboratory,sound_mix)
+```
+
+```jsx
+const { data, error } = await supabase.from('films').select(`
+ title,
+ technical_specs (
+ camera, laboratory, duration
+ )
+ `)
+```
+
+```json
+[
+ {
+ "title": "Pulp Fiction",
+ "technical_specs": {
+ "camera": "Arriflex 35-III",
+ "laboratory": "DeLuxe, Hollywood (CA), USA (color)",
+ "duration": "02:34:00"
+ }
+ },
+ "..."
+]
+```
+
+But we'd like to present a “flattened” result to the frontend, without the `technical_specs` object. For this we could create a new database view or function that shapes the json the way we want, but creating extra database objects is not always convenient.
+
+Using the new “spread” operator(syntax borrowed from [JS](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)), we can expand a related table columns and remove the nested object.
+
+```jsx
+GET /films?select=*,...technical_specs(camera,laboratory,duration)
+```
+
+```jsx
+const { data, error } = await supabase.from('films').select(`
+ title,
+ ...technical_specs (
+ camera, laboratory, duration
+ )
+ `)
+```
+
+```json
+[
+ {
+ "title": "Pulp Fiction",
+ "camera": "Arriflex 35-III",
+ "laboratory": "DeLuxe, Hollywood (CA), USA (color)",
+ "duration": "02:34:00"
+ },
+ "..."
+]
+```
+
+This only works for one-to-one and many-to-one relationships for now but we're looking at ways to remove this restriction.
+
+## Order by related tables
+
+It's also a common use case to order a table by a related table column. For example, suppose you'd like to order `films` based on the `technical_specs.duration` column.
+
+You can now do it like so:
+
+```jsx
+GET /films?select=*,...technical_specs(camera,laboratory,duration)&order=technical_specs(duration)
+```
+
+```jsx
+const { data, error } = await supabase
+ .from('films')
+ .select(`
+ title,
+ ...technical_specs (
+ duration
+ )
+ `)
+ .order('technical_specs(duration)', { descending: true }))
+```
+
+```json
+[
+ {
+ "title": "Amra Ekta Cinema Banabo",
+ "duration": "21:05:00"
+ },
+ {
+ "title": "Resan",
+ "duration": "14:33:00"
+ },
+ "..."
+]
+```
+
+Similarly to spreading related tables, this only works for one-to-one and many-to-one relationships.
+
+## Anti-Joins
+
+To do the equivalent of a left anti-join, you can now filter the rows where the related table is `null`.
+
+```http
+GET /films?select=title,nominations()&nominations=is.null
+```
+
+```jsx
+const { data, error } = await supabase
+ .from('films')
+ .select(`
+ title,
+ nominations()
+ `)
+ .is('nominations', null))
+```
+
+```json
+[
+ {
+ "title": "Memories of Murder"
+ },
+ {
+ "title": "Rush"
+ },
+ {
+ "title": "Groundhog Day"
+ },
+ "..."
+]
+```
+
+Note that `nominations` doesn't select any columns so they don't show on the resulting response.
+
+The equivalent of an inner join can be done by filtering the rows where the related table is `not null`.
+
+```http
+GET /films?select=title,nominations(rank,...competitions(name))&nominations=not.is.null
+```
+
+```jsx
+const { data, error } = await supabase
+ .from('films')
+ .select(
+ `
+ title,
+ nominations(rank,...competitions(name))
+ `
+ )
+ .not('nominations', 'is', null)
+```
+
+```json
+[
+ {
+ "title": "Pulp Fiction"
+ "nominations": [
+ {"rank": 1, "name": "Palme d'Or"},
+ {"rank": 1, "name": "BAFTA Film Award"},
+ {"..."}
+ ]
+ },
+ "..."
+]
+```
+
+This was already possible with the `!inner` modifier([introduced on PostgREST 9](https://supabase.com/blog/postgrest-9#resource-embedding-with-inner-joins_)
+but the `not null` filter is more flexible and can be used with an [or filter](https://supabase.com/docs/reference/javascript/or) to combine related tables' conditions.
+
+## Try it out
+
+This pre-release is not deployed to Supabase cloud but you can try it out locally with the [Supabase CLI](https://supabase.com/docs/reference/cli/introduction).
+
+```bash
+$ supabase start
+```
+
+Please try it and report any bugs, suggestions or ideas!