-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client-side pglite struggles with large (~5000 row) import #568
Comments
Hey @lucasgelfond As you have spotted best way to solve this import is using the Alternatively, batching the inserts with multiple records per insert |
@samwillis Is there an example somewhere of using |
@treetopdevs we have an example here where we copy to a css and back again: https://github.com/electric-sql/pglite/blob/main/packages/pglite/examples/copy.html |
@samwillis thank you! Still some issues. I got the CSV import to work (after doing pgdump directly - Supabase's CSV encoding broke!), but I need to do in a temp table first. I benchmarked it, and it works alright: the CSV import is pretty quick (~4s), but it takes forever to copy the table over and convert to the correct types (~31s). When I try to do this without a temp table I always get errors, most commonly I figure a good workaround here is to do the (slow) CSV-import-with-temp-table once, and then load from tarball. I did Thanks again for your help! |
Happy to send code and/or data if you want to repro, I think this probably is actually a bug. I'm mostly working in https://github.com/lucasgelfond/semantic-whole-earth/blob/main/frontend/src/lib/setup.ts although this may change over the next few hours, can also try to more minimally repro any of these individual issues if helpfuL! |
Somewhat promising: if I do CSV import, but only import the |
Hi! Trying to push
pglite
to its limits, a bit—I want to do hybrid search (w/ embeddings + full-text) all client-side in the browser, on a ~5000 row table. The table has an 384-dimembedding
andfts
index on each, and I have tested this works. The real issue is wrangling initialization. The database lives in Supabase right now —I didn't want to bother with converting formats, so I just downloaded the full JSON, and imported row by row to pglite (takes ~2 mins) like this:My thought was this would be a quick stop-gap/MacGyver-y solution: do this once, save the pglite compatible tarball, and serve this (50MB) by CDN for users, which will make actual search very, very fast. My issue is that, while I am having no problem saving a tarball, I can't manage to quickly import it.
My import code has (for testing) consisted of a file input and then some logic to instantiate a new db.
The file seems to go through, etc, the problem is that I hang for several minutes (never gotten to completion!) on
await newDb.waitReady;
. It sounded like dev/blob was another option, but it's less immediately suitable for me because I'm using two tables (it's for a magazine:page
andissue
). This also proved more difficult than anticipated to get working. I guess one way I could do this would be to lock clients out for ~2 minutes and do that really slow manual loading, but this also seems quite sub-ideal. I followed the https://pglite.dev/examples/dump-data-dir example pretty much to a tee and still no luck. Happy to send over code and data to reproduce if helpful, there may also be some better way to do this?The text was updated successfully, but these errors were encountered: