News for hackers. Stuff that matters.
Re:Bye Bye Mongo, Hello Postgres by pjmlp on Wednesday December 19, 2018 @02:20PM (#18718503)
Fashion driven development and not understanding how to actually make use of SQL.
Re:Bye Bye Mongo, Hello Postgres by KaiserPro on Wednesday December 19, 2018 @04:16PM (#18719727)
At "large financial news company" we had a "designed for the CV" tag that applied to stupid architectural decisions (of which there were many)

One of the biggest and most expensive was using Cassandra to store membership details. Something like 4 years of work, by a team of 40, wasted by stupid decisions.

They included: o Using Cassandra to store 6 million rows of highly structured, mostly readonly data

  o hosting it on real tin, expensive tin, in multiple continents (looking at >million quid in costs)

  o writing the stack in java, getting bored, re-writing it as a micro service, before actually finishing the original system

  o getting bored of writing micro services in java, switching to scala, which only 2/15 devs knew.

  o writing mission critical services in elixir, of which only 1 dev knew. 

  o refusing to use other teams tools

  o refusing to use the company wiki, opting for thier own confluence instance, which barred access to anyone else, including the teams they supported
Re:Bye Bye Mongo, Hello Postgres by setquk on Wednesday December 19, 2018 @05:16PM (#18720317)
I think the worst place I ever worked was like that. Was going back quite a number of years now but it was a startup fired up by a one of the lesser MBAs to utilise a legal loophole to slice cash off the public via a web app and a metric ton of marketing to desperate people.

Step one was hire everyone the guy had worked with at his previous company. They were all winforms / excel / SQL / sharepoint / office developers from big finance and had no idea where to go really. None of them had even touched asp.net.

Cue "what's popular". Well that was Ruby on Rails back then on top of MySQL and Linux. 4 people with zero experience pulled this stack in and basically wrote winforms on top of it. Page hits were 5-8 seconds each. Infrastructure was owned by SSH worms and they hadn't even noticed.

I think I lasted two days there before I said "I'm done".

Re:Bye Bye Mongo, Hello Postgres by fujimotos on Saturday December 22, 2018 @10:11AM (#18740864)
I once saw a CEO who wrote his own Web Framework and forced the entire company to use it.

At the time, under the influence of React, the idea was to "build web application sorely based on Functional Programming". Since after years of trying no one could figure out what that meant, the company ditched the CEO and ended up wasting a couple years of work.

Re:Bye Bye Mongo, Hello Postgres by thawkins on Wednesday December 19, 2018 @07:58PM (#18721593)
RDD, resume driven development....
Re:Bye Bye Mongo, Hello Postgres by qaq on Wednesday December 19, 2018 @04:28PM (#18719847)
well Elixir might have being a good decisions :)
Re:Bye Bye Mongo, Hello Postgres by KaiserPro on Wednesday December 19, 2018 @04:46PM (#18720026)
only if more than 0.3% of your workforce know it....
Re:Bye Bye Mongo, Hello Postgres by michaelcampbell on Wednesday December 19, 2018 @07:10PM (#18721285)
And thus, nothing new was ever developed again.
Re:Bye Bye Mongo, Hello Postgres by bunderbunder on Wednesday December 19, 2018 @08:35PM (#18721793)
It's not that you don't write anything in a new thing. It's that you start with small, less critical projects. Get your feet wet, give people a chance to get a feel for the pros and cons, that sort of thing.

Jumping right into writing "mission critical services" in the brand new language that few people at the company know well is asking for trouble.

Re:Bye Bye Mongo, Hello Postgres by KaiserPro on Thursday December 20, 2018 @04:49AM (#18723618)
There is a time and place for new. This isn't it.

there were no problems of scale, speed or latency. It was migrating from one terrible system to something that should be smaller, simpler, cheaper and easier to run.

The API is/was supposed to do precisely four things:

  o provide an authentication flow for customers
  0 provide an authentication flow for enterprises to allow SSO
  o handle payment info
  o count the number of articles read for billing/freemium/premium
That is all. Its a solved problem. Don't innovate, do.

Spend the time instead innovating on the bits that are useful to the business and provide an edge: CRM, pattern recognition and data analytics.

Re:Bye Bye Mongo, Hello Postgres by Noumenon72 on Wednesday December 19, 2018 @11:37PM (#18722545)
"real tin"?
Re:Bye Bye Mongo, Hello Postgres by theshrike79 on Sunday December 23, 2018 @08:03AM (#18745843)
Actual physical hardware, bought by the company and installed in a rack somewhere.

Not ephemeral Cloud Stuff rented from some company.

Re:Bye Bye Mongo, Hello Postgres by perfunctory on Wednesday December 19, 2018 @02:30PM (#18718611)
Reminds me of

“The computer industry is the only industry that is more fashion-driven than women’s fashion.” — Larry Ellison

Re:Bye Bye Mongo, Hello Postgres by SllX on Wednesday December 19, 2018 @02:45PM (#18718798)
This actually resonates with me, maybe not in the way Ellison intended as I’m not familiar with the context he said it in. A bit off the main topic but the more I revert to just using emacs for some task I previously used a .app bundle or web page for, the more I question how much we the computer industry has just been spinning its wheels for the last 30+ years. I honestly can’t really tell what value WIMP-centric GUIs have brought to the table besides fashion, let alone the endless debates in the form of actual implementations about the best way to build one. Possibly the best argument ever made died with Mac OS 9.

I suspect that in a year I’ll be using what is effectively an Elisp machine with an Apple logo paired with an iPhone.

Re:Bye Bye Mongo, Hello Postgres by jandrese on Wednesday December 19, 2018 @05:02PM (#18720164)
Discoverability and self documentation is generally the advantage of GUI systems. Well built systems can be understood in a few moments without needing to consult a manual. That's almost impossible in a pure CLI environment.

Of course it's entirely possible to screw this up, modern phone-centric design standards are really bad about it for example, but in general you need to consult the manual (or Google) far less often.

Re:Bye Bye Mongo, Hello Postgres by SllX on Thursday December 20, 2018 @09:53PM (#18731114)
I’m not convinced these are inherent properties of GUIness. We have had GUIs in use for long enough that many elements even across slightly different GUIs are familiar enough, this had allowed conventions and then conventional wisdom to develop.

Early GUI developers also put effort into making their GUIs at least somewhat intuitive, but they also bundled thick books of documentation on how to use their systems.

To a degree, they are self-documenting, but not because of their GUIness so much as their design choices; menus helped a lot with this. Menus actually are a good subject to touch upon, they are definitely one of the better conventions we developed, and they were based upon and analogous to a restaurant menu. However their very nature as a list of commands you can issue a GUI does also typically but not always, limit the application. If the only options available to you are what is on the menu and there is no other interface, then an application is much more limited. This isn’t even true of most restaurants which will often allow you to issue an order for something not on the menu if they have the ingredients, equipment and expertise to make it.

But as a convention, it is not limited solely to GUIs, you can incorporate menus into any interactive interface.

I think the real innovation wasn’t GUIs, it was interactive software. The innovation beyond that is scriptable software.

What is important isn’t GUIness, but the developer’s intent. If you develop software with the intent to be self-documenting and discoverable, you will end up with an interface that is both of these things provided you did a competent job of it. A GUI might help, relying on platform conventions might help, and using common cultural conventions might help, but these aren’t the necessary ingredients for those qualities.

Emacs has the quality of self-documentation, but it is emphatically not a GUI even though it is interactive.

I would say well built systems, provided you intend to do anything productive and even slightly complex, should have a manual included, or else it isn’t a well built system.

Re:Bye Bye Mongo, Hello Postgres by jfb on Wednesday December 19, 2018 @03:28PM (#18719237)
> I suspect that in a year I’ll be using what is effectively an Elisp machine with an Apple logo paired with an iPhone.

It's been working for me for quite a while now. And it's depressing, but here we are.

Re:Bye Bye Mongo, Hello Postgres by SllX on Thursday December 20, 2018 @09:58PM (#18731134)
It isn’t all bad. My laptop is 6, almost 7 years old at this point and it has received a few upgrades in that time. This change in habits does lower the minimum system requirements for its eventual replacement from “runs Mac OS X” to “runs emacs”, but I might be able to stretch its life out a bit longer now.
Re:Bye Bye Mongo, Hello Postgres by romeisendcoming on Wednesday December 19, 2018 @09:37PM (#18722049)
vi, cvs|svn, C, bash, awk,sed, python and tcl. Linux (rpm based) or FreeBSD. Firefox or lynx. Haven't changed much in 20 years.
Re:Bye Bye Mongo, Hello Postgres by chrisoverzero on Wednesday December 19, 2018 @10:01PM (#18722167)
> I honestly can’t really tell what value WIMP-centric GUIs have brought to the table besides fashion […]

Literal billions of users.

Re:Bye Bye Mongo, Hello Postgres by SllX on Friday December 21, 2018 @10:42AM (#18733959)
Billions of users of which things that are worthwhile?
Re:Bye Bye Mongo, Hello Postgres by untog on Wednesday December 19, 2018 @02:38PM (#18718711)
IMO there is still a place for schema-less document databases. It's just that Postgres's JSON columns mean you can get the best of both worlds, which makes Mongo look weak by comparison.
Re:Bye Bye Mongo, Hello Postgres by da_chicken on Wednesday December 19, 2018 @04:16PM (#18719721)
I would rather say, "Postgres's JSONB provides a hybrid compromise that may meet the needs of many users." JSONB feels like it's closer to creating more complex data types that are less primitive than those that SQL currently allows.

The real driver of the NoSQL movement, I believe, was that everybody wanted to be the next big social network or content aggregation site. Everybody wanted to be the next Facebook, Instagram, Twitter, etc. and that's what people were trying to build. Ginormous sites like these are are one of the applications that strongly favors availability/eventual consistency over guaranteed consistency, whereas most other applications are quite the opposite.

Nobody really cares if your Instagram post shows up 10 minutes later in New York than it does in LA, and certainly not if the comments appear in similarly inconsistent order. It's one step above best-effort delivery. However, your bank, hospital, etc. often care quite a bit that their systems always represent reality as of right now and not as of half an hour ago because there's a network problem in Wichita.

The question is, "If my data store isn't sure about the answer it has, what should it do?" RDBMS says, "Error." NoSQL says, "Meh, just return what you have."

Re:Bye Bye Mongo, Hello Postgres by bunderbunder on Wednesday December 19, 2018 @04:40PM (#18719969)
> The question is, "If my data store isn't sure about the answer it has, what should it do?" RDBMS says, "Error." NoSQL says, "Meh, just return what you have."

Even that's too simplistic. For most RDBMSes, the answer depends on how you have it configured, and usually isn't "Error". If you're using a serializable transaction isolation level, it usually means, "you might have to wait an extra few milliseconds for your answer, but we'll make sure we get you a good one." Other isolation levels allow varying levels of dirty reads and race conditions, but typically won't flat out fail the query. This is probably the situation most people are working under, since, in the name of performance, very few RDBMSes' default configurations give you full ACID guarantees.

To the "DB in NY knows something different from DB in LA" example, there are RDBMSes such as the nicer versions of MSSQL that allow you to have a geographically distributed database with eventual consistency among nodes. They're admittedly quite expensive, but, given some of the stories I've heard about trying to use many NoSQL offerings at that kind of scale, I wouldn't be surprised if they're still cheaper if you're looking at TCO instead of sticker price.

Re:Bye Bye Mongo, Hello Postgres by ownagefool on Thursday December 20, 2018 @06:05AM (#18723918)
This likely isn't true for banking systems.

Many ATMs will still give you money when they're offline, and things become eventually consistent by comparing the ledger.

Shops also generally want to take orders and payments irregardless of the network availability, so whilst they might generally act as CP systems, they'll be AP in the event of network downtime, but will likely lose access to fraud checks, so may put limits of purchases, etc.

They're probably all CP locally and AP (or switchable from CP) from an entire system perspective.

Re:Bye Bye Mongo, Hello Postgres by arkh on Wednesday December 19, 2018 @06:49PM (#18721157)
I like the JSONB support. Not for storing data but to query it with shitty drivers.

Some array magic and jsonb_agg and suddenly you can get easy to json decode results instead of having to play with rows in your app. Yes you can also do it with xml_agg but these days people tend to consider anything xml as evil (they're wrong).

Re:Bye Bye Mongo, Hello Postgres by riteshpatel on Wednesday December 19, 2018 @04:41PM (#18719978)
I would say that development of JSON fields in Postgres and MySQL was accelerated by the adoption of Mongo.

Speed to market/first version using JSON stores is attractive, especially when you're still prototyping your product and won't have an idea of exact data structures until there's been some real world usage.

Re:Bye Bye Mongo, Hello Postgres by bunderbunder on Wednesday December 19, 2018 @02:24PM (#18718548)
It's amazing how many insurmountable SQL performance problems can be surmounted by putting things in 3rd normal form.
Re:Bye Bye Mongo, Hello Postgres by michelpp on Wednesday December 19, 2018 @02:31PM (#18718622)
That, and simply reading the documentation. N+1 problems and denormalization-by-design are a failure to understand SQL.
Re:Bye Bye Mongo, Hello Postgres by Scarbutt on Wednesday December 19, 2018 @02:44PM (#18718793)
But denormalization is one strategy to improve the performance of a rdbms.
Re:Bye Bye Mongo, Hello Postgres by bunderbunder on Wednesday December 19, 2018 @02:52PM (#18718878)
Standard rules about performance optimization apply. Denormalization can improve performance, but it can just as easily harm it.

For code, I think by now we all understand that you should always start with clean, well-factored code, and then optimize only as much as is necessary, which is usually not at all, and always under profiler guidance. It's the same with DBs: You start with a clean, well-normalized schema, and then de-normalize only as much as is necessary, which is usually not at all, and always under profiler guidance.

Also, keep in mind that improvements in compiler technology over time mean that the performance tricks of old can be useless or even actively harmful nowadays. This is true of SQL every bit as much as C.

Re:Bye Bye Mongo, Hello Postgres by trhway on Wednesday December 19, 2018 @03:19PM (#18719159)
Denormalization as way of dealing with performance issues is like guilottin to cure headache. And more frequently than not the headache is still there even after that.

It is true that for some narrow class of analytical workloads 20-25 years ago (behold BW of 199x) the denormalized case performance was better compare with straight non-optimized running of the same queries over normalized schema. Since then, the exponential availability of RAM and huge increase in streaming speed of HDD with stagnating IOPS (the main mistake in analytical workloads on HDD in the last 10-15 years - using nested loop join with indexed lookup into the large facts tables :) have made denormalization obsolete and harmful. If anything, the emergence of SSD and the huge RAMs moved things even further toward and beyond normalization, by making the "super-normalization", i.e. columnar tables, a viable everyday thing.

Re:Bye Bye Mongo, Hello Postgres by h1d on Wednesday December 19, 2018 @03:31PM (#18719271)
What do you suggest in place?
Re:Bye Bye Mongo, Hello Postgres by bunderbunder on Wednesday December 19, 2018 @03:51PM (#18719476)
I would suggest not denormalizing at all.

The idea that joins are slow is a holdover from the bad old days when everyone used MySQL and MySQL sucked at joins. On a more robust DBMS, a normalized schema will often yield better performance than the denormalized one. Less time will be lost to disk I/O thanks to the more compact format, the working set will be smaller so the DBMS can make more efficient use of its cache, and the optimizer will have more degrees of freedom to work with when trying to work out the most efficient way to execute the query.

(edited to add: If you're having performance problems with a normalized schema, the first place to look isn't denormalization, it's the indexing strategy. And also making sure the queries aren't doing anything to prevent proper index usage. Use the Index, Luke! is a great, DB-agnostic resource for understanding how to go about this stuff: https://use-the-index-luke.com )

Re:Bye Bye Mongo, Hello Postgres by manigandham on Wednesday December 19, 2018 @05:53PM (#18720688)
It's not, it's a strategy to improve the performance of a particular query or access pattern, and is usually the last resort after things like proper indexing, aggregations and materialized views.

JOINS are fast and it all comes down to how much data you're moving. If it's a large table joining to a small set of values, then the joined data is quickly retrieved and applied to the bigger table, with great performance.

If the join is between two large tables where every combination is unique then that's the unique case where the joined table is just adding another hop to get the full set of data for each row and is a perfect candidate for denormalization, although in that case it probably should've been a single table to begin with. Of course there's a spectrum between these two scenarios but it takes a lot before denormalization makes sense on any modern RDBMS.

Re:Bye Bye Mongo, Hello Postgres by jacques_chester on Wednesday December 19, 2018 @06:45PM (#18721124)
True, if

1. You start from a normalized schema.

2. You denormalize in a structured way (eg dimensional modelling), rather than any old how.

3. You test the change.

Database query planners work better when they can take logically-safe shortcuts in their work. In large part that comes down to a properly-constructed schema.

Denormalizing makes it harder for the query planner. It also means you will probably lose out on future query planner enhancements.

Generally speaking, if someone wants to denormalize, I want to know the actual business value created and that the business risk is properly understood.

Re:Bye Bye Mongo, Hello Postgres by jfb on Wednesday December 19, 2018 @03:28PM (#18719243)
Sure. But before one makes that argument, one must measure. It is not in any sense a panacea.
Re:Bye Bye Mongo, Hello Postgres by 0x54D5 on Wednesday December 19, 2018 @02:26PM (#18718569)
It turns out that not defining a structure to your model makes it easy to prototype but difficult to query the data afterwards.

Which is why MongoDB is awesome for teaching and building new stuff but horrible for reports, metrics, and scaling.

Re:Bye Bye Mongo, Hello Postgres by kages on Wednesday December 19, 2018 @02:49PM (#18718843)
Who said that they moved to relational model? They chose PostgreSQL because it's JSON support makes it also a superb document database.