pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedThe tragedy of SQL
61+ messages / 26 participants
[nested] [flat]
* The tragedy of SQL
@ 2021-09-14 05:31 Guyren Howe <guyren@gmail.com>
0 siblings, 3 replies; 61+ messages in thread
From: Guyren Howe @ 2021-09-14 05:31 UTC (permalink / raw)
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
A fun philosophical discussion.
I am no fan of “worse is better”, and particularly its poster child, SQL.
The world’s economic output would be substantially higher (5%?) if our industry had settled on almost anything other than SQL for relational databases.
So much of the design of *almost everything* in our industry is a reaction to SQL. ORMs fucking *everywhere* so you don’t have to use SQL. Bad query and database design. Inefficient system designs that use ORMs rather than relations. NoSQL databases. Countless hours on hours of developer time trying to work out how to write something in SQL that would be trivial in, say, Datalog.
If I had $5 million to invest in a startup, I would hire as many of the core Postgres devs as I could to make a new database with all the sophistication of Postgres but based on Datalog (or something similar). (Or maybe add Datalog to Postgres). If that could get traction, it would lead in a decade to a revolution in productivity in our industry.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 05:51 Guyren Howe <guyren@gmail.com>
parent: Guyren Howe <guyren@gmail.com>
2 siblings, 3 replies; 61+ messages in thread
From: Guyren Howe @ 2021-09-14 05:51 UTC (permalink / raw)
To: Hemil Ruparel <hemilruparel2002@gmail.com>; pgsql-general
They are making a decent decision. SQL is a *fucking terrible* language, which I don’t blame them for not wanting to learn.
The whole industry, programming languages, infrastructure, everything would have developed differently if relations were a natural, pleasurable thing to use in any programming language. Like an Array, or a Hash.
On Sep 13, 2021, 22:45 -0700, Hemil Ruparel <hemilruparel2002@gmail.com>, wrote:
> SQL is not the problem. Problem are the devs. I love SQL. I hate orms. The problem with databases is people refuse to treat it as the entity it is and want to use their beautiful OO system. Problem is databases are not OO. We need to recognize that and treat databases as databases.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 06:18 Rob Sargent <robjsargent@gmail.com>
parent: Guyren Howe <guyren@gmail.com>
2 siblings, 3 replies; 61+ messages in thread
From: Rob Sargent @ 2021-09-14 06:18 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/13/21 11:51 PM, Guyren Howe wrote:
> They are making a decent decision. SQL is a *fucking terrible*
> language, which I don’t blame them for not wanting to learn.
>
> The whole industry, programming languages, infrastructure, everything
> would have developed differently if relations were a natural,
> pleasurable thing to use in any programming language. Like an Array,
> or a Hash.
> On Sep 13, 2021, 22:45 -0700, Hemil Ruparel
> <hemilruparel2002@gmail.com>, wrote:
>> SQL is not the problem. Problem are the devs. I love SQL. I hate
>> orms. The problem with databases is people refuse to treat it as the
>> entity it is and want to use their beautiful OO system. Problem is
>> databases are not OO. We need to recognize that and treat databases
>> as databases.
All languages are fucking terrible. There are thousands of the them
because some people bump into a feature they don't like and run off an
make another fucking terrible language. For the love of God, please
don't be one of those people. The rest of us find languages we can
abide and do productive things with using features we like and avoiding
those we don't. I've always felt it was no small miracle the vendors
managed to agree to ODBC/JDBC driver specs (even though the SQL language
definition is "more like guidelines"). Go scream at the DOM and JavaScript.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 06:39 Raymond Brinzer <ray.brinzer@gmail.com>
parent: Rob Sargent <robjsargent@gmail.com>
2 siblings, 1 reply; 61+ messages in thread
From: Raymond Brinzer @ 2021-09-14 06:39 UTC (permalink / raw)
To: Rob Sargent <robjsargent@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Many languages are awesome. I'm always astonished at what great
things people have come up with, over the years; it's been a
wonderfully fertile field. We would certainly not be better off if
we'd just buckled down, and used COBOL and FORTRAN... or even
relatively good languages like C, APL, and Lisp.
It is certainly possible to change too lightly, for small reasons.
That doesn't mean that forever enduring the same problems is a good
idea.
On Tue, Sep 14, 2021 at 2:18 AM Rob Sargent <robjsargent@gmail.com> wrote:
>
> On 9/13/21 11:51 PM, Guyren Howe wrote:
>
> They are making a decent decision. SQL is a *fucking terrible* language, which I don’t blame them for not wanting to learn.
>
> The whole industry, programming languages, infrastructure, everything would have developed differently if relations were a natural, pleasurable thing to use in any programming language. Like an Array, or a Hash.
> On Sep 13, 2021, 22:45 -0700, Hemil Ruparel <hemilruparel2002@gmail.com>, wrote:
>
> SQL is not the problem. Problem are the devs. I love SQL. I hate orms. The problem with databases is people refuse to treat it as the entity it is and want to use their beautiful OO system. Problem is databases are not OO. We need to recognize that and treat databases as databases.
>
> All languages are fucking terrible. There are thousands of the them because some people bump into a feature they don't like and run off an make another fucking terrible language. For the love of God, please don't be one of those people. The rest of us find languages we can abide and do productive things with using features we like and avoiding those we don't. I've always felt it was no small miracle the vendors managed to agree to ODBC/JDBC driver specs (even though the SQL language definition is "more like guidelines"). Go scream at the DOM and JavaScript.
--
Ray Brinzer
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 12:13 Wim Bertels <wim.bertels@ucll.be>
parent: Raymond Brinzer <ray.brinzer@gmail.com>
0 siblings, 0 replies; 61+ messages in thread
From: Wim Bertels @ 2021-09-14 12:13 UTC (permalink / raw)
To: Guyren Howe <guyren@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Is it possible that this is mainly an emotional discussion?
Raymond Brinzer schreef op di 14-09-2021 om 02:39 [-0400]:
> Many languages are awesome. I'm always astonished at what great
> things people have come up with, over the years; it's been a
> wonderfully fertile field. We would certainly not be better off if
> we'd just buckled down, and used COBOL and FORTRAN... or even
> relatively good languages like C, APL, and Lisp.
>
> It is certainly possible to change too lightly, for small reasons.
> That doesn't mean that forever enduring the same problems is a good
> idea.
>
> On Tue, Sep 14, 2021 at 2:18 AM Rob Sargent <robjsargent@gmail.com>
> wrote:
> > On 9/13/21 11:51 PM, Guyren Howe wrote:
> >
> > They are making a decent decision. SQL is a *fucking terrible*
> > language, which I don’t blame them for not wanting to learn.
> >
> > The whole industry, programming languages, infrastructure,
> > everything would have developed differently if relations were a
> > natural, pleasurable thing to use in any programming language. Like
> > an Array, or a Hash.
> > On Sep 13, 2021, 22:45 -0700, Hemil Ruparel <
> > hemilruparel2002@gmail.com>, wrote:
> >
> > SQL is not the problem. Problem are the devs. I love SQL. I hate
> > orms. The problem with databases is people refuse to treat it as
> > the entity it is and want to use their beautiful OO system. Problem
> > is databases are not OO. We need to recognize that and treat
> > databases as databases.
> >
> > All languages are fucking terrible. There are thousands of the
> > them because some people bump into a feature they don't like and
> > run off an make another fucking terrible language. For the love of
> > God, please don't be one of those people. The rest of us find
> > languages we can abide and do productive things with using features
> > we like and avoiding those we don't. I've always felt it was no
> > small miracle the vendors managed to agree to ODBC/JDBC driver
> > specs (even though the SQL language definition is "more like
> > guidelines"). Go scream at the DOM and JavaScript.
>
>
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 12:49 Rich Shepard <rshepard@appl-ecosys.com>
parent: Guyren Howe <guyren@gmail.com>
2 siblings, 1 reply; 61+ messages in thread
From: Rich Shepard @ 2021-09-14 12:49 UTC (permalink / raw)
To: pgsql-general
On Mon, 13 Sep 2021, Guyren Howe wrote:
> They are making a decent decision. SQL is a *fucking terrible* language,
> which I don’t blame them for not wanting to learn.
>> SQL is not the problem. Problem are the devs. I love SQL. I hate orms.
>> The problem with databases is people refuse to treat it as the entity it
>> is and want to use their beautiful OO system. Problem is databases are
>> not OO. We need to recognize that and treat databases as databases.
Guyren/Hemil,
As a non-SQL expert who's used postgres since 1997 I've come to believe the
basic issue is that SQL is based on sets, neither procedural or object
oriented. Few people think in sets so they try to fit SQL into what they
know rather than understand the how sets work.
Rich
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 12:59 Bèrto ëd Sèra <berto.d.sera@gmail.com>
parent: Rich Shepard <rshepard@appl-ecosys.com>
0 siblings, 0 replies; 61+ messages in thread
From: Bèrto ëd Sèra @ 2021-09-14 12:59 UTC (permalink / raw)
To: ; +Cc: pgsql-general
>
> As a non-SQL expert who's used postgres since 1997 I've come to believe the
> basic issue is that SQL is based on sets, neither procedural or object
> oriented. Few people think in sets so they try to fit SQL into what they
> know rather than understand the how sets work.
>
Yes, that's 100% correct. As per the general discussion, it's not like WE
decide what language/tech will be used, or not. If a sufficient number of
customers begin to offer well paid jobs for <whatever>, we will see a huge
run to learn <whatever>, and that's about it. In the end we all work for
the money, and language X may be the eighth wonder of the entire galaxy,
but if it doesn't deliver well paid jobs, nobody will bother learning it.
my 5p.
Berto
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 13:06 Merlin Moncure <mmoncure@gmail.com>
parent: Guyren Howe <guyren@gmail.com>
2 siblings, 2 replies; 61+ messages in thread
From: Merlin Moncure @ 2021-09-14 13:06 UTC (permalink / raw)
To: Guyren Howe <guyren@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Tue, Sep 14, 2021 at 12:32 AM Guyren Howe <guyren@gmail.com> wrote:
> If I had $5 million to invest in a startup, I would hire as many of the core Postgres devs as I could to make a new database with all the sophistication of Postgres but based on Datalog (or something similar). (Or maybe add Datalog to Postgres). If that could get traction, it would lead in a decade to a revolution in productivity in our industry.
I've long thought that there is more algebraic type syntax sitting
underneath SQL yearning to get out. If you wanted to try something
like that today, a language pre-compiler or translator which converted
the code to SQL is likely the only realistic approach if you wanted to
get traction. History is not very kind to these approaches though and
SQL is evolving and has huge investments behind it...much more than 5
million bucks.
ORMs a function of poor development culture and vendor advocacy, not
the fault of SQL. If developers don't understand or are unwilling to
use joins in language A, they won't in language B either.
merlin
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 13:51 David Goodenough <david.goodenough@broadwellmanor.co.uk>
parent: Merlin Moncure <mmoncure@gmail.com>
1 sibling, 2 replies; 61+ messages in thread
From: David Goodenough @ 2021-09-14 13:51 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On Tuesday, 14 September 2021 14:06:13 BST Merlin Moncure wrote:
> On Tue, Sep 14, 2021 at 12:32 AM Guyren Howe <guyren@gmail.com> wrote:
> > If I had $5 million to invest in a startup, I would hire as many of the
> > core Postgres devs as I could to make a new database with all the
> > sophistication of Postgres but based on Datalog (or something similar).
> > (Or maybe add Datalog to Postgres). If that could get traction, it would
> > lead in a decade to a revolution in productivity in our industry.
> I've long thought that there is more algebraic type syntax sitting
> underneath SQL yearning to get out. If you wanted to try something
> like that today, a language pre-compiler or translator which converted
> the code to SQL is likely the only realistic approach if you wanted to
> get traction. History is not very kind to these approaches though and
> SQL is evolving and has huge investments behind it...much more than 5
> million bucks.
>
> ORMs a function of poor development culture and vendor advocacy, not
> the fault of SQL. If developers don't understand or are unwilling to
> use joins in language A, they won't in language B either.
>
> merlin
Back in the day, within IBM there were two separate relational databases. System-R
(which came from San Hose) and PRTV (the Peterlee Relational Test vehicle). As I
understand it SQL came from System-R and the optimizer (amongst other things) came
from PRTV.
PRTV (https://en.wikipedia.org/wiki/IBM_Peterlee_Relational_Test_Vehicle_(PRTV)[1]) did
not use SQL, and was never a released product, except with a graphical add-on which was
sold to two UK local authorities for urban planning.
So there are (and always have been) different ways to send requests to a relational DB, it is
just that SQL won the day.
--------
[1] https://en.wikipedia.org/wiki/IBM_Peterlee_Relational_Test_Vehicle_(PRTV)
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 14:01 Rob Sargent <robjsargent@gmail.com>
parent: David Goodenough <david.goodenough@broadwellmanor.co.uk>
1 sibling, 1 reply; 61+ messages in thread
From: Rob Sargent @ 2021-09-14 14:01 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
> > ORMs a function of poor development culture and vendor advocacy, not
>
> > the fault of SQL. If developers don't understand or are unwilling to
>
> > use joins in language A, they won't in language B either.
>
> >
>
> > merlin
>
> Back in the day, within IBM there were two separate relational
> databases. System-R (which came from San Hose) and PRTV (the Peterlee
> Relational Test vehicle). As I understand it SQL came from System-R
> and the optimizer (amongst other things) came from PRTV.
>
>
> PRTV
> (https://en.wikipedia.org/wiki/IBM_Peterlee_Relational_Test_Vehicle_(PRTV)
> <https://en.wikipedia.org/wiki/IBM_Peterlee_Relational_Test_Vehicle_(PRTV);)
> did not use SQL, and was never a released product, except with a
> graphical add-on which was sold to two UK local authorities for urban
> planning.
>
>
> So there are (and always have been) different ways to send requests to
> a relational DB, it is just that SQL won the day.
>
>
Ah, lets not forget Mr Lane's favourite: quel
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 14:05 DAVID ROTH <adaptron@comcast.net>
parent: David Goodenough <david.goodenough@broadwellmanor.co.uk>
1 sibling, 0 replies; 61+ messages in thread
From: DAVID ROTH @ 2021-09-14 14:05 UTC (permalink / raw)
To: David Goodenough <david.goodenough@broadwellmanor.co.uk>; pgsql-general@lists.postgresql.org
There was also QUEL. The original language for Ingress out of UCB.
> On 09/14/2021 9:51 AM David Goodenough <david.goodenough@broadwellmanor.co.uk> wrote:
>
>
> On Tuesday, 14 September 2021 14:06:13 BST Merlin Moncure wrote:
> > On Tue, Sep 14, 2021 at 12:32 AM Guyren Howe <guyren@gmail.com> wrote:
> > > If I had $5 million to invest in a startup, I would hire as many of the
> > > core Postgres devs as I could to make a new database with all the
> > > sophistication of Postgres but based on Datalog (or something similar).
> > > (Or maybe add Datalog to Postgres). If that could get traction, it would
> > > lead in a decade to a revolution in productivity in our industry.
> > I've long thought that there is more algebraic type syntax sitting
> > underneath SQL yearning to get out. If you wanted to try something
> > like that today, a language pre-compiler or translator which converted
> > the code to SQL is likely the only realistic approach if you wanted to
> > get traction. History is not very kind to these approaches though and
> > SQL is evolving and has huge investments behind it...much more than 5
> > million bucks.
> >
> > ORMs a function of poor development culture and vendor advocacy, not
> > the fault of SQL. If developers don't understand or are unwilling to
> > use joins in language A, they won't in language B either.
> >
> > merlin
> Back in the day, within IBM there were two separate relational databases. System-R (which came from San Hose) and PRTV (the Peterlee Relational Test vehicle). As I understand it SQL came from System-R and the optimizer (amongst other things) came from PRTV.
>
> PRTV (https://en.wikipedia.org/wiki/IBM_Peterlee_Relational_Test_Vehicle_(PRTV)) did not use SQL, and was never a released product, except with a graphical add-on which was sold to two UK local authorities for urban planning.
>
> So there are (and always have been) different ways to send requests to a relational DB, it is just that SQL won the day.
>
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 15:24 Merlin Moncure <mmoncure@gmail.com>
parent: Rob Sargent <robjsargent@gmail.com>
0 siblings, 0 replies; 61+ messages in thread
From: Merlin Moncure @ 2021-09-14 15:24 UTC (permalink / raw)
To: Rob Sargent <robjsargent@gmail.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>
On Tue, Sep 14, 2021 at 9:01 AM Rob Sargent <robjsargent@gmail.com> wrote:
> > ORMs a function of poor development culture and vendor advocacy, not
> > the fault of SQL. If developers don't understand or are unwilling to
> > use joins in language A, they won't in language B either.
>
> Back in the day, within IBM there were two separate relational databases. System-R (which came from San Hose) and PRTV (the Peterlee Relational Test vehicle). As I understand it SQL came from System-R and the optimizer (amongst other things) came from PRTV.
>
> PRTV (https://en.wikipedia.org/wiki/IBM_Peterlee_Relational_Test_Vehicle_(PRTV)) did not use SQL, and was never a released product, except with a graphical add-on which was sold to two UK local authorities for urban planning.
>
> So there are (and always have been) different ways to send requests to a relational DB, it is just that SQL won the day.
>
> Ah, lets not forget Mr Lane's favourite: quel
Sure, I quite like, er, liked quel also, being more mathematical and
formal. It's a shame it didn't make the cut. This is however a
telling example that standardization trumps purity once languages hit
a certain spot. There are many languages with dumb things that will
never get fixed :-). As they say, 'the devil you know'.
QUEL also uses idiomatic english for most operations, which I guess is
probably a contributing factor for developer resistance to SQL, since
native speakers are a minority of the earth's population. Oh well.
merlin
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 16:10 Michael Nolan <htfoot@gmail.com>
parent: Rob Sargent <robjsargent@gmail.com>
2 siblings, 4 replies; 61+ messages in thread
From: Michael Nolan @ 2021-09-14 16:10 UTC (permalink / raw)
To: Rob Sargent <robjsargent@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
I started programming in 1967, and over the last 50+ years I've programmed
in more languages than I would want to list. I spent a decade writing in
FORTRAN on a GA 18/30 (essentially a clone of the IBM 1130) with limited
memory space, so you had to write EFFICIENT code, something that is a bit
of a lost art these days. I also spent a decade writing in COBOL.
I've not found many tasks that I couldn't find a way to write in whatever
language I had available to write it in. There may be bad (or at least
inefficient) languages, but there are lots of bad programmers.
--
Mike Nolan
htfoot@gmail.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 16:20 Rob Sargent <robjsargent@gmail.com>
parent: Michael Nolan <htfoot@gmail.com>
3 siblings, 2 replies; 61+ messages in thread
From: Rob Sargent @ 2021-09-14 16:20 UTC (permalink / raw)
To: Michael Nolan <htfoot@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On 9/14/21 10:10 AM, Michael Nolan wrote:
> I started programming in 1967, and over the last 50+ years I've
> programmed in more languages than I would want to list. I spent a
> decade writing in FORTRAN on a GA 18/30 (essentially a clone of the
> IBM 1130) with limited memory space, so you had to write EFFICIENT
> code, something that is a bit of a lost art these days. I also spent
> a decade writing in COBOL.
>
> I've not found many tasks that I couldn't find a way to write in
> whatever language I had available to write it in. There may be bad (or
> at least inefficient) languages, but there are lots of bad programmers.
> --
> Mike Nolan
> htfoot@gmail.com <mailto:htfoot@gmail.com>
OK, I'm maybe responsible for this thread turning into a diatribe. I
shouted at OP 'cause he shouted at us. My mistake, and I apologize.
I'm probably closer to Mike's "bad programmers" than I would care to
admit but fully believe software is a "people problem" more than most of
us realize.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 16:30 Scottix <scottix@gmail.com>
parent: Rob Sargent <robjsargent@gmail.com>
1 sibling, 0 replies; 61+ messages in thread
From: Scottix @ 2021-09-14 16:30 UTC (permalink / raw)
To: Rob Sargent <robjsargent@gmail.com>; +Cc: Michael Nolan <htfoot@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
It is kind of a purists fallacy. Point being if you could just write ASM
code it would be the best.
When in reality, a database is used not because it is the best technical
database, but is used by many people. Something that other developers can
pickup and use without reading a 200 page manual and study for a year on
end. Although maybe stuff would be better if everyone did that, on the
other hand might just be wasted effort.
You complain about no-SQL database but actually then advocate for it, by
saying SQL is sad. I find Postgres as a traditional RDB and has specific
use cases. If you compare that to Clickhouse which has a very different use
case. Don't compare timeseriesdb, because even that has limitations that
clickhouse surpasses at scale. Just an example of a no-SQL database.
If you do start a new database, let me know. I would like to see that in
action.
On Tue, Sep 14, 2021 at 9:20 AM Rob Sargent <robjsargent@gmail.com> wrote:
> On 9/14/21 10:10 AM, Michael Nolan wrote:
>
> I started programming in 1967, and over the last 50+ years I've programmed
> in more languages than I would want to list. I spent a decade writing in
> FORTRAN on a GA 18/30 (essentially a clone of the IBM 1130) with limited
> memory space, so you had to write EFFICIENT code, something that is a bit
> of a lost art these days. I also spent a decade writing in COBOL.
>
> I've not found many tasks that I couldn't find a way to write in whatever
> language I had available to write it in. There may be bad (or at least
> inefficient) languages, but there are lots of bad programmers.
> --
> Mike Nolan
> htfoot@gmail.com
>
> OK, I'm maybe responsible for this thread turning into a diatribe. I
> shouted at OP 'cause he shouted at us. My mistake, and I apologize.
> I'm probably closer to Mike's "bad programmers" than I would care to admit
> but fully believe software is a "people problem" more than most of us
> realize.
>
--
Scottix@Gmail.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 16:56 Bret Stern <bret_stern@machinemanagement.com>
parent: Michael Nolan <htfoot@gmail.com>
3 siblings, 0 replies; 61+ messages in thread
From: Bret Stern @ 2021-09-14 16:56 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
I didn't start in 1967, but 1984, I'm in agreement with the bad
programmers premise. Since the beginning there have always been
lots of languages. It is my opinion, the more languages and concepts you
know the better your success on the project.
Heck I didn't use triggers till late 90's, funny thing I have a PICK
project right now.. too much fun
On 9/14/2021 9:10 AM, Michael Nolan wrote:
> I started programming in 1967, and over the last 50+ years I've
> programmed in more languages than I would want to list. I spent a
> decade writing in FORTRAN on a GA 18/30 (essentially a clone of the
> IBM 1130) with limited memory space, so you had to write EFFICIENT
> code, something that is a bit of a lost art these days. I also spent
> a decade writing in COBOL.
>
> I've not found many tasks that I couldn't find a way to write in
> whatever language I had available to write it in. There may be bad (or
> at least inefficient) languages, but there are lots of bad programmers.
> --
> Mike Nolan
> htfoot@gmail.com <mailto:htfoot@gmail.com>
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 17:53 Raymond Brinzer <ray.brinzer@gmail.com>
parent: Rob Sargent <robjsargent@gmail.com>
1 sibling, 1 reply; 61+ messages in thread
From: Raymond Brinzer @ 2021-09-14 17:53 UTC (permalink / raw)
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
This is a subject which is important to me, but I find discussing it
often goes poorly. Most people (not necessarily those on this list)
don't distinguish between SQL and the relational model. When you
criticize SQL the language, people tend to defend relational
databases; when you praise relational databases, people have a
visceral reaction to SQL.
There also seems to be a divide between people who use languages to
express their thoughts, with the expectation that their thoughts will
be implemented, and those who regard a language merely as an interface
for manipulating an underlying system. I think there's a lot of good
to be said of workmen who get the job done without complaining about
their tools. But in the big picture, it seems to me that all the
progress we've made with computers has been a matter of improving the
toolchain. The CPU is, after all, an underlying system, and there's
nothing you couldn't get done with assembler (or just machine code).
If you were smart enough, and had enough time.
The problem is, tools tend to impose an "IQ tax": thought spent on
managing the tool is thought not spent on solving the problem. I tend
to be stingy about paying that; I'm not smart enough, and I don't have
enough time.
Merlin's point about algebraic syntax fits well, here. Once you're
used to it, (x ∩ y) imposes less of a cognitive load than SELECT *
FROM x INTERSECT SELECT * FROM y. You can see how that scales, as
expressions get larger. There's a reason we no longer try to make
programming languages look like English, or other natural languages,
however reasonable it might have seemed in the 1970s.
And then there are very simple things I can't say reasonably, like
"SELECT * EXCEPT col_3", or "Tell me how many nulls are in each
column." Naturally, I can get these done; but the gap between what
was required to explain the goal and what is required to accomplish it
is much too large.
So, the affection I have for SQL is due to it being a gateway to a
great idea; my frustration is that it's a bottleneck in getting to
that same idea.
On Tue, Sep 14, 2021 at 12:20 PM Rob Sargent <robjsargent@gmail.com> wrote:
>
> On 9/14/21 10:10 AM, Michael Nolan wrote:
>
> I started programming in 1967, and over the last 50+ years I've programmed in more languages than I would want to list. I spent a decade writing in FORTRAN on a GA 18/30 (essentially a clone of the IBM 1130) with limited memory space, so you had to write EFFICIENT code, something that is a bit of a lost art these days. I also spent a decade writing in COBOL.
>
> I've not found many tasks that I couldn't find a way to write in whatever language I had available to write it in. There may be bad (or at least inefficient) languages, but there are lots of bad programmers.
> --
> Mike Nolan
> htfoot@gmail.com
>
> OK, I'm maybe responsible for this thread turning into a diatribe. I shouted at OP 'cause he shouted at us. My mistake, and I apologize.
> I'm probably closer to Mike's "bad programmers" than I would care to admit but fully believe software is a "people problem" more than most of us realize.
--
Ray Brinzer
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 18:41 Brian Dunavant <dunavant@gmail.com>
parent: Raymond Brinzer <ray.brinzer@gmail.com>
0 siblings, 1 reply; 61+ messages in thread
From: Brian Dunavant @ 2021-09-14 18:41 UTC (permalink / raw)
To: Raymond Brinzer <ray.brinzer@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Tue, Sep 14, 2021 at 1:54 PM Raymond Brinzer <ray.brinzer@gmail.com>
wrote:
>
> So, the affection I have for SQL is due to it being a gateway to a
> great idea; my frustration is that it's a bottleneck in getting to
> that same idea.
>
>
I have the opposite perspective. As a dev/manager, SQL is much more
powerful at getting data storage from abstract concept, into a usable
structure, than any programming language I've had the (mis)fortune of
using. I've long since lost count of the massive volume of other people's
code (especially ORMs) I've removed and replaced by updating SQL statements
to do all the logic, and return me exactly what I want. And typically this
also comes with a (sometimes massive) performance gain.
I've managed many a programmer that would complain that SQL is too hard and
they don't want to learn it, but had no problem spending days learning the
ORM of the month that "saves them time" and writing complex inscrutable
monstrosities with them.
Could SQL be better? Absolutely. But in terms of bang-for-my-buck, I
feel learning SQL has saved me more clock-time, and improved my
productivity/value probably more than any other individual language in my
career.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 19:48 Raymond Brinzer <ray.brinzer@gmail.com>
parent: Brian Dunavant <dunavant@gmail.com>
0 siblings, 0 replies; 61+ messages in thread
From: Raymond Brinzer @ 2021-09-14 19:48 UTC (permalink / raw)
To: Brian Dunavant <dunavant@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Tue, Sep 14, 2021 at 2:41 PM Brian Dunavant <dunavant@gmail.com> wrote:
> I have the opposite perspective. As a dev/manager, SQL is much more powerful at getting data storage from abstract concept, into a usable structure, than any programming language I've had the (mis)fortune of using. I've long since lost count of the massive volume of other people's code (especially ORMs) I've removed and replaced by updating SQL statements to do all the logic, and return me exactly what I want. And typically this also comes with a (sometimes massive) performance gain.
>
> I've managed many a programmer that would complain that SQL is too hard and they don't want to learn it, but had no problem spending days learning the ORM of the month that "saves them time" and writing complex inscrutable monstrosities with them.
>
> Could SQL be better? Absolutely. But in terms of bang-for-my-buck, I feel learning SQL has saved me more clock-time, and improved my productivity/value probably more than any other individual language in my career.
Your experience doesn't surprise me at all. Sure; it's better than
the alternatives. An ORM can be a net benefit if you're doing simple
things, but the more complex the query, the more it starts to feel
like you're trying to have a serious conversation through a bad
translator. This encourages programmers to keep queries simple, treat
the database as a big scratchpad, and do all the processing in code.
This easily turns into "reinventing the wheel, badly".
I would argue, though, that the programmers aren't completely wrong.
A good programmer strives for clarity, expressing ideas simply and
naturally, and avoiding repetition; SQL isn't good for that. But
papering over the problem on the software side isn't the solution.
I'd just emphasize our agreement: SQL (or another query language,
sitting in the same niche) could be better. So it should be.
--
Ray Brinzer
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 19:51 Mladen Gogala <gogala.mladen@gmail.com>
parent: Guyren Howe <guyren@gmail.com>
2 siblings, 2 replies; 61+ messages in thread
From: Mladen Gogala @ 2021-09-14 19:51 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Replies in-line
On 9/14/21 01:51, Guyren Howe wrote:
> They are making a decent decision. SQL is a *fucking terrible*
> language, which I don’t blame them for not wanting to learn.
Based on what criteria?
>
> The whole industry, programming languages, infrastructure, everything
> would have developed differently if relations were a natural,
> pleasurable thing to use in any programming language. Like an Array,
> or a Hash.
Thee is nothing natural about either relations or arrays and
hashes/dictionaries. Relations are pretty literal implementation of the
basic set theory. Having a decent understanding of the basic set theory
is a condition for understanding SQL. Now, we can discuss whether a
language implementing a mathematical theory is "good" or "bad", whatever
the meaning of "good" or "bad" in the given context. Historically, SQL
is a good fit for the banking business and accounting and that is why it
is still around.
Another misconception about SQL is treating it as a general purpose
programming language. SQL is data description language, nothing more,
nothing less. It doesn't need loops, arrays, hashes or subroutines, its
principal purpose is to describe a subset of data. Without SQL you would
have to read all the data and filter the unnecessary stuff yourself.
Furthermore, part of SQL are so called "ACID requirements". Transaction
can only see the data that was committed before the transaction has
begun. Implementing ACID takes a lot of code, that's what MVCC is all
about. However, that too has its origins in accounting. You cannot pay
the money you don't have. And the last thing about SQL is transaction
management. Without relational databases and SQL, you would need a
proprietary transaction manager, just like MongoDB. And MongoDB has a
complex proprietary transaction manager and is losing market share. So,
to recapitulate:
* Declarative subset definition
* ACID consistency
* Transaction management
* Ideal fit for accounting.
That is why SQL is still around. And that is why we all live in a yellow
subroutine (this reference is not for the millennials or younger).
--
I'll speak the key, the whole key and nothing but the key, so help me Codd.
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 19:53 Mladen Gogala <gogala.mladen@gmail.com>
parent: Rob Sargent <robjsargent@gmail.com>
2 siblings, 2 replies; 61+ messages in thread
From: Mladen Gogala @ 2021-09-14 19:53 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/14/21 02:18, Rob Sargent wrote:
> All languages are fucking terrible.
I like English. It's not very complex and it allows me to express myself
very well. You should see my native tongue, Croatian language, from the
group of Slavic languages. It's fucking terrible.
--
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 19:57 Guyren Howe <guyren@gmail.com>
parent: Mladen Gogala <gogala.mladen@gmail.com>
1 sibling, 2 replies; 61+ messages in thread
From: Guyren Howe @ 2021-09-14 19:57 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org, Mladen Gogala <gogala.mladen@gmail.com>
On Sep 14, 2021, 12:51 -0700, Mladen Gogala <gogala.mladen@gmail.com>, wrote:
> Replies in-line
> On 9/14/21 01:51, Guyren Howe wrote:
> > They are making a decent decision. SQL is a *fucking terrible* language, which I don’t blame them for not wanting to learn.
> Based on what criteria?
Verbosity. Redundancy. Lack of orthogonality. Resemblance to English. The standard effectively mandates a particular storage strategy, with heavyweight tables that must provide certain CAP theorem guarantees instead of others. Rigid storage limitations: less in Postgres than in others, but why can’t I, say, nest schemas? Hell, why can’t I nest relations?
https://www.edgedb.com/blog/we-can-do-better-than-sql
> >
> > The whole industry, programming languages, infrastructure, everything would have developed differently if relations were a natural, pleasurable thing to use in any programming language. Like an Array, or a Hash.
> > Thee is nothing natural about either relations or arrays and hashes/dictionaries. Relations are pretty literal implementation of the basic set theory. Having a decent understanding of the basic set theory is a condition for understanding SQL. Now, we can discuss whether a language implementing a mathematical theory is "good" or "bad", whatever the meaning of "good" or "bad" in the given context. Historically, SQL is a good fit for the banking business and accounting and that is why it is still around.
> > Another misconception about SQL is treating it as a general purpose programming language. SQL is data description language, nothing more, nothing less. It doesn't need loops, arrays, hashes or subroutines, its principal purpose is to describe a subset of data. Without SQL you would have to read all the data and filter the unnecessary stuff yourself. Furthermore, part of SQL are so called "ACID requirements". Transaction can only see the data that was committed before the transaction has begun. Implementing ACID takes a lot of code, that's what MVCC is all about. However, that too has its origins in accounting. You cannot pay the money you don't have. And the last thing about SQL is transaction management. Without relational databases and SQL, you would need a proprietary transaction manager, just like MongoDB. And MongoDB has a complex proprietary transaction manager and is losing market share. So, to recapitulate:
> > • Declarative subset definition
> > • ACID consistency
> > • Transaction management
> > • Ideal fit for accounting.
> > That is why SQL is still around. And that is why we all live in a yellow subroutine (this reference is not for the millennials or younger)
You’re confusing SQL with the relational model. Datalog and Quel and Tutorial D and other database languages and systems can and did provide those features also.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 19:59 Rob Sargent <robjsargent@gmail.com>
parent: Mladen Gogala <gogala.mladen@gmail.com>
1 sibling, 0 replies; 61+ messages in thread
From: Rob Sargent @ 2021-09-14 19:59 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/14/21 1:53 PM, Mladen Gogala wrote:
>
>
> On 9/14/21 02:18, Rob Sargent wrote:
>> All languages are fucking terrible.
>
> I like English. It's not very complex and it allows me to express
> myself very well. You should see my native tongue, Croatian language,
> from the group of Slavic languages. It's fucking terrible.
>
>
I actually burst out laughing at this. I don't believe I've ever heard
any prefer English over there mother tougue. That shocked me. I was,
of course referring to programming languages. I speak but one
(incredibly complicated) human language.
>
>
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 20:00 Martin Ritchie <martinritchie@geotab.com>
parent: Mladen Gogala <gogala.mladen@gmail.com>
1 sibling, 0 replies; 61+ messages in thread
From: Martin Ritchie @ 2021-09-14 20:00 UTC (permalink / raw)
To: Mladen Gogala <gogala.mladen@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
The big advantage for SQL is that it has remained relatively constant and
universal for ~40 years. There is effectively one major relational database
language that you need to learn and that is that. Once you learn it you can
transport your knowledge to nearly every other relational database
environment. The big disadvantage is that it was developed 40 years ago and
there have been huge changes in how we use databases and how we design
language syntax. If we could redesign the standard with a clean sheet now
it would be much better. But things could be a lot worse, at least it is
not javascript.. gross!
Martin Ritchie
*Geotab*
Senior DBA
Direct +1 (519) 741-7660
Toll-free +1 (877) 436-8221
Visit www.geotab.com
Twitter <https://twitter.com/geotab; | Facebook
<https://www.facebook.com/Geotab; | YouTube
<https://www.youtube.com/user/MyGeotab; | LinkedIn
<https://www.linkedin.com/company/geotab/;
On Tue, Sep 14, 2021 at 3:53 PM Mladen Gogala <gogala.mladen@gmail.com>
wrote:
>
> On 9/14/21 02:18, Rob Sargent wrote:
>
> All languages are fucking terrible.
>
> I like English. It's not very complex and it allows me to express myself
> very well. You should see my native tongue, Croatian language, from the
> group of Slavic languages. It's fucking terrible.
>
>
> --
> Mladen Gogala
> Database Consultant
> Tel: (347) 321-1217https://dbwhisperer.wordpress.com
>
>
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 20:07 Raymond Brinzer <ray.brinzer@gmail.com>
parent: Guyren Howe <guyren@gmail.com>
1 sibling, 2 replies; 61+ messages in thread
From: Raymond Brinzer @ 2021-09-14 20:07 UTC (permalink / raw)
To: Guyren Howe <guyren@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>; Mladen Gogala <gogala.mladen@gmail.com>
On Tue, Sep 14, 2021 at 3:58 PM Guyren Howe <guyren@gmail.com> wrote:
> You’re confusing SQL with the relational model. Datalog and Quel and Tutorial D and other database languages and systems can and did provide those features also.
By analogy: Arabic and Roman numerals both describe the natural
numbers. Hence, they have the same mathematical properties. Spending
a little time doing algebra with Roman numerals should convince
anyone, however, that how you express a concept matters a lot.
--
Ray Brinzer
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 20:08 Guyren Howe <guyren@gmail.com>
parent: Raymond Brinzer <ray.brinzer@gmail.com>
1 sibling, 0 replies; 61+ messages in thread
From: Guyren Howe @ 2021-09-14 20:08 UTC (permalink / raw)
To: Raymond Brinzer <ray.brinzer@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>; Mladen Gogala <gogala.mladen@gmail.com>
Exactly. SQL is the roman numerals of relational databases.
On Sep 14, 2021, 13:08 -0700, Raymond Brinzer <ray.brinzer@gmail.com>, wrote:
> On Tue, Sep 14, 2021 at 3:58 PM Guyren Howe <guyren@gmail.com> wrote:
> > You’re confusing SQL with the relational model. Datalog and Quel and Tutorial D and other database languages and systems can and did provide those features also.
>
> By analogy: Arabic and Roman numerals both describe the natural
> numbers. Hence, they have the same mathematical properties. Spending
> a little time doing algebra with Roman numerals should convince
> anyone, however, that how you express a concept matters a lot.
>
> --
> Ray Brinzer
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 20:15 FWS Neil <neil@fairwindsoft.com>
parent: Michael Nolan <htfoot@gmail.com>
3 siblings, 2 replies; 61+ messages in thread
From: FWS Neil @ 2021-09-14 20:15 UTC (permalink / raw)
To: Michael Nolan <htfoot@gmail.com>; +Cc: Rob Sargent <robjsargent@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
> On Sep 14, 2021, at 11:10 AM, Michael Nolan <htfoot@gmail.com> wrote:
>
> I started programming in 1967, and over the last 50+ years I've programmed in more languages than I would want to list. I spent a decade writing in FORTRAN on a GA 18/30 (essentially a clone of the IBM 1130) with limited memory space, so you had to write EFFICIENT code, something that is a bit of a lost art these days. I also spent a decade writing in COBOL.
>
> I've not found many tasks that I couldn't find a way to write in whatever language I had available to write it in. There may be bad (or at least inefficient) languages, but there are lots of bad programmers.
Yep, me too. I would say that SQL has not achieved its design goals yet. The original concept was to write what you want to achieve and have the server figure out the best way to get at it.
What people hate about SQL is that the programmer has to optimize SQL to get acceptable performance. And the optimization is different for every implementation. I think SQL has not hit its stride yet. When the common $1000 server has 1024+ CPUs and 1+TB memory, and SQL implementations have adopted good multithreading architecture with access to 1024+ CPU dedicated AI engines, etc. a lot of the crap associated with performant SQL will go away.
At this point, I think it will be smart to strip out implementation details that have made it into the SQL syntax. There will no longer be a need for it. This will make the SQL language simpler and easier to use, understand, and reason about.
Of course, that might not happen until my grandchildren are retired and in a nursing home. But who knows, stranger things have happened.
Neil
www.fairwindsoft.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 20:33 Raymond Brinzer <ray.brinzer@gmail.com>
parent: FWS Neil <neil@fairwindsoft.com>
1 sibling, 0 replies; 61+ messages in thread
From: Raymond Brinzer @ 2021-09-14 20:33 UTC (permalink / raw)
To: FWS Neil <neil@fairwindsoft.com>; +Cc: Michael Nolan <htfoot@gmail.com>; Rob Sargent <robjsargent@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Tue, Sep 14, 2021 at 4:16 PM FWS Neil <neil@fairwindsoft.com> wrote:
> What people hate about SQL is that the programmer has to optimize SQL to get acceptable performance.
Oh, no, that's just one thing. :-)
And to be fair, it's a hard problem. We're asking for an optimizer,
written for databases generally, to out-perform an intelligent human
who knows one particular database well. And we don't collect all the
data the optimizer might want, because of the performance or storage
costs to the collection (e.g. keeping accurate record totals by
performing a write operation on every insert).
In my daydreams, I sometimes think that making the query planner more
modular, and perhaps writing it in a higher-level language might be
good. Usually, optimizing for fast performance will beat optimizing
for performance fast. So it's a system you'd want to be able to tune
and improve easily.
> And the optimization is different for every implementation. I think SQL has not hit its stride yet. When the common $1000 server has 1024+ CPUs and 1+TB memory, and SQL implementations have adopted good multithreading architecture with access to 1024+ CPU dedicated AI engines, etc. a lot of the crap associated with performant SQL will go away.
Yeah... I don't. When a common server is 1000 times faster, people
will find reasons to do 1000 times as much with it.
> At this point, I think it will be smart to strip out implementation details that have made it into the SQL syntax. There will no longer be a need for it. This will make the SQL language simpler and easier to use, understand, and reason about.
A clean division between the query and the performance hints seems
like it'd be a big improvement. Rather like moving presentation
details from HTML off into CSS. Again, I don't see them going away,
though.
--
Ray Brinzer
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 20:51 Mladen Gogala <gogala.mladen@gmail.com>
parent: Raymond Brinzer <ray.brinzer@gmail.com>
1 sibling, 1 reply; 61+ messages in thread
From: Mladen Gogala @ 2021-09-14 20:51 UTC (permalink / raw)
To: Raymond Brinzer <ray.brinzer@gmail.com>; Guyren Howe <guyren@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On 9/14/21 16:07, Raymond Brinzer wrote:
> By analogy: Arabic and Roman numerals both describe the natural
> numbers. Hence, they have the same mathematical properties. Spending
> a little time doing algebra with Roman numerals should convince
> anyone, however, that how you express a concept matters a lot.
Analogy is not an accepted logical method. I do agree that the style of
expression matters. That is why we have literature. Saying "hey there"
and "friends, Romans, countrymen, lend me your ears" can have the same
meaning in the given context but the latter expression is much more
poetic. As software engineers, we are very much opposed to poetry,
especially those among us using Perl.
However, the stated purpose of the SQL language is to describe sets and
subsets. It's supposed to be verbose. Storage extensions are database
specific and are here for performance reasons.
--
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 21:01 Mladen Gogala <gogala.mladen@gmail.com>
parent: Guyren Howe <guyren@gmail.com>
1 sibling, 1 reply; 61+ messages in thread
From: Mladen Gogala @ 2021-09-14 21:01 UTC (permalink / raw)
To: Guyren Howe <guyren@gmail.com>; pgsql-general@lists.postgresql.org
On 9/14/21 15:57, Guyren Howe wrote:
> Verbosity. Redundancy. Lack of orthogonality. Resemblance to English.
Verbosity is a feature, as well as the resemblance to English. The
language is meant to be understood by accountants. Once upon a time
people were using something called "COmmon Business Oriented Language"
which was also very verbose, for the same reason: it had to be
understandable to the business people. SQL is written by the people with
the background in mathematics and is thus more understandable for the
people with background in mathematics. I have no problem with SQL.
--
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 22:29 Peter J. Holzer <hjp-pgsql@hjp.at>
parent: Mladen Gogala <gogala.mladen@gmail.com>
0 siblings, 0 replies; 61+ messages in thread
From: Peter J. Holzer @ 2021-09-14 22:29 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 2021-09-14 17:01:40 -0400, Mladen Gogala wrote:
> On 9/14/21 15:57, Guyren Howe wrote:
> > Verbosity. Redundancy. Lack of orthogonality. Resemblance to English.
>
> Verbosity is a feature, as well as the resemblance to English. The language
> is meant to be understood by accountants. Once upon a time people were using
> something called "COmmon Business Oriented Language" which was also very
> verbose, for the same reason: it had to be understandable to the business
> people.
Let's rephrase that: Back in the 1960s people thought programming would
be easier (programs easier to understand and to write) if the syntax
looked similar to English prose.
That belief was mistaken. While a very simple COBOL program may be
readable for a layperson (while even a very simple C program is not, and
a Haskell or APL program looks like complete gibberish), they still
can't write it, and even the readability advantage quickly vanishes for
more complex programs, because while COBOL may look like English, it
isn't.
SQL is significantly younger than COBOL but its design was led by the
same belief that making the language look like ordinary English would
make it easy to learn.
(It also wasn't the last. A few years back I saw a language for
specifying test cases designed for "ordinary people". Again, it looked
like English, but wasn't).
Superficial syntax is in my experience the smallest hurdle. It's
semantics that people struggle with.
hp
PS: COBOL is still in use.
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 22:30 Peter J. Holzer <hjp-pgsql@hjp.at>
parent: Mladen Gogala <gogala.mladen@gmail.com>
0 siblings, 1 reply; 61+ messages in thread
From: Peter J. Holzer @ 2021-09-14 22:30 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 2021-09-14 16:51:39 -0400, Mladen Gogala wrote:
> As software engineers, we are very much opposed to poetry, especially
> those among us using Perl.
When I learned Perl, Perl poetry was a real thing!
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 22:53 Gavin Flower <GavinFlower@archidevsys.co.nz>
parent: Michael Nolan <htfoot@gmail.com>
3 siblings, 1 reply; 61+ messages in thread
From: Gavin Flower @ 2021-09-14 22:53 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 15/09/21 04:10, Michael Nolan wrote:
> I started programming in 1967, and over the last 50+ years I've
> programmed in more languages than I would want to list. I spent a
> decade writing in FORTRAN on a GA 18/30 (essentially a clone of the
> IBM 1130) with limited memory space, so you had to write EFFICIENT
> code, something that is a bit of a lost art these days. I also spent
> a decade writing in COBOL.
>
> I've not found many tasks that I couldn't find a way to write in
> whatever language I had available to write it in. There may be bad (or
> at least inefficient) languages, but there are lots of bad programmers.
> --
> Mike Nolan
> htfoot@gmail.com
I remember programming in FORTRAN IV on an IBM 1130 at Auckland
University. My first attempt to explore Pythagorean triples was written
in FORTRAN on that machine. Finally had a useful program written in
Java about 30 years later. There are 4 triples starting with 60 that
satisfy A*2 + B^2 + C^2 where A < B < C and the numbers are mutually
prime. I was able to handle values of A up to the size of long, so I got
some pretty big numbers for B & C. Java's BigInteger class has its uses!
On the IBM 1130 it was faster to use X * X to find the square of a value
than to use the power notation (of which I've forgotten the syntax).
And for my many sins, I spent years programming in COBOL.
I've written code in over 30 languages. Probably had most fun writing a
couple of trivial programs in ARM2/3 assembler -- all instructions
except one are conditional.
There is no one perfect language, despite what some people might insist!
Cheers,
Gavin
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 23:05 Gavin Flower <GavinFlower@archidevsys.co.nz>
parent: Peter J. Holzer <hjp-pgsql@hjp.at>
0 siblings, 0 replies; 61+ messages in thread
From: Gavin Flower @ 2021-09-14 23:05 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 15/09/21 10:30, Peter J. Holzer wrote:
> On 2021-09-14 16:51:39 -0400, Mladen Gogala wrote:
>> As software engineers, we are very much opposed to poetry, especially
>> those among us using Perl.
> When I learned Perl, Perl poetry was a real thing!
>
> hp
>
Perl is too verbose, use APL! See: https://tryapl.org/
To be honest, I've looked at APL but never programmed in it.
Cheers,
Gavin
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-14 23:25 Michael Nolan <htfoot@gmail.com>
parent: Gavin Flower <GavinFlower@archidevsys.co.nz>
0 siblings, 1 reply; 61+ messages in thread
From: Michael Nolan @ 2021-09-14 23:25 UTC (permalink / raw)
To: Gavin Flower <GavinFlower@archidevsys.co.nz>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Of all the languages I wrote in, I think SNOBOL was the most fun to write
in, and LISP the least fun. Control Data assembler language
programming was probably the most precise, because you could crash the OS
with a single mis-placed character, something I did more than once.
In a graduate-level course, we studied ALGOL-68, which had so many things
in it that I'm not sure anybody ever actually implemented the full
language. (But then again, has anybody implemented EVERYTHING in the SQL
standard?)
COBOL has strange verbs like 'move corresponding' that could accomplish
complicated tasks in a few lines but you have to be careful that you knew
what you were asking for!
And I'd take the SQL standard over the CODASYL standard any time!
--
Mike Nolan
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-15 00:31 Raymond Brinzer <ray.brinzer@gmail.com>
parent: Guyren Howe <guyren@gmail.com>
2 siblings, 1 reply; 61+ messages in thread
From: Raymond Brinzer @ 2021-09-15 00:31 UTC (permalink / raw)
To: ; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
So, on a practical note: I'd like it if PostgreSQL supported
alternate languages for queries, as it does for stored procedures.
Yes, I know this will strike some of you as an abomination. I think
we can take that part as read. ;-)
I see two ways of going about this. The quick & dirty way would be to
conditionally hand off the incoming code to a pre-processor, which
would return SQL to be passed along to the rest of the parser. You'd
just add a few lines to parser.c, along the lines of:
#ifdef ALTERNATE_QUERY_LANGUAGE
str = preprocess_the_code(str);
#endif
The rest would be defined outside the existing code. I actually
experimented with this a few years ago, embedding some Chicken Scheme
into PostgreSQL, and it seemed to work reasonably well. Basically, I
looked to see if the incoming query started with "(" and if it didn't,
I just returned the string unaltered. If it did, I parsed as
s-expressions.
The "right", and more flexible way, would be to actually generate your
own parse tree, using the same nodes the native parser does. I'm
sorry to say I didn't stick with that to the point of getting anything
working. One encouraging thing, however is the fact that the parser
is mostly isolated from the rest of the system; if it was highly
integrated, it would be much harder. Although gram.y does hedge a bit
on this:
"In general, nothing in this file should initiate database accesses".
Anyway, one way or the other, I think it could be done.
On Tue, Sep 14, 2021 at 1:32 AM Guyren Howe <guyren@gmail.com> wrote:
>
> A fun philosophical discussion.
>
> I am no fan of “worse is better”, and particularly its poster child, SQL.
>
> The world’s economic output would be substantially higher (5%?) if our industry had settled on almost anything other than SQL for relational databases.
>
> So much of the design of *almost everything* in our industry is a reaction to SQL. ORMs fucking *everywhere* so you don’t have to use SQL. Bad query and database design. Inefficient system designs that use ORMs rather than relations. NoSQL databases. Countless hours on hours of developer time trying to work out how to write something in SQL that would be trivial in, say, Datalog.
>
> If I had $5 million to invest in a startup, I would hire as many of the core Postgres devs as I could to make a new database with all the sophistication of Postgres but based on Datalog (or something similar). (Or maybe add Datalog to Postgres). If that could get traction, it would lead in a decade to a revolution in productivity in our industry.
--
Ray Brinzer
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-15 00:32 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Mladen Gogala <gogala.mladen@gmail.com>
1 sibling, 0 replies; 61+ messages in thread
From: Adrian Klaver @ 2021-09-15 00:32 UTC (permalink / raw)
To: Mladen Gogala <gogala.mladen@gmail.com>; pgsql-general@lists.postgresql.org
On 9/14/21 12:51 PM, Mladen Gogala wrote:
> Replies in-line
>
> On 9/14/21 01:51, Guyren Howe wrote:
>> They are making a decent decision. SQL is a *fucking terrible*
>> language, which I don’t blame them for not wanting to learn.
>
> Based on what criteria?
>
>
>>
>> The whole industry, programming languages, infrastructure, everything
>> would have developed differently if relations were a natural,
>> pleasurable thing to use in any programming language. Like an Array,
>> or a Hash.
>
> Thee is nothing natural about either relations or arrays and
> hashes/dictionaries. Relations are pretty literal implementation of the
> basic set theory. Having a decent understanding of the basic set theory
> is a condition for understanding SQL. Now, we can discuss whether a
> language implementing a mathematical theory is "good" or "bad", whatever
> the meaning of "good" or "bad" in the given context. Historically, SQL
> is a good fit for the banking business and accounting and that is why it
> is still around.
>
I can see what you are saying. Still as someone that comes from a
biology background and a basic understanding of math I will say SQL has
a broader appeal. All those years of memorizing organism classifications
inadvertently led me to set theory; 'all dogs are animals, not all
animals are dogs'. Also, time spent identifying plants/critters via
dichotomous keys led me to boolean logic. The upshot is that once I got
involved with SQL databases the basics made sense. The details I am
still learning.
>
> --
> I'll speak the key, the whole key and nothing but the key, so help me Codd.
> Mladen Gogala
> Database Consultant
> Tel: (347) 321-1217
> https://dbwhisperer.wordpress.com
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-15 01:49 Gavin Flower <GavinFlower@archidevsys.co.nz>
parent: Michael Nolan <htfoot@gmail.com>
0 siblings, 0 replies; 61+ messages in thread
From: Gavin Flower @ 2021-09-15 01:49 UTC (permalink / raw)
To: Michael Nolan <htfoot@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Hi Michael,
Appropriate comments interspersed below.
I'm happy writing SQL and moderately competent using it. But like all
the languages I've used, without exception, it has its pain points.
Cheers,
Gavin
On 15/09/21 11:25, Michael Nolan wrote:
> Of all the languages I wrote in, I think SNOBOL was the most fun to
> write in, and LISP the least fun. Control Data
I once read the first 40 pages of a SNOBOL manuel, but unfortunately
never got the opportunity to try it out.
> assembler language
> programming was probably the most precise, because you could crash the
> OS with a single mis-placed character, something I did more than once.
I knew a senior tech programmer who inadvertently tried to rewind a disc
back to BT and switch to 800 BPI, fortunately only his program crashed.
Another time the memory protection was disabled (ICL no longer had the
capacity to fix it) on our ICL 4/50 MainFrame and someone wrote a
program to write 'J' into an area of memory. That was legitimate, but
it had a bug which caused it to write into more memory than it should
have... The machine crashed. Our ICL 4/50 was the last surviving
operational machine of its type in the world.
Our main machines were two ICL 4/72's each having a single fast 2MHz
processor and a massive 1 MB of core memory with a battery of big
exchangeable disks each with a whopping 60 MB of capacity & tape drives
for 12" reels.
>
> In a graduate-level course, we studied ALGOL-68, which had so many
> things in it that I'm not sure anybody ever actually implemented the
> full language. (But then again, has anybody implemented EVERYTHING in
> the SQL standard?)
I learnt ALGOL-68 from a manual written in Backus-Naur notation on my
own initiative. Tried to write a simple statistics program, never
finished it. That was before I really understood the value of rigorous
indenting standards.
>
> COBOL has strange verbs like 'move corresponding' that could
> accomplish complicated tasks in a few lines but you have to be careful
> that you knew what you were asking for!
In our site that was banned as being too dangerous.
And how about the 'lovely' ALTER GOTO construct???
Children don't try to use these constructs at home, as even experienced
adults get burnt using them!
>
> And I'd take the SQL standard over the CODASYL standard any time!
> --
Agreed!
> Mike Nolan
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-15 06:45 Julien Rouhaud <rjuju123@gmail.com>
parent: Raymond Brinzer <ray.brinzer@gmail.com>
0 siblings, 1 reply; 61+ messages in thread
From: Julien Rouhaud @ 2021-09-15 06:45 UTC (permalink / raw)
To: Raymond Brinzer <ray.brinzer@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Wed, Sep 15, 2021 at 8:31 AM Raymond Brinzer <ray.brinzer@gmail.com> wrote:
>
> So, on a practical note: I'd like it if PostgreSQL supported
> alternate languages for queries, as it does for stored procedures.
I agree, and actually sent a patch some time ago to allow usage of
third-party parser(s). They can coexist with the core one, meaning
that you can (if you write your parser this way) use both languages,
even in a multi-query string. See
https://commitfest.postgresql.org/34/3100/ for more details.
That's arguably not enough to efficiently handle things like oracle
style sql-89 outer joins as there's still no way to hook into the
various transform* functions, but that's a start.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-15 19:44 Merlin Moncure <mmoncure@gmail.com>
parent: FWS Neil <neil@fairwindsoft.com>
1 sibling, 1 reply; 61+ messages in thread
From: Merlin Moncure @ 2021-09-15 19:44 UTC (permalink / raw)
To: FWS Neil <neil@fairwindsoft.com>; +Cc: Michael Nolan <htfoot@gmail.com>; Rob Sargent <robjsargent@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Tue, Sep 14, 2021 at 3:16 PM FWS Neil <neil@fairwindsoft.com> wrote:
>
> > On Sep 14, 2021, at 11:10 AM, Michael Nolan <htfoot@gmail.com> wrote:
> >
> > I started programming in 1967, and over the last 50+ years I've programmed in more languages than I would want to list. I spent a decade writing in FORTRAN on a GA 18/30 (essentially a clone of the IBM 1130) with limited memory space, so you had to write EFFICIENT code, something that is a bit of a lost art these days. I also spent a decade writing in COBOL.
> >
> > I've not found many tasks that I couldn't find a way to write in whatever language I had available to write it in. There may be bad (or at least inefficient) languages, but there are lots of bad programmers.
>
> Yep, me too. I would say that SQL has not achieved its design goals yet. The original concept was to write what you want to achieve and have the server figure out the best way to get at it.
>
> What people hate about SQL is that the programmer has to optimize SQL to get acceptable performance. And the optimization is different for every implementation. I think SQL has not hit its stride yet. When the common $1000 server has 1024+ CPUs and 1+TB memory, and SQL implementations have adopted good multithreading architecture with access to 1024+ CPU dedicated AI engines, etc. a lot of the crap associated with performant SQL will go away.
>
> At this point, I think it will be smart to strip out implementation details that have made it into the SQL syntax. There will no longer be a need for it. This will make the SQL language simpler and easier to use, understand, and reason about.
I think you ought to recognize that many people on this list make
money directly from managing that complexity :-).
Processing time remains bounded, and for complex queries how much time
is spend executing vs planning is a very difficult tradeoff. Just
like in math, there are many ways to describe the same thing, and it
is for the clever to pick the best ones that run efficiently and well.
And thank goodness for that; it sends my kids to college.
Relating to your other point relating to implementations, it's not
different than having different browsers that render html and execute
javascript. Having several high quality implementations to choose
from is healthy and good, and allows choice best on cost and feature
needs. I would personally be much more inclined to gripe about
implementations that do not support standard syntax or have other
major standards issues (SQL server, I'm looking at you).
merlin
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-16 00:30 FWS Neil <neil@fairwindsoft.com>
parent: Merlin Moncure <mmoncure@gmail.com>
0 siblings, 3 replies; 61+ messages in thread
From: FWS Neil @ 2021-09-16 00:30 UTC (permalink / raw)
To: Merlin Moncure <mmoncure@gmail.com>; +Cc: Michael Nolan <htfoot@gmail.com>; Rob Sargent <robjsargent@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
> On Sep 15, 2021, at 2:44 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
>
> On Tue, Sep 14, 2021 at 3:16 PM FWS Neil <neil@fairwindsoft.com <mailto:neil@fairwindsoft.com>> wrote:
>>
>>> On Sep 14, 2021, at 11:10 AM, Michael Nolan <htfoot@gmail.com> wrote:
>>>
>>> I started programming in 1967, and over the last 50+ years I've programmed in more languages than I would want to list. I spent a decade writing in FORTRAN on a GA 18/30 (essentially a clone of the IBM 1130) with limited memory space, so you had to write EFFICIENT code, something that is a bit of a lost art these days. I also spent a decade writing in COBOL.
>>>
>>> I've not found many tasks that I couldn't find a way to write in whatever language I had available to write it in. There may be bad (or at least inefficient) languages, but there are lots of bad programmers.
>>
>> Yep, me too. I would say that SQL has not achieved its design goals yet. The original concept was to write what you want to achieve and have the server figure out the best way to get at it.
>>
>> What people hate about SQL is that the programmer has to optimize SQL to get acceptable performance. And the optimization is different for every implementation. I think SQL has not hit its stride yet. When the common $1000 server has 1024+ CPUs and 1+TB memory, and SQL implementations have adopted good multithreading architecture with access to 1024+ CPU dedicated AI engines, etc. a lot of the crap associated with performant SQL will go away.
>>
>> At this point, I think it will be smart to strip out implementation details that have made it into the SQL syntax. There will no longer be a need for it. This will make the SQL language simpler and easier to use, understand, and reason about.
>
> I think you ought to recognize that many people on this list make
> money directly from managing that complexity :-).
>
I did not intend to disparage anyone. People, including myself, make money when they provide value and there is certainly value here.
But, I am not sure I understand your inference. Are you saying (and I am not implying you are) that PostgreSQL does not progress in line with the original SQL goals of simplifying data access because people are making money off of the current complexity?
My only point was that SQL was originally conceived to free the programmer from implementation details. Today, after 47 years, it still has not achieved that goal. As computers get more powerful, of course, they will process more data, but they also have the option of moving more of the implementation decision making away from the programmer to let the machine figure out the best way to handle the request. Therefore, I do not think SQL has hit its stride yet.
Programmers create a dozens of new languages every 10 years or so. Only a few have stood the test of time. SQL is one of those. For all its faults, it still is amazingly powerful.
Neil
www.fairwindsoft.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-16 00:47 Michael Nolan <htfoot@gmail.com>
parent: FWS Neil <neil@fairwindsoft.com>
2 siblings, 0 replies; 61+ messages in thread
From: Michael Nolan @ 2021-09-16 00:47 UTC (permalink / raw)
To: FWS Neil <neil@fairwindsoft.com>; +Cc: Merlin Moncure <mmoncure@gmail.com>; Rob Sargent <robjsargent@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Wed, Sep 15, 2021 at 7:31 PM FWS Neil <neil@fairwindsoft.com> wrote:
>
> Programmers create a dozens of new languages every 10 years or so. Only a
> few have stood the test of time. SQL is one of those. For all its faults,
> it still is amazingly powerful.
>
> Neil
> www.fairwindsoft.com
>
>
Dennis Ritchie was giving a speech at a conference some years ago, and he
said that if he had known C was going to be so popular, he would have
designed it better.
--
Mike Nolan
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-16 00:55 Adrian Klaver <adrian.klaver@aklaver.com>
parent: FWS Neil <neil@fairwindsoft.com>
2 siblings, 1 reply; 61+ messages in thread
From: Adrian Klaver @ 2021-09-16 00:55 UTC (permalink / raw)
To: FWS Neil <neil@fairwindsoft.com>; Merlin Moncure <mmoncure@gmail.com>; +Cc: Michael Nolan <htfoot@gmail.com>; Rob Sargent <robjsargent@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On 9/15/21 5:30 PM, FWS Neil wrote:
>
>
>> On Sep 15, 2021, at 2:44 PM, Merlin Moncure <mmoncure@gmail.com
>> <mailto:mmoncure@gmail.com>> wrote:
>>
>> I think you ought to recognize that many people on this list make
>> money directly from managing that complexity :-).
>>
>
> I did not intend to disparage anyone. People, including myself, make
> money when they provide value and there is certainly value here.
>
> But, I am not sure I understand your inference. Are you saying (and I
> am not implying you are) that PostgreSQL does not progress in line with
> the original SQL goals of simplifying data access because people are
> making money off of the current complexity?
>
I'm going to say Merlin was being one part sarcastic, one part saying
people may not want to bite the hand that feeds them.
As to SQL, if Postgres wants to maintain it's goal of hewing to the SQL
standard then what progress it came make is determined by the SQL
standards committee.
> Neil
> www.fairwindsoft.com <http://www.fairwindsoft.com;
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-16 13:24 Edson Carlos Ericksson Richter <richter@simkorp.com.br>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 0 replies; 61+ messages in thread
From: Edson Carlos Ericksson Richter @ 2021-09-16 13:24 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Em 15/09/2021 21:55, Adrian Klaver escreveu:
> On 9/15/21 5:30 PM, FWS Neil wrote:
>>
>>
>>> On Sep 15, 2021, at 2:44 PM, Merlin Moncure <mmoncure@gmail.com
>>> <mailto:mmoncure@gmail.com>> wrote:
>>>
>
>>> I think you ought to recognize that many people on this list make
>>> money directly from managing that complexity :-).
>>>
>>
>> I did not intend to disparage anyone. People, including myself, make
>> money when they provide value and there is certainly value here.
>>
>> But, I am not sure I understand your inference. Are you saying (and
>> I am not implying you are) that PostgreSQL does not progress in line
>> with the original SQL goals of simplifying data access because people
>> are making money off of the current complexity?
>>
>
> I'm going to say Merlin was being one part sarcastic, one part saying
> people may not want to bite the hand that feeds them.
>
> As to SQL, if Postgres wants to maintain it's goal of hewing to the
> SQL standard then what progress it came make is determined by the SQL
> standards committee.
I love the fact that PostgreSQL keep in sync with SQL standard. I love
SQL as it is (and I came from a world with Cobol, Clipper and Dbase, and
other 4GL etc tools).
Also, I teach SQL to my junior employees, and they love it once they
fully compreehends - even stop defending the NoSQL hype.
At other side, I would see no objection if someone else would implement
another language on top of PostgreSQL engine.
Just my 2c.
Regards,
Edson
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-16 14:31 Merlin Moncure <mmoncure@gmail.com>
parent: FWS Neil <neil@fairwindsoft.com>
2 siblings, 2 replies; 61+ messages in thread
From: Merlin Moncure @ 2021-09-16 14:31 UTC (permalink / raw)
To: FWS Neil <neil@fairwindsoft.com>; +Cc: Michael Nolan <htfoot@gmail.com>; Rob Sargent <robjsargent@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Wed, Sep 15, 2021 at 7:31 PM FWS Neil <neil@fairwindsoft.com> wrote:
> On Sep 15, 2021, at 2:44 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
> > I think you ought to recognize that many people on this list make
> > money directly from managing that complexity :-).
>
> I did not intend to disparage anyone. People, including myself, make money when they provide value and there is certainly value here.
>
> But, I am not sure I understand your inference. Are you saying (and I am not implying you are) that PostgreSQL does not progress in line with the original SQL goals of simplifying data access because people are making money off of the current complexity?
Not at all. I'm saying that this mailing list is stuffed with people
that work on and with the database, and SQL is in many cases
(including mine) a passion. Postgres is a technical marvel so that
we make money by utilizing it effectively, and rendering, er,
constructive feedback to its stewards so that it may improve and we
may all become more efficient.
Points made upthread suggesting SQL is bad due to being based on sets
were ironic IMO. SQL is successful and enduring precisely because you
can direct operations by describing data relationships rather than
implement specific operations by hand. Fluency in that technique
leads to solution achievement that other technologies cannot approach.
It rewards artistry and creativity, which I guess rubs some people the
wrong way since it does not align to factory development strategies.
No offense taken; I enjoy the debate; this thread is an indulgence,
being a bit of time off from capricious C suite executives, agile
methodology zealots, etc. So fire away.
merlin
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-16 16:26 Michael Nolan <htfoot@gmail.com>
parent: Merlin Moncure <mmoncure@gmail.com>
1 sibling, 1 reply; 61+ messages in thread
From: Michael Nolan @ 2021-09-16 16:26 UTC (permalink / raw)
To: Merlin Moncure <mmoncure@gmail.com>; +Cc: FWS Neil <neil@fairwindsoft.com>; Rob Sargent <robjsargent@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
In the same 1971 seminar where we studied Algol-68, we had to read and
write a short paper on the 1970 Codd paper on relational theory, which had
only been out for about a year. The professor running the seminar noted
that Codd proved that the relational model worked, but didn't guarantee
that it worked efficiently enough to be implementable without immense
computer resources, which of course became available.
--
Mike Nolan
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-16 20:21 Gavin Flower <GavinFlower@archidevsys.co.nz>
parent: Michael Nolan <htfoot@gmail.com>
0 siblings, 1 reply; 61+ messages in thread
From: Gavin Flower @ 2021-09-16 20:21 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 17/09/21 04:26, Michael Nolan wrote:
> In the same 1971 seminar where we studied Algol-68, we had to read and
> write a short paper on the 1970 Codd paper on relational theory,
> which had only been out for about a year. The professor running the
> seminar noted that Codd proved that the relational model worked, but
> didn't guarantee that it worked efficiently enough to be implementable
> without immense computer resources, which of course became available.
> --
> Mike Nolan
Developing an effective optimizer might have helped ...
Cheers,
Gavin
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-16 23:29 Guyren Howe <guyren@gmail.com>
parent: Merlin Moncure <mmoncure@gmail.com>
1 sibling, 4 replies; 61+ messages in thread
From: Guyren Howe @ 2021-09-16 23:29 UTC (permalink / raw)
To: Merlin Moncure <mmoncure@gmail.com>; +Cc: FWS Neil <neil@fairwindsoft.com>; Michael Nolan <htfoot@gmail.com>; Rob Sargent <robjsargent@gmail.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
On Sep 16, 2021, at 7:31 , Merlin Moncure <mmoncure@gmail.com> wrote:
>
> On Wed, Sep 15, 2021 at 7:31 PM FWS Neil <neil@fairwindsoft.com> wrote:
>> On Sep 15, 2021, at 2:44 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
>>> I think you ought to recognize that many people on this list make
>>> money directly from managing that complexity :-).
>>
>> I did not intend to disparage anyone. People, including myself, make money when they provide value and there is certainly value here.
>>
>> But, I am not sure I understand your inference. Are you saying (and I am not implying you are) that PostgreSQL does not progress in line with the original SQL goals of simplifying data access because people are making money off of the current complexity?
>
> Not at all. I'm saying that this mailing list is stuffed with people
> that work on and with the database, and SQL is in many cases
> (including mine) a passion. Postgres is a technical marvel so that
> we make money by utilizing it effectively, and rendering, er,
> constructive feedback to its stewards so that it may improve and we
> may all become more efficient.
>
> Points made upthread suggesting SQL is bad due to being based on sets
> were ironic IMO. SQL is successful and enduring precisely because you
> can direct operations by describing data relationships rather than
> implement specific operations by hand. Fluency in that technique
> leads to solution achievement that other technologies cannot approach.
> It rewards artistry and creativity, which I guess rubs some people the
> wrong way since it does not align to factory development strategies.
>
> No offense taken; I enjoy the debate; this thread is an indulgence,
> being a bit of time off from capricious C suite executives, agile
> methodology zealots, etc. So fire away.
Missing my original point here. The set theory is the _point_. SQL is a gargantuan distraction from using it efficiently.
Imagine if COBOL was the only widely-available programming language with functions. You might use it, because functions are really great abstraction for programming. That wouldn’t mean that COBOL wasn’t an utterly awful language.
SQL is like that, only for relations, sets and logic.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-16 23:31 Rob Sargent <robjsargent@gmail.com>
parent: Guyren Howe <guyren@gmail.com>
3 siblings, 0 replies; 61+ messages in thread
From: Rob Sargent @ 2021-09-16 23:31 UTC (permalink / raw)
To: Guyren Howe <guyren@gmail.com>; Merlin Moncure <mmoncure@gmail.com>; +Cc: FWS Neil <neil@fairwindsoft.com>; Michael Nolan <htfoot@gmail.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
> Missing my original point here. The set theory is the _point_. SQL is
> a gargantuan distraction from using it efficiently.
>
> Imagine if COBOL was the only widely-available programming language
> with functions. You might use it, because functions are really great
> abstraction for programming. That wouldn’t mean that COBOL wasn’t an
> utterly awful language.
>
> SQL is like that, only for relations, sets and logic.
Is "like that" how, exactly?
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-16 23:53 Mladen Gogala <gogala.mladen@gmail.com>
parent: Guyren Howe <guyren@gmail.com>
3 siblings, 0 replies; 61+ messages in thread
From: Mladen Gogala @ 2021-09-16 23:53 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/16/21 19:29, Guyren Howe wrote:
> Missing my original point here. The set theory is the _point_. SQL is
> a gargantuan distraction from using it efficiently.
>
> Imagine if COBOL was the only widely-available programming language
> with functions. You might use it, because functions are really great
> abstraction for programming. That wouldn’t mean that COBOL wasn’t an
> utterly awful language.
>
> SQL is like that, only for relations, sets and logic.
I am probably a bit biased because I am using SQL for a few weeks now. I
was the first person certified for teaching Oracle 6 internals in the
EMEA region and I was a certified Oracle 5.1.22 DBA on VAX/VMS. So, by
using SQL for several weeks now, I grew attached to it and I like it. My
second problem is my mathematical background. I have a Bsc in
mathematics and was quite well acquainted not only with the basic set
theory but also with things like Zermelo's axiom of choice, Zorn's
lemma and well ordering theorem. I am still quite familiar with the
relational algebra, unions, intersections, Cartesian products,
equivalence relations and alike. I think that SQL represents relational
algebra quite well. It must be doing something right, because it lasts
for so long. After all, it was created by a mathematician. There is a
famous quote from the move "Chinatown" saying that politicians, ugly
buildings, and whores all get respectable if they last long enough. The
same applies to computer languages. I love the smell of SQL in the morning.
--
I'll speak the key, the whole key and nothing but the key, so help me Codd.
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-17 02:28 Gavin Flower <GavinFlower@archidevsys.co.nz>
parent: Guyren Howe <guyren@gmail.com>
3 siblings, 0 replies; 61+ messages in thread
From: Gavin Flower @ 2021-09-17 02:28 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 17/09/21 11:29, Guyren Howe wrote:
[...]
> The set theory is the _point_. SQL is a gargantuan distraction from
> using it efficiently.
>
> Imagine if COBOL was the only widely-available programming language
> with functions. You might use it, because functions are really great
> abstraction for programming. That wouldn’t mean that COBOL wasn’t an
> utterly awful language.
>
> SQL is like that, only for relations, sets and logic.
COBOL is horrible, but SQL is quite a neat language, though it has its
issues.
Am happy to write SQL, but not that keen on getting back into COBOL!
SQL is far superior to COBOL, in their respective use cases.
Cheers,
Gavin
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-17 03:36 Ron <ronljohnsonjr@gmail.com>
parent: Gavin Flower <GavinFlower@archidevsys.co.nz>
0 siblings, 0 replies; 61+ messages in thread
From: Ron @ 2021-09-17 03:36 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/16/21 3:21 PM, Gavin Flower wrote:
> On 17/09/21 04:26, Michael Nolan wrote:
>> In the same 1971 seminar where we studied Algol-68, we had to read and
>> write a short paper on the 1970 Codd paper on relational theory, which
>> had only been out for about a year. The professor running the seminar
>> noted that Codd proved that the relational model worked, but didn't
>> guarantee that it worked efficiently enough to be implementable without
>> immense computer resources, which of course became available.
>> --
>> Mike Nolan
>
>
> Developing an effective optimizer might have helped ...
Just a Simple Matter of Engineering... /s
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-17 03:39 Ron <ronljohnsonjr@gmail.com>
parent: Guyren Howe <guyren@gmail.com>
3 siblings, 1 reply; 61+ messages in thread
From: Ron @ 2021-09-17 03:39 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/16/21 6:29 PM, Guyren Howe wrote:
[snip]
> Missing my original point here. The set theory is the _point_. SQL is a
> gargantuan distraction from using it efficiently.
>
> Imagine if COBOL was the only widely-available programming language with
> functions. You might use it, because functions are really great
> abstraction for programming. That wouldn’t mean that COBOL wasn’t an
> utterly awful language.
COBOL is a *great* language in its domain.
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-17 03:55 Arnold Morein <arnie.morein@mac.com>
parent: Ron <ronljohnsonjr@gmail.com>
0 siblings, 0 replies; 61+ messages in thread
From: Arnold Morein @ 2021-09-17 03:55 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
My $5.00 on this discussion (quite fascinating and nostalgic actually). This is a little long granted, but it was fun.
As someone who cut their IT in general and programmer teeth in particular on the HP 3000 platform, in the time (and a land) BEFORE SQL, where we had only a single database engine to choose from (IMAGE, a network database), where you accessed data with its hashed key via a strict read/insert/lock before (update/delete) API or the KSAM file engine for non-database work that didn’t have high transaction volume (again, also only via a strict API), SQL at the time was nothing short of a miraculous boon!
None of the above were Relational. Nor was there anything like SQL in the business market. At the time, it was mostly found in academia and some fringe/bleeding edge companies.
Though I understand the concept of the request that started the thread, what irks me is when people make statements like the “tragedy of SQL” or anything else that equates SQL with the concept of a RDBMS. The two are not the same thing.
Let us not forget that SQL is an acronym for Structured Query Language and it is indeed just that: a language and a tool to be used in retrieving and manipulating data organized in the form of a tabular data stream; how it is managed by the underlying engine is irrelevant. By the time I was able to study it in college (after several years of only being to access data via a program I had to write utilizing engine APIs) I found it a great tool for a programmer and yes, even the odd accountant that had some technical aptitude. At the time, a basic SQL interpreter exceeded some of the best "report writer” tools of its day and unlike those tools, you could use SQL to actually change data in the underlying data store. (It’s Dark Majik, Moriarty!) In fact in many ways, it wasn’t marketed as a API abstraction layer (as it has turned into of late) but as a separate add-on tool for a given flavor of file/database engine.
Back on the HP 3000 (a 16-bit machine at that point), the only languages for use (that I had access to) were COBOL, Fortran, and (new at the time) Pascal. Having to write a quick and dirty application just to list data on the screen was required and overly tedious. When SQL became available as a layer between the user and the data store, it actually reduced the programmer workload as simple inquiries could be done by technical if not programming staff. (Also, when migrating from one propriety data source to another, SQL could be exported from one system and executed in another for import.)
On the other hand, from a programmer’s stand point back then, the introduction of the RELATIONAL database, and the cool stuff the engine would do for me with a one time declaration and no coding was amazing and again, a time saver. That there was a SQL interpreter option for the engine was icing on the cake!
HP would later release a SQL interpreter for its then TurboIMAGE and later ALLBASE products. The current CONNX product (now owned by SoftwareAG) provides SQL based access to Adabas data. IBM provides a product to provide access to VSAM data via SQL. Again: an add-on module to a product that wasn’t originally built to a be a RDBMS.
I think the IT industry did a bit of a disservice to itself, SQL, and the RDBMS concept by coupling them so tightly. (Or maybe they just grew together organically?) The concept of a QL, whether verbose or terse, that allows a human with only a little training to write statements that gives them access to the data they need was a great idea. It still is. But, the plethora of other languages (for data access or other arcane activities) that have appeared in the field over the last 10-15 years is well, boggling; and personally at times seem like a rework only because the author didn’t like the language’s syntax or simply wasn’t a touch typist. (Man am I glad I took typing in high school!)
As stated, SQL is a language/tool that is simply one way to interact with a file/database engine. Though these days, I suspect many vendors prefer to use SQL as the only language they offer because SQL has such a broad use and most people have had to learn it to some degree or other in their collegiate and professional careers. What amazes me is that so many companies and products have gone to such lengths to allow the “simple” language of SQL to become the de facto language to interact with their file/database engines; sometimes not even publishing a non-SQL API at all. (All you get is a C/JDBC driver. Enjoy!)
So back to the thread, given the extensibility of PostgreSQL, I think the concept of a different QL to access the data stored there (or anywhere else for that matter) may be of great use to a specific audience, depending on the environment (read tool) where it is used. (The biology reference was brilliant: one of my COBOL teachers digressed once that one of the features of the language at its outset was its ability to manipulate multidimensional arrays of a certain depth in order to facilitate work in biology dealing with the tree of life.)
But just where SQL may not be the best way to access a given dataset a certain way, neither is a RDBMS necessarily the best place to store the data of a certain type or structure. Just as Postgre has helped expand the range of data types that can be stored within it, the advent of the NoSQL databases has shown that not every size fits all. (Yet again.)
On the other topic, as a programmer in the business field, I must say that the ORM has saved me years worth of hours of work, especially when coupled with an object-oriented language. Being able to create a hierarchy of extensible and thus reusable classes that allow me to abstract and template my data model has allowed me to get the lower-level tedium of application development done and out of the way much more rapidly than in the past.
Perfect example: I once had to create an ESB process that synchronized data between an Adabas file on a mainframe, and nearly 30 separate instances of the same FoxPro (FP) for Windows database (no, not Visual FoxPro, go even further back). The only way I was able to do it was a product and its JDBC driver that turned basic SQL into Adabas API calls and the ODBC driver that spoke SQL to FP. The key was a yet another product that ran on Windows 32-bit and would work with the 16-bit FoxPro for Windows driver, turning the Windows workstation into a FP database server. Using the Hibernate ORM and the OO Java language, I was able to model both databases once, connect to all of the instances simultaneously, and even override the generated SQL which was too robust for the FP interpreter with “native” FPSQL and got the job done. How’s that for convoluted?! NONE of that would have been so easy (if not impossible) without the standard that is SQL.
Today, my cocktail of choice is Java with the Hibernate ORM and given that Hibernate supports SQL, HQL (Hibernate Query Language) and the EJB-QL, I think its safe to say that there are a lot of options out there to be had. In fact, the Hibernate folks have extended the original ORM with modules that allow programmers to use the same or similar Hibernate API against many SQL and NoSQL data stores with several more supported by the developer community; and they are open to more. This shows that the concept of the ORM (which started as a bridge between the object oriented and relational worlds) can be utilized in an agnostic way for accessing data from different underlying data stores, using a common/similar API paradigm. They even extended it to work with the Apache Lucene full text index engine (which is neither relational nor what I would call a database, in the traditional use of the word)!
Though I understand the tendency of people from certain disciplines to want to extend their “native language” into the computer realm so that they can describe or access their data using their native nomenclature, I think its safe to say that such a practice can have long term drawbacks. Such obscure constructs have a tendency to wither on the vine as the user audience is narrow with little chance (or reason) for adoption outside of the discipline. Then you end up with code that is so arcane no one can understand let alone maintain it.
Lastly, though the verbosity of languages like COBOL over C cannot be denied, there is something to say about a language whose programs can be read in a cursory manner and still allow the reader to understand the logic, even if only at a high level. (Dare I utter the phrase, “self-documenting”? An intended “feature” of the COBOL language.) I spent 7 years working exclusively with COBOL ’85 (BTW, its definition was last revised in 2014 - that’s 55 years of evolution since its debut in 1959!) and though I liked its “document” like format (was a full-time word processor in an earlier phase of my adult life so I could touch type), I preferred Pascal (less verbose and cleaner (at least until Java came along)).
When I look at a language’s syntax, not only its readability but the ability to easily comprehend what a statement means or what it will do is a critical factor. Not only for its use in a class room but in the real world. If I have to compile a statement in my head, read it symbol by symbol (assembling a stack in my puny brain as I go), having to worry about the presence or absence of a single character that could cancel or otherwise mutate the statement … BOOM! Stack Fault! (I’m looking at you C, or worse: Apple’s Objective-C (puke, cough, gag).) The concept of KISS should be an axiom but I think KISF (Keep It Straight Forward) is just as important. Because no matter how cool a terse line of code may look to you or a co-worker, the poor bastard that comes along later on who has to analyze what you did and document what you didn’t will be cursing your name and progeny.
A language like SQL is unique among its cousins like COBOL and C. It is English-like (which C ain’t), relatively easy to understand, the end result of a where clause is (mostly) easy to comprehend before it is executed, and (despite the annoying dialect differences) easy to understand and write.
I think a community research project to define a new query language and its syntax would be a fun exercise, even if its result is simply an interpreter that calls an API to talk SQL (or Adabas, iODBC, DB2, IMS, Rocket D3, etc.) at an engine. The result might conclude that the concept of the relational model doesn’t fit the underlying needs of the data, but something else does; or something new needs to be invented to store and retrieve the data. (Don’t forget, there’s this thing called “embedded SQL” which is a great idea and helps reduce work on the developer [but an ORM is a better solution].)
Oh, wait: wasn’t that the impetus for companies that now rule the data world? :)
So, in closing, let’s not beat on SQL too much, ok? Yes, it has its limitations, but I think it is more than incredibly powerful in most of its capabilities. It was designed to fit a need of the time based on logic that was again based on data constructs of the time. And from an interpreter no less, not a compiled language! And though relational databases may no longer be the current “fad” in certain industries or communities, I think the fact that they are so wide spread and continuing to evolve based on our needs should be celebrated, not derided as old or decrepit technology. Especially engines like PostgreSQL (unlike certain others) which is so extensible, I think its coders deserve an award. (Oh wait, they have already received some!)
Peace and Long Life, ya’ll.
P.S.: Yes, the ALTER statement would get you an F in class and possibly fired from a job back in the day. Talk about spaghetti code! It still amazes me that someone allowed that into the language, let alone figured out how to make it work.
P.P.S: Wanna talk about longevity? Check out the wiki page on the HP 3000. HP couldn’t kill it! The user base wouldn’t let go. Now the hardware has been virtualized by at least 2 companies, so the software investment lives on on commodity (read cheap) HW. Can’t say that about “traditional” mainframes! Long Live MPE!
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-17 10:44 Raymond Brinzer <ray.brinzer@gmail.com>
parent: Julien Rouhaud <rjuju123@gmail.com>
0 siblings, 0 replies; 61+ messages in thread
From: Raymond Brinzer @ 2021-09-17 10:44 UTC (permalink / raw)
To: Julien Rouhaud <rjuju123@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Wed, Sep 15, 2021 at 2:46 AM Julien Rouhaud <rjuju123@gmail.com> wrote:
> I agree, and actually sent a patch some time ago to allow usage of
> third-party parser(s). They can coexist with the core one, meaning
> that you can (if you write your parser this way) use both languages,
> even in a multi-query string. See
> https://commitfest.postgresql.org/34/3100/ for more details.
Bravo! I look forward to reading the code when I have time; seems
like it will be a nice cheat sheet for the relevant internals,
particularly as you say that you commented thoroughly.
--
Ray Brinzer
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-17 11:49 Raymond Brinzer <ray.brinzer@gmail.com>
parent: Merlin Moncure <mmoncure@gmail.com>
1 sibling, 3 replies; 61+ messages in thread
From: Raymond Brinzer @ 2021-09-17 11:49 UTC (permalink / raw)
To: Merlin Moncure <mmoncure@gmail.com>; +Cc: Guyren Howe <guyren@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Tue, Sep 14, 2021 at 9:06 AM Merlin Moncure <mmoncure@gmail.com> wrote:
> I've long thought that there is more algebraic type syntax sitting
> underneath SQL yearning to get out.
I wanted to come back to this, because I've been looking to take a
single problem (from my perspective) and explain it concisely. Your
intuition is right on the mark.
Shell syntax is a pretty good lingua franca, so let's use it. Say you
were working at the command line, and you said something like:
cat somefile | awk '{print $3 " " $1 " " $5;}' | sort | grep "^Robert"
And the shell responded with something like: ERROR: syntax error at
or near "sort". After a little tinkering, you discover: that's
because the grep has to come before the sort. But why?
The database is not going to evaluate relational operations in order,
passing the output of one into the next as a shell pipe does.
Nevertheless, they are logically independent. Each should take in a
relation and either a second relation or a predicate, and return a
relation. Or, to put it mathily, relations are closed under
relational operations. So:
Operation 1 | Operation 2
and
Operation 2 | Operation 1
should both be valid, whether or not they're semantically equivalent
(though they often are). The operations are inherently atomic, and
can be understood in isolation. That's not the case here:
SELECT col_3, col_1, col_5 FROM sometable WHERE col_3 LIKE 'Robert%'
ORDER BY col_3, col_1, col_5;
Now, if this sort of thing suits the way you think, I say, "Great!"
I'm glad you have a language which suits you. For me, it's too rigid;
it assumes too much about what I might want to say. I wouldn't
program in a language like this, or use a shell like this. I don't
want to write database queries like this. I do, because it's how I
get to talk to the awesome toy in the background, but it always
chafes.
--
Ray Brinzer
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-17 12:22 Raymond Brinzer <ray.brinzer@gmail.com>
parent: Raymond Brinzer <ray.brinzer@gmail.com>
2 siblings, 0 replies; 61+ messages in thread
From: Raymond Brinzer @ 2021-09-17 12:22 UTC (permalink / raw)
To: Merlin Moncure <mmoncure@gmail.com>; +Cc: Guyren Howe <guyren@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Fri, Sep 17, 2021 at 7:49 AM Raymond Brinzer <ray.brinzer@gmail.com> wrote:
> Now, if this sort of thing suits the way you think, I say, "Great!"
> I'm glad you have a language which suits you.
Reading this over, I realized I should have been more clear: I mean
"you" generally. I liked your comment about algebraic syntax; just
giving my take on it, not attributing anything to you.
--
Ray Brinzer
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-17 12:58 Tom Browder <tom.browder@gmail.com>
parent: Raymond Brinzer <ray.brinzer@gmail.com>
2 siblings, 0 replies; 61+ messages in thread
From: Tom Browder @ 2021-09-17 12:58 UTC (permalink / raw)
To: Raymond Brinzer <ray.brinzer@gmail.com>; +Cc: Guyren Howe <guyren@gmail.com>; Merlin Moncure <mmoncure@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Fri, Sep 17, 2021 at 06:49 Raymond Brinzer <ray.brinzer@gmail.com> wrote:
On Tue, Sep 14, 2021 at 9:06 AM Merlin Moncure <mmoncure@gmail.com> wrote:
> > I've long thought that there is more algebraic type syntax sitting
> > underneath SQL yearning to get out.
...
> Now, if this sort of thing suits the way you think, I say, "Great!"
> I'm glad you have a language which suits you. For me, it's too rigid;
> it assumes too much about what I might want to say. I wouldn't
> program in a language like this, or use a shell like this. I don't
> want to write database queries like this. I do, because it's how I
> get to talk to the awesome toy in the background, but it always
> chafes.
This thread strikes home because I've long used my favorite language,
Raku (and Perl before that) as a powerful glue language to generate
code in several languages I was forced to use and maintain during my
working years including FORTRAN, C, C++, PostScript, and SQL. I still
generate a lot of PostScript, but Raku has made it *much* easier.
Most recently I've used Raku modules for both ORM and procedural
interfaces to PostgreSQL, but with Raku's powerful grammar capability
a dedicated user can write his own language interface if he wishes.
In addition, Raku has a native C and C++ interface to ease using
PostgreSQL compiled code when necessary.
Best regards,
-Tom
P.S. See <https://raku.org; as a starting place for Raku.
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-17 19:44 Gavin Flower <GavinFlower@archidevsys.co.nz>
parent: Raymond Brinzer <ray.brinzer@gmail.com>
2 siblings, 1 reply; 61+ messages in thread
From: Gavin Flower @ 2021-09-17 19:44 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 17/09/21 23:49, Raymond Brinzer wrote:
> On Tue, Sep 14, 2021 at 9:06 AM Merlin Moncure <mmoncure@gmail.com> wrote:
>> I've long thought that there is more algebraic type syntax sitting
>> underneath SQL yearning to get out.
> I wanted to come back to this, because I've been looking to take a
> single problem (from my perspective) and explain it concisely. Your
> intuition is right on the mark.
>
> Shell syntax is a pretty good lingua franca, so let's use it. Say you
> were working at the command line, and you said something like:
>
> cat somefile | awk '{print $3 " " $1 " " $5;}' | sort | grep "^Robert"
>
> And the shell responded with something like: ERROR: syntax error at
> or near "sort". After a little tinkering, you discover: that's
> because the grep has to come before the sort. But why?
>
> The database is not going to evaluate relational operations in order,
> passing the output of one into the next as a shell pipe does.
> Nevertheless, they are logically independent. Each should take in a
> relation and either a second relation or a predicate, and return a
> relation. Or, to put it mathily, relations are closed under
> relational operations. So:
>
> Operation 1 | Operation 2
> and
> Operation 2 | Operation 1
>
> should both be valid, whether or not they're semantically equivalent
> (though they often are). The operations are inherently atomic, and
> can be understood in isolation.
[...]
In Mathematics which way round you do things may be important. For
numbers in the Real & Complex domains then this does not matter.
However, in the Quaternions it does matter, here A * B is not always the
same as B * A. And amongst the Octonions it is even worse, as there the
order in which you do things may lead to different results, so A * (B *
C) is not necessarily the same as (A * B) * C.
Another example is rotating things in 3 dimensions. Hold a book with
its front facing you. Rotate the book towards you so it is now flat,
them rotate the book along the vertical access so it is now edge on.
When you do the operations in the reverse order, then you get a
different result! Yes, you can blame the Quaternions.
In PostgreSQL, if the operations are 'not idempotent' (relies on at
least one function that has varying output for the same input
parameters) then the order in which you do things could lead to
different results.
For the optimizer to be effective then it must be allowed to do
operations in the best order it sees fit -- this is documented. Just as
you must not rely on the order in which results are returned, unless you
explicitly have an ORDER BY -- as the system will extract results in the
fastest way it knows, which may not necessarily be in the same order as
the values where inserted. This would be true, even if you had a totally
different query language.
Cheers,
Gavin
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-17 20:12 Benedict Holland <benedict.m.holland@gmail.com>
parent: Gavin Flower <GavinFlower@archidevsys.co.nz>
0 siblings, 1 reply; 61+ messages in thread
From: Benedict Holland @ 2021-09-17 20:12 UTC (permalink / raw)
To: Gavin Flower <GavinFlower@archidevsys.co.nz>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>
I love how we would admonish sql but love lisp. There isn't a perfect
language. SQL is fine. C is damn good. C++ is impossible, Java is C++ but
simple, Python is a C wrapper. God help us if we settled on Fortran. We
would still have single core processors. Lisp at least allowed
multithreading but is very hard to debug.
But back to the issue at hand, SQL is hard. It falls into the trap that C++
did where it is very hard and time consuming to make good schemas and
organize data correctly but it is very easy to do it badly. Then we try and
fix bad design in places where the fixes don't belong like the view or God
forbid the controller. That leads to horrible code and even more bugs.
I make a career of fixing broken schemas and teaching good design. I am 15
years in and learn how people screw up designs every day. Sometimes they
are beyond repair and I end up creating new designs and migrate the data.
Who knew that you should hire experts to teach novices but experts are
expensive and most of the time the code is throwaway anyway.
I don't get why there are so many programming languages out there. C is
virtually perfect. Python is C with benefits. Everything else appears to
just be offshoots of Python or Lisp and no one uses Lisp as far as I can
tell. SQL isn't really a programming language. It is just a layer on top of
data.
On Fri, Sep 17, 2021, 3:44 PM Gavin Flower <GavinFlower@archidevsys.co.nz>
wrote:
> On 17/09/21 23:49, Raymond Brinzer wrote:
> > On Tue, Sep 14, 2021 at 9:06 AM Merlin Moncure <mmoncure@gmail.com>
> wrote:
> >> I've long thought that there is more algebraic type syntax sitting
> >> underneath SQL yearning to get out.
> > I wanted to come back to this, because I've been looking to take a
> > single problem (from my perspective) and explain it concisely. Your
> > intuition is right on the mark.
> >
> > Shell syntax is a pretty good lingua franca, so let's use it. Say you
> > were working at the command line, and you said something like:
> >
> > cat somefile | awk '{print $3 " " $1 " " $5;}' | sort | grep "^Robert"
> >
> > And the shell responded with something like: ERROR: syntax error at
> > or near "sort". After a little tinkering, you discover: that's
> > because the grep has to come before the sort. But why?
> >
> > The database is not going to evaluate relational operations in order,
> > passing the output of one into the next as a shell pipe does.
> > Nevertheless, they are logically independent. Each should take in a
> > relation and either a second relation or a predicate, and return a
> > relation. Or, to put it mathily, relations are closed under
> > relational operations. So:
> >
> > Operation 1 | Operation 2
> > and
> > Operation 2 | Operation 1
> >
> > should both be valid, whether or not they're semantically equivalent
> > (though they often are). The operations are inherently atomic, and
> > can be understood in isolation.
>
> [...]
>
> In Mathematics which way round you do things may be important. For
> numbers in the Real & Complex domains then this does not matter.
> However, in the Quaternions it does matter, here A * B is not always the
> same as B * A. And amongst the Octonions it is even worse, as there the
> order in which you do things may lead to different results, so A * (B *
> C) is not necessarily the same as (A * B) * C.
>
> Another example is rotating things in 3 dimensions. Hold a book with
> its front facing you. Rotate the book towards you so it is now flat,
> them rotate the book along the vertical access so it is now edge on.
> When you do the operations in the reverse order, then you get a
> different result! Yes, you can blame the Quaternions.
>
> In PostgreSQL, if the operations are 'not idempotent' (relies on at
> least one function that has varying output for the same input
> parameters) then the order in which you do things could lead to
> different results.
>
> For the optimizer to be effective then it must be allowed to do
> operations in the best order it sees fit -- this is documented. Just as
> you must not rely on the order in which results are returned, unless you
> explicitly have an ORDER BY -- as the system will extract results in the
> fastest way it knows, which may not necessarily be in the same order as
> the values where inserted. This would be true, even if you had a totally
> different query language.
>
>
> Cheers,
> Gavin
>
>
>
>
>
^ permalink raw reply [nested|flat] 61+ messages in thread
* Re: The tragedy of SQL
@ 2021-09-18 14:03 Miles Elam <miles.elam@productops.com>
parent: Benedict Holland <benedict.m.holland@gmail.com>
0 siblings, 0 replies; 61+ messages in thread
From: Miles Elam @ 2021-09-18 14:03 UTC (permalink / raw)
To: pgsql-general <pgsql-general@lists.postgresql.org>
On Fri, Sep 17, 2021 at 1:13 PM Benedict Holland <
benedict.m.holland@gmail.com> wrote:
> I don't get why there are so many programming languages out there. C is
> virtually perfect.
>
Oh my. Even its creators didn't believe this, and that was decades ago. Use
after free. Dangling pointers. No array bounds detection. The YOLO that is
(void *).
Decades of CERT advisories tell a different story.
Don't get me wrong, I like C. It's truly a marvel that such a simple
language could be so powerful and flexible. But virtually perfect?
PostgreSQL is lauded as a great piece of C software—not just because it has
a wonderful feature set, but because large scale C development is truly a
difficult thing to get right even with the best, most dedicated developers.
See: OpenSSL.
Buffer overflows, all too common and often hard to find, are largely
impossible in some languages (Rust) and far less likely in others (Zig),
and yet they account for far too many exploits out there leading to massive
data leaks and ransomware.
We develop new languages precisely because C is not perfect. (This is not
to say any of the newer languages are, just that C should not be the end of
our search, especially in the domain-specific cases.)
^ permalink raw reply [nested|flat] 61+ messages in thread
end of thread, other threads:[~2021-09-18 14:03 UTC | newest]
Thread overview: 61+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 05:31 The tragedy of SQL Guyren Howe <guyren@gmail.com>
2021-09-14 05:51 ` Guyren Howe <guyren@gmail.com>
2021-09-14 06:18 ` Rob Sargent <robjsargent@gmail.com>
2021-09-14 06:39 ` Raymond Brinzer <ray.brinzer@gmail.com>
2021-09-14 12:13 ` Wim Bertels <wim.bertels@ucll.be>
2021-09-14 16:10 ` Michael Nolan <htfoot@gmail.com>
2021-09-14 16:20 ` Rob Sargent <robjsargent@gmail.com>
2021-09-14 16:30 ` Scottix <scottix@gmail.com>
2021-09-14 17:53 ` Raymond Brinzer <ray.brinzer@gmail.com>
2021-09-14 18:41 ` Brian Dunavant <dunavant@gmail.com>
2021-09-14 19:48 ` Raymond Brinzer <ray.brinzer@gmail.com>
2021-09-14 16:56 ` Bret Stern <bret_stern@machinemanagement.com>
2021-09-14 20:15 ` FWS Neil <neil@fairwindsoft.com>
2021-09-14 20:33 ` Raymond Brinzer <ray.brinzer@gmail.com>
2021-09-15 19:44 ` Merlin Moncure <mmoncure@gmail.com>
2021-09-16 00:30 ` FWS Neil <neil@fairwindsoft.com>
2021-09-16 00:47 ` Michael Nolan <htfoot@gmail.com>
2021-09-16 00:55 ` Adrian Klaver <adrian.klaver@aklaver.com>
2021-09-16 13:24 ` Edson Carlos Ericksson Richter <richter@simkorp.com.br>
2021-09-16 14:31 ` Merlin Moncure <mmoncure@gmail.com>
2021-09-16 16:26 ` Michael Nolan <htfoot@gmail.com>
2021-09-16 20:21 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2021-09-17 03:36 ` Ron <ronljohnsonjr@gmail.com>
2021-09-16 23:29 ` Guyren Howe <guyren@gmail.com>
2021-09-16 23:31 ` Rob Sargent <robjsargent@gmail.com>
2021-09-16 23:53 ` Mladen Gogala <gogala.mladen@gmail.com>
2021-09-17 02:28 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2021-09-17 03:39 ` Ron <ronljohnsonjr@gmail.com>
2021-09-17 03:55 ` Arnold Morein <arnie.morein@mac.com>
2021-09-14 22:53 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2021-09-14 23:25 ` Michael Nolan <htfoot@gmail.com>
2021-09-15 01:49 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2021-09-14 19:53 ` Mladen Gogala <gogala.mladen@gmail.com>
2021-09-14 19:59 ` Rob Sargent <robjsargent@gmail.com>
2021-09-14 20:00 ` Martin Ritchie <martinritchie@geotab.com>
2021-09-14 12:49 ` Rich Shepard <rshepard@appl-ecosys.com>
2021-09-14 12:59 ` Bèrto ëd Sèra <berto.d.sera@gmail.com>
2021-09-14 19:51 ` Mladen Gogala <gogala.mladen@gmail.com>
2021-09-14 19:57 ` Guyren Howe <guyren@gmail.com>
2021-09-14 20:07 ` Raymond Brinzer <ray.brinzer@gmail.com>
2021-09-14 20:08 ` Guyren Howe <guyren@gmail.com>
2021-09-14 20:51 ` Mladen Gogala <gogala.mladen@gmail.com>
2021-09-14 22:30 ` Peter J. Holzer <hjp-pgsql@hjp.at>
2021-09-14 23:05 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2021-09-14 21:01 ` Mladen Gogala <gogala.mladen@gmail.com>
2021-09-14 22:29 ` Peter J. Holzer <hjp-pgsql@hjp.at>
2021-09-15 00:32 ` Adrian Klaver <adrian.klaver@aklaver.com>
2021-09-14 13:06 ` Merlin Moncure <mmoncure@gmail.com>
2021-09-14 13:51 ` David Goodenough <david.goodenough@broadwellmanor.co.uk>
2021-09-14 14:01 ` Rob Sargent <robjsargent@gmail.com>
2021-09-14 15:24 ` Merlin Moncure <mmoncure@gmail.com>
2021-09-14 14:05 ` DAVID ROTH <adaptron@comcast.net>
2021-09-17 11:49 ` Raymond Brinzer <ray.brinzer@gmail.com>
2021-09-17 12:22 ` Raymond Brinzer <ray.brinzer@gmail.com>
2021-09-17 12:58 ` Tom Browder <tom.browder@gmail.com>
2021-09-17 19:44 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2021-09-17 20:12 ` Benedict Holland <benedict.m.holland@gmail.com>
2021-09-18 14:03 ` Miles Elam <miles.elam@productops.com>
2021-09-15 00:31 ` Raymond Brinzer <ray.brinzer@gmail.com>
2021-09-15 06:45 ` Julien Rouhaud <rjuju123@gmail.com>
2021-09-17 10:44 ` Raymond Brinzer <ray.brinzer@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox