Settings

Theme

QueryLeaf: SQL for Mongo

github.com

23 points by tilt 7 months ago · 17 comments

Reader

ttfkam 7 months ago

Would much rather have "Mongo" for SQL like this:

https://github.com/microsoft/documentdb

I am skeptical that SQL with Mongo backing it would be at all performant except in the most trivial cases. On the flip side, Postgres's jsonb indexing makes the inverse very doable.

  • VWWHFSfQ 7 months ago

    We're seeing a convergence of document DBs adding relational features, and relational DBs adding document features. At this point I find the best of both worlds to simply be PG with JSONB.

        create table document (
          id uuid primary key default gen_random_uuid(),
          doc jsonb
        );
    
    
    This alone will give you a huge number of the features that Mongo provides, but also the full power of Postgres for everything else.
    • victor106 7 months ago

      this makes so much sense.

      I also wonder if there are some specific capabilities of MongoDB that this pattern does not support?

      • etse 7 months ago

        Maybe not capabilities, but I'm wondering if Postgres has gotten any easier to scale horizontally. The administrative overhead of scaling and maintenance with MongoDB seemed lower to Postgres to me.

        Would love to hear from others with more Postgres than I.

        • ttfkam 7 months ago

          Excluding conversations about MongoDB compatibility, PG16 added bidirectional replication for multiple writers and there are Postgres-compatible options out there for a distributed database including Citus, EDB Postgres Distributed, Yugabyte, CockroachDB, Aurora Limitless, etc.

          The choices require some nuance to figure out a best fit, but then again so does any MongoDB installation (despite the marketing hype to the contrary as there are no free lunches).

          You might be surprised how far most folks can typically scale with just read replica(s) on a reasonably sized writer. Add in bidirectional replication for multiple writers, and you can go even further. Beyond that, even vanilla Postgres can do it, but you'll need to do some combinations of partitioning and foreign tables.

  • aleksi 7 months ago

    FerretDB v2 is built on top of this extension. See https://github.com/FerretDB/FerretDB

  • Zambyte 7 months ago
  • zareith 7 months ago

    Curious if there is something similar that works with sqlite.

sparky_ 7 months ago

I can appreciate the technical aspect of a translation layer, but I struggle to understand the use case for a tool like this. If your data is inherently relational, then you should be using a relational store anyway. And if it isn't, trying to hammer it on-demand into something that looks relational is going to eat you with performance implications. Unless I'm missing something.

gavinray 7 months ago

It's somewhat of a secret, but AWS's JDBC driver for DocumentDB supports Mongo as well

Let's you interact with Mongo as if it were a regular SQL JDBC database

https://github.com/aws/amazon-documentdb-jdbc-driver

gitroom 7 months ago

Honestly, putting Mongo and SQL together always confuses me a bit. I'm way more comfy with Postgres and jsonb. Anyone else feel like scaling Postgres is still kinda a pain?

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection