Live data from Hacker News

Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

electric-sql.com

61–70 of 173 posts

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#61

Can you talk about the dataset sizes you support? Your example linear app has 112 rows, could you support 1000? 10K? 100k? 1M?

Relevant — PowerSync [1] (similar to Electric; disclosure: co-founder) is currently designed to efficiently sync around 1M rows, or roughly 1GB of uncompressed data. More would be possible, but performance may degrade. In the future we plan on pushing it to handle larger data volumes.

[1] https://docs.powersync.co/

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#62

Can you talk about the dataset sizes you support? Your example linear app has 112 rows, could you support 1000? 10K? 100k? 1M?

OP here, I work for Electric, Electric is designed to support partial sync, and so you don’t have to sync your whole dataset. (Note that this is feature is under development and not yet public) There are limitations on how much data a browser will store for an individual site, so the number of rows you can sync will depend on the shape of your dataset. Finally there are also some performance considerations with WASM…

We wrote a bit about SQLite implementations and associated performance considerations for web here: https://www.powersync.co/blog/sqlite-persistence-on-the-web

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#63
post #43

I want to be able to have a Postgres database as the central source of truth for all data and user accounts, but then have each users private content to be siloed and synced to their own SQLite database which they alone have access to (maybe even they’re have one SQLite file on server and one SQLite file on phone or etc.). Is this possible with electricSQL? I remember looking at it a year ago or so and was excited bu…

This is also the pattern targeted by PowerSync (disclosure: co-founder) — selectively syncing scoped data for the user from Postgres to their own client SQLite database. Sync Rules are used to define which data is synced to which users: https://docs.powersync.co/usage/sync-rules

This is the fifth comment I’ve counted plugging Powersync in this thread. I guess it’s the nature of the startup hustle game but this level of promotion in someone else’s Show HN thread feels a little distasteful. Maybe you could post your own Show HN?

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#64

I want to be able to have a Postgres database as the central source of truth for all data and user accounts, but then have each users private content to be siloed and synced to their own SQLite database which they alone have access to (maybe even they’re have one SQLite file on server and one SQLite file on phone or etc.). Is this possible with electricSQL? I remember looking at it a year ago or so and was excited bu…

You could store a SQLite database in a blob column for the user, though this would be an affront to $DEITY.

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#65
Congrats on the launch, looks like a great product.

Out of curiosity - the demo on the site suggests the local first latency is like 10-40 ms. I would think reading/writing to SQLite locally would be on the order of 1ms or less. Why is that?

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#66

Any specific reason it wouldn't work with Angular as well (noticed it was not listed in the Frontend frameworks section)?

Not at all, it's perfectly possible to use it with Angular. While we haven't built any specific helpers for Angular, like we have for React, our TypeScript client is perfectly useable from any JS/TS framework or project.

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#67

Congrats on the launch, looks like a great product. Out of curiosity - the demo on the site suggests the local first latency is like 10-40 ms. I would think reading/writing to SQLite locally would be on the order of 1ms or less. Why is that?

Hey, I work for Electric,

Quite right, the latency should be low single figure ms. There is actually a slight bug in how that latency is calculated on the demo and includes an extra render tick, I was digging into it earlier but didn't get a chance to push a fix yet.

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#68

Pretty interesting, what's the benefit of using a check expression rather than row level security?

We do row (and column) level security, the check expression provides an optional additional granularity for controlling which roles can make certain writes

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#69

I get dizzy even trying to envision all the edge cases and challenges making an active - active sync between two different database engines, over what would be tens of thousands (hundres?) of simultaneous connection to clients via a non-reliable, expect network disconnect, and reconnect from a different location from the same client. If you have managed to pull this off in a way that reliably scales and reliably keep…

Hey, thanks :) and yup, lots of complexity and engineering. We're lucky because we're building on a lot of research and previous work.

The model is Transactional Causal+ Consistency (TCC+). This has been formally proven to be the strongest possible consistency mode for an AP database system.

We have a page on literature here https://electric-sql.com/docs/reference/literature, which includes the Cure paper http://ieeexplore.ieee.org/document/7536539/ on TCC+ and the highly available transactions paper https://dl.acm.org/doi/10.14778/2732232.2732237

Annette Bieniusa, Nuno Preguiça and Marc Shapiro from our team are authors of the Cure work (amongst many other things!).

Re: rollbacks, our model is to provide finality of local-writes: https://electric-sql.com/docs/reference/architecture#local-w... -- which means you don't have to write rollback handlers.

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#70
post #56

Wow, this is awesome! I've been "waiting" for a project like this for years - having to roll out my own syncing solution for my local-first app until now. I have yet to dive deeper in the docs and examples, but does anyone know how easy it would be with Electric to provide some kind of client-side transformations (encryption/decryption) of specific fields or entire rows in your SQLite db before syncing? A major reaso…

Valter from Electric here,

Handling encryption/decryption of user data is one of our priorities. We're thinking along the lines of adding hooks for transforming data as you're seeing it.

We're getting there on permissions implementations. If you want to do row-based filtering based on user_id today, you can add a special column 'electric_user_id' to your table: https://electric-sql.com/docs/reference/roadmap#shapes

We plan to integrate Electric with popular web frameworks: https://electric-sql.com/docs/integrations/frontend. To integrate with Angular, the client should work out of the box. What you'd need is to provide is the code for reactivity, which should not be a lot. Reach out on Discord and we can have a chat about it.

Post reply on HN