Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nIKOt-0004Gc-Ro for pgsql-general@arkaria.postgresql.org; Fri, 11 Feb 2022 01:07:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nIKOs-00074w-MB for pgsql-general@arkaria.postgresql.org; Fri, 11 Feb 2022 01:07:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nIKOs-00074n-4s for pgsql-general@lists.postgresql.org; Fri, 11 Feb 2022 01:07:02 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nIKOp-0008C5-Hg for pgsql-general@lists.postgresql.org; Fri, 11 Feb 2022 01:07:01 +0000 Received: by mail-qk1-x72d.google.com with SMTP id o25so6812165qkj.7 for ; Thu, 10 Feb 2022 17:06:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to; bh=p03tZeJ4f6OElNamhYBdrdBfOTswgvIDgwKTmtNNZYE=; b=gYo2IlRvyZ2JXmzkgaKvdkgU7Y0Ov/kSevbmeHFmGYCDZgqvtB5sa14aQAI9hiiMFQ OxX7IUmp2E2y+JD5WZKGmtJFkAJIfHFmZWYoqe3r3CJPDRYATnE9K+apaQ+O3M+agmu8 jSd8jvE+wXPnN0D0dxYZXV7PbX3H2IBYD1t4rYH3dcUYvT01zoRDzfdo+rCzjDwl0cIK xu/lC0ZyqvNfKQU3IFuwuHIJx6lFjNBBUL9L5DYS8HQUONhREDZ1rEEwZrl3lzndKqF0 VvW/V63LGQQ0atYJpbQpkU7SywhUB7V/c/XhZyn35aBR/xBNc19GkiYcEPgKLQhmm+SS xdwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to; bh=p03tZeJ4f6OElNamhYBdrdBfOTswgvIDgwKTmtNNZYE=; b=GXDH0o8A2BwkEHOSB9hy+e/tphZR8eQxdU9YfxlJ3vf0df6B6/c4l37UU7xX2LqPcb PiGU/rv/uEZf9gzaLzvKaSBYJc3UzrVqRE4N04Cm/5YNjbkTzR0K4PeJjtRCuLhRVo+E SA/QqYDMVOF/Uu5jgT99Fjg5pBaSebmsDOTsQWL2Ps4zOfg3pzWWBBSfTtBxntj8lAeQ eCxeTM6DPVDLNUHgozce/hJv4DUwPurOur8kK6w2SS49OqmSbEmZAIE87yHab5kocMCn PFsYltcZwfMSCnDb72Vh3TnHYYH3DjVypnoOzL8UMd1EdSN6EwBCwoghzr24BqjQ5uRG qQFg== X-Gm-Message-State: AOAM5339dzHRKjV3f5PsgqPErtQy0HBQAqt/JRmqBrJXsgprHaKbSqmG axSpvS8bapuilrrGAOa5pOVB+71wYXJn3Q== X-Google-Smtp-Source: ABdhPJxNi+FWCNkrpjqokB4sCw2Ddt047ya3OggBHSs8tHjwrvaE6vXDshZbiu/YKsPGjX4/OM7yHw== X-Received: by 2002:a05:620a:4629:: with SMTP id br41mr5220578qkb.113.1644541618022; Thu, 10 Feb 2022 17:06:58 -0800 (PST) Received: from [192.168.2.100] (pool-72-79-19-93.nwrknj.east.verizon.net. [72.79.19.93]) by smtp.gmail.com with ESMTPSA id y5sm10952095qkp.37.2022.02.10.17.06.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Feb 2022 17:06:57 -0800 (PST) Content-Type: multipart/alternative; boundary="------------LOgMPj8kWvVuYNaojDZsze7s" Message-ID: <1d76a9dc-1260-fea5-86ee-b6ba7bad2927@gmail.com> Date: Thu, 10 Feb 2022 20:06:56 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: Can we go beyond the standard to make Postgres radically better? Content-Language: en-US To: pgsql-general@lists.postgresql.org References: <7117322c-185c-4283-990d-6646d8476409@Spark> <20220210172229.4it7ioddvrtmws37@hjp.at> <20220210172545.f7vtdcrg325v3xlx@hjp.at> <937E9BA7-F8D9-4547-A171-AC1497470A0C@gmail.com> From: Mladen Gogala In-Reply-To: <937E9BA7-F8D9-4547-A171-AC1497470A0C@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------LOgMPj8kWvVuYNaojDZsze7s Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Please, don't top-post. On 2/10/22 17:51, Guyren Howe wrote: > When you dig into it, the powerful idea here is the relational > algebra, and its equivalence to a first-orderish logic. > > I put up with SQL so I can use relations, and I love Postgres because > it has the least bad SQL (by a mile!) As you've said, the basic motivation behind SQL is the relational algebra from the branch of mathematics called "naive set theory". SQL does that really well. Late Dr. Ted Codd was a mathematician, so he was also aware of non-naive set theory so the "selection language" of Zermelo's axiom of choice was also included. That is why we are selecting elements of subsets and not defining subsets. Codd was also working for IBM, once great company, whose name stands for "It's Better Manually". IBM was doing lots of business with the banks (figures) so the transaction handling part was modeled after the banking business. When I've had my first course in SQL, back in 1988, I was given analogy with writing checks: I A writes a $100 check to B, one of the following two things can happen: either A has enough money to cover the check, in which case B will have $100 more in his account and A will have $100 less or, if the transaction doesn't go through, nothing will happen. Any mixed outcome in which B is $100 richer but A doesn't have $100 less money in his account or A has $100 less money but B is not $100 richer is strictly prohibited. That transaction must happen atomically, as a whole or not happen at all. So, that's SQL for you: relational algebra plus banking business. Relational algebra implementation is rather good, although a tad too verbose. Transactional part is excellent and still reflects the needs of the business community today. > > But SQL is a terrible, no good, very bad language. I cannot accept such a religious persecution of SQL without a detailed explanation. > > I don’t really understand why folks who love the relational model > aren’t perpetually up in arms about SQL being their only option. Much > better query languages are known and well studied. > > https://www.scattered-thoughts.net/writing/against-sql > > I’d love to see Postgres offer say Datalog. But until that Halcyon > day, we could at least aggressively extend SQL to make it less awful. It will take much more than a blog post to eradicate decades of investment into SQL by both computer scientists and business community. I've seen the same crusade against SQL on Slashdot and I assume you were behind that as well. So, if I were you, I would establish a company to implement Datalog language in a database and try to sell that to the people. That happened in 1979: Larry Ellison, Bob Miner and Ed Oates established a company and offered a SQL product, competing with hierarchical databases like IMS and CICS/DL1, to the world. The rest is history. I am sure that if you do the same and if you are right about the Datalog, a brilliant future is ahead of you. That is the way of the Force. Anything can happen. A young student can come from Africa, convinced that he can sell electric cars and be very successful while doing that. So successful that he became the richest man in the world. I am sure that your endeavor with Datalog will have similar success. Market decides what is the standard. May the Force be with you. In the mean time, I will still be using SQL. -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com --------------LOgMPj8kWvVuYNaojDZsze7s Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
Please, don't top-post.

