4 ms·
I feel like MongoDB/NoSQL is a horse that's been beaten so much in the last few years that no one is actually making that choice nowadays. Hasn't everyone alrea
by elvinyung 9y ago
I feel like MongoDB/NoSQL is a horse that's been beaten so much in the last few years that no one is actually making that choice nowadays. Hasn't everyone already learned to stick with Postgres?
- StavrosK 9y agoUnfortunately, no. Some friends of mine picked another nonrel database (not Mongo) for their new company, which prompted this article. I still have to give this advice quite often.
- ohstopitu 9y agoI think that there are various reasons to pick DBs. Blindly picking a SQL DB (mysql/postgres etc.) is quite expensive from the get-go (a production ready mysql/postgres would cost ~30$/m). Mongo costs ~$10/m (MongoDB Atlas), Google's Datastore is Pay as you Go (so your initial cost is close to $0 till you get paying customers), AWS's DynamoDB is similarly priced as well. Sure, sadly all those noSQL solutions get really expensive as your usage goes up to normal non-webscale proportions, but at that point you have the $ to invest in a SQL solution. The above was mentioned with bootstrapped startups/services in mind. Not your usual million funded valley companies.
- StavrosK 9y agoHmm, how are you deploying things that a database costs $30/m? I just put it on the same server as the application worker and split it off if I need more performance later.
- ohstopitu 9y agomaybe I'm doing this wrong, but if I use RDS / Cloud SQL / Compose etc - a normal base cluster + another failover cluster + hourly/daily backups (based on your release schedule) all add up to around 30 - 50 based on various cloud providers.
- StavrosK 9y agoHmm, can't you just install a database on one of the servers and later migrate to one of the managed datastores if you need it? That migration should be pretty simple with minimal downtime.
- Kpourdeilami 9y agoYou can start with one server with postgres installed on it and when you need to scale to multiple application servers, you can run postgres on another server. For backing up postgres, all you have to do is setup a cron job that backs up the postgres' data directory to S3/Google Drive/Dropbox every hour/day. If you want proper replication and failover then you can probably use 2 digital ocean droplets each for $5/month and another $5 VM for the application server itself.
- BukhariH 9y agoI'm personally a fan of: https://www.heroku.com/postgres https://www.heroku.com/postgres Since it's free below 10K rows and only $9 for 10M. And, the dataclips feature always comes in handy.
- jandrese 9y ago$30/month doesn't seem "quite expensive" to me, not if it saves you a single hour of developer time each month. If that is breaking the bank then you're already in trouble. In the case of a company in heavy development mode you can run the database locally or on a cheap $5 VM. Databases are pretty easy to migrate around when they're not in production and can be taken offline.
- jlebrech 9y agosame thing goes with single page applications. i've haven't seen the benefit yet, a fast full stack app sprinkled with react/vue at the last minute does just as good a job.
- StavrosK 9y agoThose are more frequently useful, mainly for CRUD apps where you're changing a lot of state often and don't want to have to reload every time. I agree that for news-type sites, for example, they are overkill.
- spamizbad 9y agoMy condolences. I think one thing that's not mentioned enough in the SQL vs NoSQL debate is the benefit of powerful storage types. For example, when storing IP addresses in Postgres, you can use the inet datatype and easily query results if they fall within a given cidr range. Example: SELECT * FROM audits WHERE ip_address << '10.0.0.0/20' gives you any matching address between 10.0.0.1 and 10.0.15.254
- StavrosK 9y agoThat's one of the reasons why I love Postgres. Relatedly, people swear by PostGIS.
- maephisto 9y agoMongoDB/NoSQL is deployed and used at large scale by companies like Facebook, Ebay and many others. That's quite far from "no one is actually making that choice nowadays".
- wheaties 9y ago...and large companies still use stack ranking to judge whom of their employees to keep and which to fire. Just 'cause someone very big is doing it, doesn't mean it's right.
- StavrosK 9y agoUsing MongoDB/NoSQL for the parts of your data where it makes sense is one thing. Thinking "I'm starting a new accounting application, I'll just use Mongo as the datastore because it has better support for my stack" is another.
- Kpourdeilami 9y agoNoSQL is the most useful when you're dealing with event data which aren't the main part of the application. We use MongoDB for analytics on our API endpoints because storing that kind of data in postgres will add unnecessary bloat to it
- elvinyung 9y agoHi Kash. Genuinely curious, any other reason to choose MongoDB for analytics? It seems like a poor choice if you want expressive queries for data science. Why not just directly `COPY` your log files to something like Redshift?
- Kpourdeilami 9y agoHey! For convenience, mostly. We used to depend on Mixapanel for analytics and MongoDB was a good drop-in replacement with only 20-30 extra lines of code. I agree that Redshift would be a better choice for complicated queries afterwards but the only queries we run on the event data is looking up 2 events with the same "training_id" and calculate the time difference between their timestamps for billing purposes. The "important" events for data science are still stored on postgres (i.e. logins for checking if a login was malicious)
- cheapsteak 9y agoUnfortunately, the horse is not quite dead enough If anyone remembers the most prominent and convincing articles on this topic, I would love to share that with my team