[HN Gopher] PGlite - Postgres in WASM
       ___________________________________________________________________
        
       PGlite - Postgres in WASM
        
       Author : samuba
       Score  : 76 points
       Date   : 2024-02-23 06:00 UTC (17 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | erichocean wrote:
       | This seems possible due to the separation of Postgres storage and
       | compute work done by Neon?
        
         | thruflo wrote:
         | Yup, this is based on work by Neon. Also the Neon model allows
         | you to sync in a database on demand, whilst scaling to zero
         | when you're not using it.
        
       | andrenotgiant wrote:
       | How is this different than the one done by CrunchyData here
       | https://www.crunchydata.com/blog/crazy-idea-to-postgres-in-t...
        
         | thruflo wrote:
         | The previous PG WASM projects from Crunchy and Snaplet have run
         | Postgres in a VM and required a large 32MB download.
         | 
         | This is pure WASM, no VM, 3.7MB download. Plus it has
         | persistent storage.
        
       | nalgeon wrote:
       | Fitting PostgreSQL into a 12MB binary with a simple API is
       | amazing!
       | 
       | I was so excited to try it out it that I just released an in-
       | browser PostgreSQL playground on top of PGlite.
       | 
       | It's also open source and easy to integrate:
       | 
       | https://codapi.org/postgres-pglite
        
         | vbalegas wrote:
         | Awesome! Will check it out
        
       | ejb999 wrote:
       | Interesting that it could be done at all - but having a hard time
       | coming up with any real world use cases for this. Are there any?
        
         | throwaway92374 wrote:
         | It can persist data to indexedDB, so web applications can use
         | it if they want a more flexible alternative
        
           | creatonez wrote:
           | That's neat, I wonder what the overhead is though.
        
         | tjelen wrote:
         | Code testing is a big one for me. I'm currently using in-memory
         | sqlite for tests and I'm often running into differences between
         | sqlite and postgres (default values, JSON handling, etc). This
         | could allow me to use the real thing without running a full
         | Docker instance.
        
         | amcaskill wrote:
         | I think performance and cost are the big motivators here.
         | 
         | I work on a web framework for building data apps like reports
         | and dashboards, and we use duckDB's WASM runtime for
         | interactions (e.g when a user changes a date range filter).
         | It's really fast, and you don't spend snowflake credits.
        
       | tyrauber wrote:
       | This is awesome. Are extensions like PostGIS supported? I wish
       | react-native natively supported WASM. It would be cool to run
       | this client-side instead of sqlite.
        
         | nilslice wrote:
         | join us on the Extism discord https://extism.org/discord, we're
         | working on some things that will enable this. would love to
         | hear what you're thinking!
        
       | philippemnoel wrote:
       | This is super cool. Postgres is slowly overlapping on every part
       | of the data stack, even SQLite isn't safe!
        
       | dang wrote:
       | Related (but different):
       | 
       |  _Postgres WASM_ - https://news.ycombinator.com/item?id=33067962
       | - Oct 2022 (185 comments)
        
       ___________________________________________________________________
       (page generated 2024-02-23 23:02 UTC)