On 2/10/22 17:51, Guyren Howe wrote:
When you dig into it, the powerful idea here is the relational algebra, and its equivalence to a first-orderish logic.

I put up with SQL so I can use relations, and I love Postgres because it has the least bad SQL (by a mile!)

As you've said, the basic motivation behind SQL is the relational algebra from the branch of mathematics called "naive set theory". SQL does that really well. Late Dr. Ted Codd was a mathematician, so he was also aware of non-naive set theory so the "selection language" of Zermelo's axiom of choice was also included. That is why we are selecting elements of subsets and not defining subsets. Codd was also working for IBM, once great company, whose name stands for "It's Better Manually". IBM was doing lots of business with the banks (figures) so the transaction handling part was modeled after the banking business. When I've had my first course in SQL, back in 1988, I was given analogy with writing checks: I A writes a $100 check to B, one of the following two things can happen: either A has enough money to cover the check, in which case B will have $100 more in his account and A will have $100 less or, if the transaction doesn't go through, nothing will happen. Any mixed outcome in which B is $100 richer but A doesn't have $100 less money in his account or A has $100 less money but B is not $100 richer is strictly prohibited. That transaction must happen atomically, as a whole or not happen at all. So, that's SQL for you: relational algebra plus banking business. Relational algebra implementation is rather good, although a tad too verbose. Transactional part is excellent and still reflects the needs of the business community today.



But SQL is a terrible, no good, very bad language.


I cannot accept such a religious persecution of SQL without a detailed explanation.



I don’t really understand why folks who love the relational model aren’t perpetually up in arms about SQL being their only option. Much better query languages are known and well studied.


I’d love to see Postgres offer say Datalog. But until that Halcyon day, we could at least aggressively extend SQL to make it less awful.

It will take much more than a blog post to eradicate decades of investment into SQL by both computer scientists and business community. I've seen the same crusade against SQL on Slashdot and I assume you were behind that as well. So, if I were you, I would establish a company to implement Datalog language in a database and try to sell that to the people. That happened in 1979: Larry Ellison, Bob Miner and Ed Oates established a company and offered a SQL product, competing with hierarchical databases like IMS and CICS/DL1, to the world. The rest is history. I am sure that if you do the same and if you are right about the Datalog, a brilliant future is ahead of you. That is the way of the Force. Anything can happen. A young student can come from Africa, convinced that he can sell electric cars and be very successful while doing that.  So successful that he became the richest man in the world. I am sure that your endeavor with Datalog will have similar success. Market decides what is the standard. May the Force be with you. In the mean time, I will still be using SQL.

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
--------------LOgMPj8kWvVuYNaojDZsze7s--