News for hackers. Stuff that matters.
Re:Goodbye Microservices: From 100s of problem children to 1... by craigc on Tuesday July 10, 2018 @03:37PM (#17501374)
Yup. Everyone wants to use the latest and greatest, but there is a reason that certain things like SQL have stood the test of time.

I think the same could be said of the design world. There was a time not too long ago when designs actually felt polished and had real shapes, shadows, gradients. When you clicked on a button you actually knew you were clicking on a button. Then iOS 7 came along and everything became white and flat and buttons were replaced with text with no borders. I think we are slowly moving back to where we were ten years ago.

PS How long until people start ditching React for jQuery?

Re:Goodbye Microservices: From 100s of problem children to 1... by chrisco255 on Tuesday July 10, 2018 @03:55PM (#17501507)
Ha, JQuery. I just had to look at a legacy JQuery code base...and I shudder the thought of ever going back to that paradigm. Sometimes new patterns/frameworks/architectures do really change the game for good.
Re:Goodbye Microservices: From 100s of problem children to 1... by timr on Tuesday July 10, 2018 @05:24PM (#17502316)
I still use jQuery regularly. It works well and doesn't get in the way. I'd rather work on a jQuery codebase written by a good engineer than a React codebase written by an average engineer, and there's no amount you could pay me to work on a Javascript codebase written by a bad engineer.

The problem you've identified is that most code, in general, is terrible. The code written by people who chase trends tends to be worse than average.

Re:Goodbye Microservices: From 100s of problem children to 1... by chrisco255 on Wednesday July 11, 2018 @12:17AM (#17504451)
I wouldn't. React makes it hard to FUBAR a front end. JQuery makes it stupidly easy to write a spaghetti code unmaintainable mess.
Re:Goodbye Microservices: From 100s of problem children to 1... by timr on Wednesday July 11, 2018 @12:34AM (#17504493)
React makes it easier for bad developers to do complicated things. They still end up writing spaghetti code.
Re:Goodbye Microservices: From 100s of problem children to 1... by chrisco255 on Wednesday July 11, 2018 @11:07PM (#17511893)
You literally can't write spaghetti code in React due to one-way data flow. That's what prevents the spaghetti. UI is a function of state and props. JQuery is an imperative DOM altering library that isn't even necessary with modern browsers.
Re:Goodbye Microservices: From 100s of problem children to 1... by timr on Friday July 13, 2018 @12:29PM (#17524368)
If I had a dollar for every person who told me that X prevents people from writing bad code, I wouldn't need to write code.
Re:Goodbye Microservices: From 100s of problem children to 1... by collyw on Wednesday July 11, 2018 @04:02AM (#17505219)
> The code written by people who chase trends tends to be worse than average.

This. Instead of learning a handfull of technologies well they learn a lot of technologies very poorly. If I am hiring I now look at it as a red flag when people have too many frameworks listed.

Re:Goodbye Microservices: From 100s of problem children to 1... by collyw on Wednesday July 11, 2018 @04:00AM (#17505207)
I have an angular codebase to maintain, on Angular 1.3 - probably when it was peak of the hype cycle. Its a spaghetti mess. Using a different framwork doesn't make you immune to these problems. Especially when people don't seem to understand the new tech especially well.
Re:Goodbye Microservices: From 100s of problem children to 1... by gbersac on Friday July 13, 2018 @09:22AM (#17522701)
Angular is not react.
Re:Goodbye Microservices: From 100s of problem children to 1... by pjmlp on Tuesday July 10, 2018 @04:13PM (#17501678)
Still doing jQuery with server side rendering, not bothering with React. Yep dinosaur here.
Re:Goodbye Microservices: From 100s of problem children to 1... by m-localhost on Tuesday July 10, 2018 @04:49PM (#17502028)
It's so nice to build something that works without JS in the first place and then just add some JS and CSS3 animations.
Re:Goodbye Microservices: From 100s of problem children to 1... by rhapsodic on Tuesday July 10, 2018 @05:56PM (#17502557)
>It's so nice to build something that works without JS in the first place and then just add some JS and CSS3 animations.

Yeah, but JS buys you a lot. There are certain things that you can accomplish with JS that you absolutely cannot accomplish without it.

OTOH, anything that you can accomplish with React, you can accomplish without React. I'm with the GP on that one.

Re:Goodbye Microservices: From 100s of problem children to 1... by pjmlp on Tuesday July 10, 2018 @05:52PM (#17502530)
Absolutely, then eventually sprinkle some PWA or Web Components stuff.
Re:Goodbye Microservices: From 100s of problem children to 1... by andrepd on Tuesday July 10, 2018 @03:57PM (#17501527)
Absolutely. The flat design thing is a pet peeve of mine.
Re:Goodbye Microservices: From 100s of problem children to 1... by zonkd1234 on Tuesday July 10, 2018 @04:30PM (#17501859)
I agree with what you are saying but you can't compare jQuery and React - they are very different tools.

If something works for you and makes life easier then you should use it. There is no right answer. You just need to be honest with yourself when planning things out - am I using this technology because it's new and shiny or because it is the right tool for the job right now.

Re:Goodbye Microservices: From 100s of problem children to 1... by craigc on Tuesday July 10, 2018 @04:33PM (#17501887)
> I agree with what you are saying but you can't compare jQuery and React - they are very different tools.

I am well aware. It was mostly a joke :]

Re:Goodbye Microservices: From 100s of problem children to 1... by acjohnson55 on Tuesday July 10, 2018 @06:43PM (#17502850)
You don't really need jQuery anymore, due to the browser APIs being far more mutually compatible and useful than a decade ago. So really it would be more like React vs vanilla JS. There's definitely a place for vanilla, when you just need minor dynamism on an otherwise basic UI.
Re:Goodbye Microservices: From 100s of problem children to 1... by amclennon on Tuesday July 10, 2018 @07:14PM (#17503025)
> You don't really need jQuery anymore, due to the browser APIs being far more mutually compatible and useful than a decade ago

You say that, but from time to time I still discover slight variations in browser behavior or bugs that were opened 8 years ago that would've been avoided if I had just used jQuery. Most modern frameworks will abstract away these differences, but sometimes you'll need to access the DOM directly.

Re:Goodbye Microservices: From 100s of problem children to 1... by jonny_eh on Tuesday July 10, 2018 @04:27PM (#17501829)
What does iOS's flat design have to do with jQuery?
Re:Goodbye Microservices: From 100s of problem children to 1... by craigc on Tuesday July 10, 2018 @04:33PM (#17501879)
It doesn’t. I was referring to the idea of new technologies eventually circling back to old and saying that I think that is true in the design world too.
Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Tuesday July 10, 2018 @03:56PM (#17501512)
The test of time isn't always a good metric. html, css and javascript is a huge hack, yet it has withstood the test of time.

SQL to me is a huge design flaw despite it's ubiquity. On the web bottlenecks happen at IO and algorithmic searches. Databases are essentially the bottlenecks of the web and how do we handle such bottlenecks? SQL; A high level almost functional language that is further away from the metal than a traditional imperative language. A select search over an index is an abstraction that is too high level to be placed over a bottleneck. What algorithm does a select search execute? Why does using select * slow down a query? Different permutations of identical queries causes slow downs or speed ups for no apparent reason in SQL. SQL is a leaky abstraction that has created a whole generation of SQL admins or people who memorize a bunch of SQL hacks rather than understand algorithms.

Re:Goodbye Microservices: From 100s of problem children to 1... by allwein on Tuesday July 10, 2018 @04:38PM (#17501925)
I strongly disagree with your assessment of SQL. All of the questions that you asked have actual answers, but I read (from what I perceive as your tone) that you think these are all mysteries generated by an unknowable black box. While some of them may be implementation dependent (like "What algorithm does a select search execute?"), others have common and knowable answers.

> Why does using select * slow down a query?

Because the database first has to perform a translation step to do an initial read from its system tables in order to enumerate the rows to be returned as a result of the final query.

> Different permutations of identical queries causes slow downs or speed ups for no apparent reason in SQL.

The key word there is "apparent", and again, just because it's not apparent to you, doesn't mean that it's not knowable and apparent to someone else. I also take exception to the concept of "permutations" of "identical" queries. Because if your query is permuted, it's no longer identical. The way you write your SQL has an impact on how it's evaluated. Just because you don't understand the rules, doesn't make it a mystery.

As a side note, I'd highly recommend reading up on the Relational Algebra that underpins SQL and other relational databases. https://en.wikipedia.org/wiki/Relational_algebra

Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Tuesday July 10, 2018 @08:05PM (#17503330)
Those are rhetorical questions. I ask them because these are questions you need to know in order to work well with SQL. I cannot become a master of SQL by only learning SQL. I have to learn the specific implementations, I have to run EXPLAIN... etc...

A good abstraction only requires you to know the abstraction not what lies underneath. What we have with SQL is a leaky abstraction. My argument that a high level leaky abstraction placed over a critical bottleneck in the web is a design mistake.

Re:Goodbye Microservices: From 100s of problem children to 1... by mrep on Wednesday July 11, 2018 @03:19AM (#17505031)
Lol, of course you need a general understanding of how your database works on the inside. There are a million different ways you can store your data and I would argue that choosing your data storage is the most important and tricky decision we have to make as software engineers.

Back at my first big tech company, I remember reading the best document I have ever read related to software engineering. It was entirely devoted to choosing your database/storage system. The very first paragraph of the document was entirely devoted to engraining in your head that "choosing a database is all about tradeoffs". They even had a picture where it just repeated that sentence over and over to really engrain it in you.

Why? Because every database has different performance characteristics such as consistency, latency, scalability, typing, indexing, data duplication and more. You really need to think about each and every one because choosing the wrong database/not using it correctly usually cause the biggest problems/most work to solve that you will ever have to face.

Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Wednesday July 11, 2018 @11:56AM (#17507899)
>Lol, of course you need a general understanding of how your database works on the inside. There are a million different ways you can store your data and I would argue that choosing your data storage is the most important and tricky decision we have to make as software engineers.

You aren't responding to my argument, everything you said is something I already know. So lol to you. You're making a remark and extending the conversation without addressing my main point. I'm saying that the fact that you need "a general understanding of how a database works on the inside" is a design flaw. It's a leaky abstraction.

A C++ for loop has virtually the same performance across all systems/implementations; if I learn C++ I generally don't need to understand implementation details to know about performance metrics. Complexity theory applies here.

For "SELECT * FROM TABLE", I have to understand implementation. This is a highly different design decision from C++. My argument is that this high level language is a bad design choice to be placed over the most critical bottleneck of the web: the database.

The entire reason why we can use slow ass languages like php or python on the web is because the database is 10x slower. Database is the bottleneck. It would be smart to have a language api for the database to be highly optimize-able. The problem with SQL is that it is a high level leaky abstraction so optimizing SQL doesn't involve using complexity theory to write a tighter algorithm. It involves memorizing SQL hacks and gotchas and understanding implementation details. This is why SQL is a bad design choice. Please address this reasoning directly rather than regurgitating common database knowledge.

Re:Goodbye Microservices: From 100s of problem children to 1... by bunderbunder on Wednesday July 11, 2018 @10:00PM (#17511661)
> A C++ for loop has virtually the same performance across all systems/implementations;

> For "SELECT * FROM TABLE", I have to understand implementation

This is not even remotely an apples-to-apples comparison. One is a fairly simple code construct that executes locally. The other is a call to a remote service.

It doesn't matter if the language you use to write it is XML, JSON, protocol buffers or SQL, any and all calls across an RPC boundary are going to have unknown performance characteristics if you don't understand how the remote service is implemented. If you are the implementer, and you still choose not to understand how it works, that's your choice, not the tool's. Every serious RDBMS comes with a TFM that you can R at any time. And there are quite a few well-known and product-agnostic resources out there, too, such as Use the Index Luke.

Alternatively, feel free to write your own alternative in C++ so that you can understand how it works in detail without having to read any manuals. It was quite a vogue for software vendors to sink a few person-years into such ventures back in the 90s. Some of them were used to build pretty neat products, too. Granted, they've all long since either migrated to a commodity DBMS or disappeared from the market, so perhaps we are due for a new generation to re-learn that lesson the hard way all over again.

Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Thursday July 12, 2018 @04:33AM (#17513034)
>This is not even remotely an apples-to-apples comparison. One is a fairly simple code construct that executes locally. The other is a call to a remote service.

>It doesn't matter if the language you use to write it is XML, JSON, protocol buffers or SQL, any and all calls across an RPC boundary are going to have unknown performance characteristics if you don't understand how the remote service is implemented.

Dude, then put your database on a local machine and execute it locally or do an http RPC call to your server and have the web app run a for loop. Whether it is a remote call or not the code gets executed on a computer regardless. This is not a factor. RPC is a bottleneck but that's a different type of bottleneck that's handled on a different layer. I'm talking about the slowest part of code executing on a computer not Passing an electronic message across the country.

So whether you use XML, JSON, or SQL it matters because that is the topic of my conversation. Not RPC boundaries.

>If you are the implementer, and you still choose not to understand how it works, that's your choice, not the tool's. Every serious RDBMS comes with a TFM that you can R at any time. And there are quite a few well-known and product-agnostic resources out there, too, such as Use the Index Luke.

I choose to understand a SQL implementation it because I have no choice. Like how a front end developer has no choice but to deal with the headache that is CSS or javascript.

Do you try to understand how C++ compiles down into assembler? For virtually every other language out there in existence I almost never ever have to understand the implementation to write an efficient algorithm. SQL DBs are the only technologies that force me to do this on a Regular Basis. Heck they even devoted a keyword called 'EXPLAIN' to let you peer under the hood. Good api's and good abstractions hide implementation details from you. SQL does not fit this definition of a good API.

If that doesn't stand out like a red flag to you, then I don't know what will.

>Alternatively, feel free to write your own alternative in C++ so that you can understand how it works in detail without having to read any manuals. It was quite a vogue for software vendors to sink a few person-years into such ventures back in the 90s. Some of them were used to build pretty neat products, too. Granted, they've all long since either migrated to a commodity DBMS or disappeared from the market, so perhaps we are due for a new generation to re-learn that lesson the hard way all over again.

In the 90s? Have you heard of NOSQL? This was done after the 90s and is still being done right now. There are alternative implementations to database API's that DON'T INVOLVE SQL. The problem isn't about re-learning, the problem is about learning itself. Learn a new paradigm rather than remark to every alternative opinion with a sarcastic suggestion: "Hey you don't like Airplanes well build your own Airplane then... "

Re:Goodbye Microservices: From 100s of problem children to 1... by mrep on Wednesday July 11, 2018 @09:05PM (#17511475)
> I'm saying that the fact that you need "a general understanding of how a database works on the inside" is a design flaw. It's a leaky abstraction.

And I just said that "choosing a database is all about tradeoffs" which you need to understand (aka: the leaky abstractions).

> A C++ for loop has virtually the same performance across all systems/implementations

> For "SELECT * FROM TABLE", I have to understand implementation.

No you don't, it has the same performance: a for loop. However, by grouping all of your data onto 1 server, for loops are much more costly than the likely orders of magnitude more regular servers you have than a database. Fortunately, your SQL database supports indexes which speed up those queries. Granted, I'm no database expert, but adding the right indexes and making sure your queries utilize them have solved pretty much every scaling problem I have thrown at them.

> It would be smart to have a language api for the database to be highly optimize-able. The problem with SQL is that it is a high level leaky abstraction so optimizing SQL doesn't involve using complexity theory to write a tighter algorithm. It involves memorizing SQL hacks and gotchas and understanding implementation details.

It is optimizable and 90% of those optimizations I have made simply involve adding an index and then running a few explains/tests to make sure you are using them properly.

If you'll only answer me this though, what database would you recommend than? I'm dying to know since you think you know better and google, a company that probably has more scaling problems than anyone else, doubled down on SQL with spanner which from what I have read, requires even more actual fine tuning.

Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Thursday July 12, 2018 @03:52AM (#17512912)
>And I just said that "choosing a database is all about tradeoffs" which you need to understand (aka: the leaky abstractions).

And I'm saying the tradeoff of using a leaky abstraction is entirely the wrong choice. A hammer vs a screwdriver each have tradeoffs but when dealing with a nail, use a hammer, when dealing with a screw use a screw driver. SQL is a hammer to a database screw.

>No you don't, it has the same performance: a for loop. However, by grouping all of your data onto 1 server, for loops are much more costly than the likely orders of magnitude more regular servers you have than a database.

See you don't even know what algorithm most SQL implementations use when doing a SELECT call. It really depends on the index but usually it uses an algorithm similar to binary search off of an index that is basically a binary search tree. It's possible to index by a hash map as well, but you don't know any of this because SQL is such a high level language. All you know is that you add an index and everything magically scales.

>Fortunately, your SQL database supports indexes which speed up those queries. Granted, I'm no database expert, but adding the right indexes and making sure your queries utilize them have solved pretty much every scaling problem I have thrown at them.

Ever deal with big data analytics? A typical SQL DB can't handle the million row multi dimensional group bys. Not even your indexes can save you here.

>It is optimizable and 90% of those optimizations I have made simply involve adding an index and then running a few explains/tests to make sure you are using them properly.

I don't have to run an EXPLAIN on any other language that I have ever used. Literally. There is no other language on the face of this planet where I had to regularly go down into the lower level abstraction to optimize it. When I do it's for a rare off case. For SQL it's a regular thing... and given that SQL exists at the bottleneck of all web development this is not just a minor flaw, but a huge flaw.

>If you'll only answer me this though, what database would you recommend than? I'm dying to know since you think you know better and google, a company that probably has more scaling problems than anyone else, doubled down on SQL with spanner which from what I have read, requires even more actual fine tuning.

I don't know if you're aware of CSS or javascript and the glaring flaws everybody complains about front end web development but it's a good analogy to what you're addressing here. Javascript and CSS are universally known to have some really stupid flaws yet both technologies are ubiquitous. No one can recommend any alternative because none exists. SQL is kind of similar. The database implementations and domain knowledge have been around so long that even alternative NO-SQL technologies have a hard time over taking SQL.

Which brings me full circle back to the front end. WASM is currently an emerging contender with javascript for the front end. Yet despite the fact that WASM has a better design then JS (not made in a week) current benchmarks against googles V8 javascript engine indicate that WASM is slower then JS. This is exactly what's going on with SQL and NO-SQL. Google hiring a crack team of genius engineers to optimize V8 for years turning a potato into a potato with a rocket booster has made the potato faster then a formula one race car (WASM)

Re:Goodbye Microservices: From 100s of problem children to 1... by hilbertseries on Wednesday July 11, 2018 @02:27PM (#17509101)
These problems are not unique to SQL, they are issues with any datastore. And if you're building your architecture correctly, the datastore is always going to be your bottleneck.
Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Wednesday July 11, 2018 @06:08PM (#17510662)
I'm not talking about solving the bottleneck. No api can change that. I'm talking about mitigating the effects of this bottleneck. Namely, SQL is a bad design decision for this area of web dev.
Re:Goodbye Microservices: From 100s of problem children to 1... by bunderbunder on Tuesday July 10, 2018 @04:19PM (#17501733)
One person's trash is another person's treasure.

Part of the reason SQL has stood the test of time is the very fact that it allows such a high level of abstraction. The big problem that it solved, compared to much of what existed at the time, was that it allowed you to decouple the physical format of the data from the applications that used it. That made it relatively easy to do two things that were previously very hard: Ask a database to answer questions it wasn't originally designed to answer, and modify a database's physical structure without having to change the code of every application that uses it.

A lot of "easier" technologies - including, arguably, ORM on top of relational databases - make things easier by sacrificing or compromising those very features that allow for such flexibility. Which speaks to the grandparent's point about technologies that make it easy to get started in the short term, at the cost of having major disadvantages in the long term.

Re:Goodbye Microservices: From 100s of problem children to 1... by JustSomeNobody on Tuesday July 10, 2018 @04:39PM (#17501934)
> Different permutations of identical queries causes slow downs or speed ups for no apparent reason in SQL.

EXPLAIN does a very good job of explaining why one query is faster than another.

> SQL is a leaky abstraction that has created a whole generation of SQL admins or people who memorize a bunch of SQL hacks rather than understand algorithms.

This just smacks of sound bite material.

Re:Goodbye Microservices: From 100s of problem children to 1... by tabtab on Tuesday July 10, 2018 @04:56PM (#17502072)
To misquote Winston Churchill, SQL is the worst data approach except for all others. As far as query languages, I'd like to see more language competition. I imagine it would take a decade or two to be competitive with SQL, which has a big head start. (I'm partial to SMEQL myself.)
Re:Goodbye Microservices: From 100s of problem children to 1... by xg15 on Tuesday July 10, 2018 @05:10PM (#17502211)
> A select search over an index is an abstraction that is too high level to be placed over a bottleneck.

The high-level was the point because, in the original idea, there was a separation of concerns assumed: The dev writes, in SQL, what the DB should do and the DBA decides how the DB does it.

Of course that assumes there is a competent DBA...

Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Wednesday July 11, 2018 @12:10PM (#17508003)
High level is a mistake because the slowest part of a web project is the database. It's the bottleneck of the web. The reason why we can use slow languages like python, php or ruby on the web rather than C++ is because the database is 10x slower.

Putting a high level leaky abstraction over the bottleneck of the web is a mistake. A language that is a zero cost abstraction is a better design choice.

Re:Goodbye Microservices: From 100s of problem children to 1... by ljw1001 on Tuesday July 10, 2018 @04:29PM (#17501850)
You've demonstrated above that using RDBMS and SQL involves making tradeoffs, like everything else. But you probably can't imagine a world without relational databases. I know I can't.

Many of the problems you mention above occur because the database handles stuff for programmers. Sure. you could create a custom solution around your biggest bottlenecks, but do you want to create a custom solution for every query, or do you want the database to do it for you. The generation of SQL admins is a replacement for a much larger group of programmers that would be needed if they weren't here, and more importantly, an army of people to deal with security, reliability, etc. that people using a good RDBMS get to take for granted.

Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Tuesday July 10, 2018 @08:11PM (#17503358)
I'm saying there could be another high level language that took the place of SQL. An imperative language with explicit algorithmic declarations. I'm not talking about custom solutions, I'm talking about how the web has evolved away from ideas that could have been better, because SQL to me is clearly not what I imagine to be the best we could possibly do for database queries. Same story with javascript and CSS.

which to you would be more clear?

SELECT * FROM TABLE WHERE id = 56

binary_search(column_name=id, value=56, show_all_columns=True)

Re:Goodbye Microservices: From 100s of problem children to 1... by shub on Wednesday July 11, 2018 @01:59AM (#17504746)
If deciding join order and what indexes to use sounds like your idea of a good time. It certainly isn't mine.
Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Wednesday July 11, 2018 @12:06PM (#17507979)
parameters could have default values or default heuristically chosen values if a default value isn't specified explicitly. Joins can be done imperatively as well. This leads to a language that is more clear and optimize-able by hand.

x = binary_search(column_name=id, value=56, show_all_columns=True)

y = dictionary_search(column_name=id, value=56, show_all_columns=True)

z = join(x, y, joinFunc=func(a,b)(a==b))

The example above could be a join. With the search function name itself specifying the index. If no such index is placed over the table it can throw an exception: "No Dictionary Index found on Table"

This is better api design. However, years of optimization and development on SQL implementations makes it so that most no-sql api's will have a hard time catching up to the performance of SQL. It's like googles V8. V8 is a highly optimized implementation of a terrible language (javascript) which is still faster than wasm.

Re:Goodbye Microservices: From 100s of problem children to 1... by xg15 on Wednesday July 11, 2018 @12:35PM (#17508236)
This is still a declarative language, just with the algorithms spelled out explicitly. (or some algorithms, as you didn't specify it for the join).

However, I think specifying the algorithms in the queries is really not a good idea. Your performance characteristics can change over time (or you might now know them at all yet when you start the project). With your solution, if you, e.g. realize later that it makes sense to add a new index, you'd have to rewrite every single query to use that index. With SQL, you simply add the index and are done.

Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Thursday July 12, 2018 @04:05AM (#17512951)
>This is still a declarative language, just with the algorithms spelled out explicitly. (or some algorithms, as you didn't specify it for the join).

Declarative yes, but unlike SQL my example is imperative. An imperative language is easier to optimize then a functional or even a expression based language (SQL) because computers are basically machines that execute imperative assembly instructions. This means the abstractions are less costly and have a better mapping to the underlying machine code.

>However, I think specifying the algorithms in the queries is really not a good idea. Your performance characteristics can change over time (or you might now know them at all yet when you start the project). With your solution, if you, e.g. realize later that it makes sense to add a new index, you'd have to rewrite every single query to use that index. With SQL, you simply add the index and are done.

Because the DB sits over a bottleneck in web development you need to have explicit control over this area of technology. If I need to do minute optimizations then am api should provide full explicit control over every detail. You should have the power to specify algorithms and the language itself should never hide from you what it's doing unless you tell choose to abstract that decision away...

What I mean by "choose to abstract that decision away" is that the language should also offer along with "binary_search" a generic "search" function as well, which can automatically choose the algorithm and index to use... That's right, by changing the nature of the API you can still preserve the high level abstractions while giving the user explicit access to lower level optimizations.

Or you can memorize a bunch of SQL hacks and gotchas and use EXPLAIN to decompile your query. I know of no other language that forces you to decompile an expression on a regular basis just to optimize it. Also unlike any other language I have seen literally postgres provides a language keyword EXPLAIN that allows users to execute this decompilation process as if they already knew SQL has this flaw. If that doesn't stand out like a red flag to you I don't know what will.

Re:Goodbye Microservices: From 100s of problem children to 1... by tabtab on Monday July 16, 2018 @06:37PM (#17545776)
One is going to need a way to debug and study ANY complex query for performance and bugs. EXPLAIN is a tool, not a crutch. "Dot-Chained" API's don't solve this by themselves. In bigger shops one typically has skilled DBA's who are good and quick at optimizing SQL anyhow because of their experience with it. An app-side programmer won't (or shouldn't) do this often enough to become a guru with query API optimization. Modern economies rely on specialization.
Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Monday July 16, 2018 @07:58PM (#17546194)
Read what I am writing. The fact that EXPLAIN is a tool means SQL is a crutch. No other language other than SQL needs this.
Re:Goodbye Microservices: From 100s of problem children to 1... by grzm on Monday July 16, 2018 @08:19PM (#17546293)
Ever profile an application? That's what EXPLAIN helps you with. SQL is different from a lot of languages in that it runs through query planner/executor, often based on properties of the actual data which change over time. Not a lot of other programs do this, and certainly not your typical imperative or procedural code. The JVM is one that comes to mind. Do you know of others?
Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Tuesday July 17, 2018 @01:09PM (#17551267)
I KNOW what it helps you with. No programming language has a keyword that decompiles expressions to their base components. Also profiling is only done when optimization is needed.

SQL on the otherhand... EXPLAIN is used on a regular basis, it's built in to the programming language and rather then just mark lines of code with execution time deltas it literally functions as a decompiler to deconstruct the query into another imperative language. This is the problem with SQL.

Re:Goodbye Microservices: From 100s of problem children to 1... by tabtab on Wednesday July 18, 2018 @02:59PM (#17561135)
Many application languages have "reflection" API's that can examine internal or low-level code structure. I used database languages such as dBASE (and clones) that are based on more or less on sequential query languages. While I did like more control over the intermediate steps, including the ability to analyze them; the problem is that different people do things too differently. SQL reigns in the "creativity" to a large extent. What works well for an individual may not scale to "team code". Working with a Picasso-coder's code can be a bear.
Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Thursday July 19, 2018 @01:50PM (#17568752)
This is a valid argument. A high level abstraction definitely serves as a restriction over code that gets to "creative" at the expense of obfuscation. Following this line of logic, the argument then truly does become apples to apples.
Re:Goodbye Microservices: From 100s of problem children to 1... by acjohnson55 on Tuesday July 10, 2018 @06:50PM (#17502885)
> But you probably can't imagine a world without relational databases. I know I can't.

Having worked on a couple projects that used Mongo at the core, I wish I could say the same.

Re:Goodbye Microservices: From 100s of problem children to 1... by rapind on Tuesday July 10, 2018 @06:51PM (#17502896)
SQL is declarative and functional. It's only a matter of time before it's the new hotness.
Re:Goodbye Microservices: From 100s of problem children to 1... by crimsonalucard on Thursday July 12, 2018 @04:06AM (#17512953)
SQL isn't turing complete.