pglite icon indicating copy to clipboard operation
pglite copied to clipboard

mobile support

Open bumberboy opened this issue 1 year ago • 4 comments

Thanks for building and maintaining this project!

Is PGLite able to run in the mobile browser at the moment? I can't seem to get it to start reliably in iOS safari. I tried setting lower starting memory limits and that did not help: the site still crashes.

If mobile support is not yet ready, May I know if there's a timeline for that?

Thanks! Eager to build with electricSQL!

bumberboy avatar Oct 26 '24 12:10 bumberboy

Hey @bumberboy

It should run in Safari, previous testing has worked, but maybe we need to do a little more. I know there can be issues if you try to allocate over 256mb.

Also worth noting that PGlite isn't a requirement for Electric sync. You can use electric to sync into any local store.

samwillis avatar Oct 26 '24 13:10 samwillis

Hi, I'm searching for cross device (browser, mobile, node) working database / storage. Also would need the liveQuery feature to subscribe to changed query results or changes only. Optional (small / medium) files could be stored too.

You @samwillis write about a 256mb limit. Do you talk about a query limit or about database size limited to 256mb?

pwFoo avatar Apr 23 '25 05:04 pwFoo

Depends memory usage on database / table size or query / live executions? I looking into PGlite as client side (desktop, mobile) database solution to store application data - optional with small / medium images / blobs - and share / partial sync between clients as needed.

Tested around with incrementalQuery and some updates with just 8 rows in table ends up with 347MB of used memory with Chrome @ Win11.

pwFoo avatar Apr 23 '25 07:04 pwFoo

Error stack of iOS Safari with @electric-sql/[email protected]

const client = new PGlite(`idb://xxx`);

await client.exec('CREATE SCEHMA IF NOT EXISTS "drizzle"')
RangeError: Maximum call stack size exceeded.
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[143]@[wasm code]
<?>.wasm-function[338]@[wasm code]
<?>.wasm-function[4991]@[wasm code]
<?>.wasm-function[3808]@[wasm code]
<?>.wasm-function[1388]@[wasm code]
<?>.wasm-function[1071]@[wasm code]
<?>.wasm-function[5013]@[wasm code]
<?>.wasm-function[247]@[wasm code]
<?>.wasm-function[3208]@[wasm code]
<?>.wasm-function[2227]@[wasm code]
<?>.wasm-function[4021]@[wasm code]
<?>.wasm-function[5629]@[wasm code]
wasm-stub@[wasm code]
invoke_viiiiii@node_modules/.pnpm/@[email protected]/node_modules/@electric-sql/pglite/dist/index.js:3:237720
wasm-stub@[wasm code]
<?>.wasm-function[4022]@[wasm code]
<?>.wasm-function[6293]@[wasm code]
<?>.wasm-function[11031]@[wasm code]
wasm-stub@[wasm code]
11031@[native code]
invoke_v@node_modules/.pnpm/@[email protected]/node_modules/@electric-sql/pglite/dist/index.js:3:237433
wasm-stub@[wasm code]
<?>.wasm-function[9372]@[wasm code]
wasm-stub@[wasm code]

HexMox avatar Jul 24 '25 06:07 HexMox

+1 on this, can't get it to work on safari. it errors saying Out of memory

vasyaqwe avatar Nov 26 '25 21:11 vasyaqwe