Live data from Hacker News

Show HN: Mongita is to MongoDB as SQLite is to SQL

github.com

31–40 of 95 posts

Re: Show HN: Mongita is to MongoDB as SQLite is to SQL

#31

How can the benchmark show Mongita be around as fast as SQLite if SQLite is written in C and Mongita in Python? Genuine question!

It's a good question and to be accurate, depending on the benchmark, Mongita is about the same speed at SQLite to several-times slower.

There is less happening algorithmically than you would think. Where the tricky slow bits do exist, they have largely fallen into the happy-path of fast data structures in the Python language/stdlib. I also use sortedcontainers for indexes which helped quite a bit (http://www.grantjenks.com/docs/sortedcontainers/).

If you're curious, the benchmark code is in the repo: https://github.com/scottrogowski/mongita/blob/master/benchma...

Re: Show HN: Mongita is to MongoDB as SQLite is to SQL

#32
post #24

I'm looking for 'X' is to Neo4j as Sqlite is to SQL any suggestions for what project is X?

Assuming the main thing you want out of it is the Cypher language (surely that's the main thing?) it looks like there's nothing like that.

https://www.opencypher.org/projects

None of those appear to be a SQLite-like file-based embeddable database system.

Re: Show HN: Mongita is to MongoDB as SQLite is to SQL

#33
post #8

Earlier quoted context omitted.

I don't think it is whatever it's written in, because I can't imagine what it would mean? Unless there's a DBMS implementation called simply 'SQL' that I'm not aware of? (Or if Mongo calls its query language 'MongoDB'?) Seems like '.. to (My|Postgre)SQL' would be a better fit?

SQLite is a portable DBMS library that exposes a SQL language interface that is built and runs under every OS and language under the sun, for the most part. It is probably the single-most distributed library on the planet (in aggregate). And likely one of the most used libraries (top 10) on just about every given OS and platform/language. Mongita is only useful for Python developers.

I like sqlite and agree with your it should run everywhere to be compared.

I question that it is the most distributed library on the planet. Is there something backing that up? It would be cool but very shocking.

Re: Show HN: Mongita is to MongoDB as SQLite is to SQL

#34

Cool project but I have to admit I sure wish this was written on top of SQLite, rather than just mentioned it, implementing a query language shim for MongoDB on SQLite would be an amazing project. In the absence of such a project though, this is a pretty great alternative to have.

Funny enough I started something like that as a ruby library and stopped when I got to the query language shim because I just ran out of time and motivation. https://github.com/wa9ace/squongo

Re: Show HN: Mongita is to MongoDB as SQLite is to SQL

#36

> Mongita is to MongoDB as SQLite is to SQL it really isn't if it's written in python

Author here. My goal with that one-liner was to convey immediately what it is - an embedded database that implements the PyMongo/MongoDB API. Is it semantically perfect? Probably not. Will Mongita be useful to Python developers who are accustomed to saving their data in idiosyncratic JSON files because they don't want the overhead of a MongoDB server? Maybe! I hope so.

Thanks for sharing your project. It’s probably not a good comparison. SQLite is in such high esteem and such a well developed high quality mature product. So the comparison is sort of inviting criticism that gets in the way of people appreciating what is good about your project.

Re: Show HN: Mongita is to MongoDB as SQLite is to SQL

#38

Earlier quoted context omitted.

Author here. That's exactly it. I think it would be very difficult to completely beat SQLite with a Python library. My goal wasn't to beat it but to have performance that's within an order of magnitude which I think I've achieved. In my opinion, the MongoDB interface has a lot of advantages over SQL that make sense in a lot of use cases. Certainly, there are times when a traditional relational database is the right c…

Everyone is so overly critical in this thread. This is an excellent idea and your library is proof of concept. Surely one day performance can be improved in the future, and the core logic can be rewritten in a compiled language that can be used from other runtimes.

> Everyone is so overly critical in this thread.

The main criticism seems to be the flawed connection to sqlite. As useful as Mongita might be, and I don't think anyone is denying that this is good work, it doesn't make sense to compare it to sqlite.

Re: Show HN: Mongita is to MongoDB as SQLite is to SQL

#39
post #10

So, by their own benchmarks, unless you are doing totally random lookups of documents by identifier--and mostly reads, with very few writes--you should absolutely use SQLite with JSON values, which absolutely destroy this project in performance?...

The project isn't about performance, it's about providing an embedded version of MongoDB - it clearly states that if you grow too large, then you can easily migrate to the full MongoDB. It also clearly states not to use it if you want a relational database.

I am not even sure what is going on now, as I thought the only reason people had ever cared about MongoDB in the first place was in an attempt to get performance they thought was impossible using a relational database (notably without realizing all of the tradeoffs... some inexcusable, such as simply coming with defaults that didn't call fsync, leading to a ton of memes about "database administrators running with scissors" and years of having to convince people that MongoDB was only a project you use if you don't care about data).

The irony, of course, was that it turned out that if you used PostgreSQL and simply stored json in it, you could get better performance without giving up on a relational database... and even more damning was that the translation from MongoDB's query syntax to PostgreSQL's query syntax was trivial, leading to people building adapter layers that were drop-in compatible (and yet still faster and safer than MongoDB). So I guess there was something fitting about seeing someone post a project that is trying to the SQLite of MongoDB, but with benchmarks right off the bar showing it slower than SQLite ;P.

I thereby continue to feel that if you want to use MongoDB, but want a library version of it, it would seem--based on this project's own benchmarks, unless you are doing a read-heavy workload of random documents by index--that what you probably want is a query translator to go from MongoDB's syntax to SQL (working with the SQLite json API), and then store your workload in SQLite... which is (critically) a battle-tested production-grade database engine used as a foundational storage layer for lots of projects.

That said, it isn't like SQLite was a drop-in replacement for other database engines: when I think of "X is to SQLite as MongoDB is to PostgreSQL" I picture something that is attempting to being benefits over SQLite -- in way of performance or scalability -- at the cost of losing the power of being a full relational database (and, because of Mongo's legacy, probably a lot of safety and stability guarantees ;P). (FWIW, I remembered there's being a project like this: UnQLite-- https://news.ycombinator.com/item?id=18101689 --where people ironically seem to have wanted to get it benchmarked against SQLite with its json API ;P.)

It sounds like maybe this project is just trying to provide MongoDB's query layer? You simply don't use SQLite until you "migrate to the full PostgreSQL"... they are designed for different scenarios, and while SQLite is good enough you might be able to use it in a place where PostgreSQL "was called for", a migration might be brutal (as the syntax and type system are different). The project tagline is thereby leading to the wrong mental space--as seemingly multiple other people have since now mentioned on this thread--particularly given that it is written in Python.

Re: Show HN: Mongita is to MongoDB as SQLite is to SQL

#40
post #2

This would be super nice to have when developing mobile apps. I’ve used sqllite when developing with react-native, but can see myself using a mongita type solution.

If you’re already using JavaScript and you want an embeddable document database you could look at PouchDB.
Post reply on HN