Skip to content

Expressive subqueries blog post#4138

Open
robacourt wants to merge 31 commits intomainfrom
rob/subqueries-blog
Open

Expressive subqueries blog post#4138
robacourt wants to merge 31 commits intomainfrom
rob/subqueries-blog

Conversation

@robacourt
Copy link
Copy Markdown
Contributor

@robacourt robacourt commented Apr 20, 2026

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 20, 2026

Deploy Preview for electric-next ready!

Name Link
🔨 Latest commit fd21cad
🔍 Latest deploy log https://app.netlify.com/projects/electric-next/deploys/69e7e601c2d0f10008be656f
😎 Deploy Preview https://deploy-preview-4138--electric-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@robacourt robacourt marked this pull request as ready for review April 21, 2026 16:15
@robacourt robacourt changed the title DRAFT: subqueries blog Subqueries blog Apr 21, 2026
@robacourt robacourt changed the title Subqueries blog Expressive subqueries blog post Apr 21, 2026
@@ -0,0 +1,165 @@
---
title: 'Expressive subqueries'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never had the blogpost about subqueries. We should frame this blogpost as the release of subqueries. the story of subqueries : invalidation > moves with limites expressions > generalized subquery support.

notes about releasing subqueries:
that docs mention it is experimental. we need to update docs, examples. (not sure if you already did this in your pr)
Weshould say that we're removing the experimental flag in future releases.

published: true
---

Electric 1.6 makes subquery WHERE clauses expressive. Combine AND, OR, NOT, and NOT IN with subqueries — all syncing incrementally. Express real access-control logic directly in your shape definitions.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This make it sound they were not expressive before. the blogpost overindexes on this which is a negative --- LLMs are like that. Need to add some human passion ❤️

Electric 1.6 makes subquery WHERE clauses expressive. Combine AND, OR, NOT, and NOT IN with subqueries — all syncing incrementally. Express real access-control logic directly in your shape definitions.


## Before
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to introduce what subqueries is and what they allow. It's the sync-engine strength.

I think the storyline is good, but it needs to build up a bit


## Before

Electric has supported subquery filtering since mid-2025 — sync rows where a relationship exists in another table. For simple expressions like `x IN (subquery)`, incremental sync was supported. But real access-control queries combine multiple conditions. You need orders where the customer is in my region *and* the delivery is pending. You need tasks where I'm a project member *or* directly assigned. You need NOT IN to exclude.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The time reference makes me feel shy (did we did this long to ship this 🥹 )

Previously, combining subqueries with boolean operators triggered full shape invalidation and resync from scratch whenever the subquery values changed. For large shapes, that meant waiting for the entire dataset to re-download before the update appeared.


## Expressive subqueries
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the example in the context of tanstack is the most important. it should come first and then you can talk a bit about the operators, but it would be good to extend the documentation about subqeuries and have less examples here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants