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 1jRfJ7-0006ac-Qr for pgsql-www@arkaria.postgresql.org; Thu, 23 Apr 2020 17:06:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRfJ6-0002oJ-KK for pgsql-www@arkaria.postgresql.org; Thu, 23 Apr 2020 17:06:36 +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 1jRfJ6-0002oC-El for pgsql-www@lists.postgresql.org; Thu, 23 Apr 2020 17:06:36 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRfIz-0004Tv-W1 for pgsql-www@postgresql.org; Thu, 23 Apr 2020 17:06:35 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1jRfIw-00049R-Mj; Thu, 23 Apr 2020 13:06:26 -0400 Date: Thu, 23 Apr 2020 13:06:26 -0400 From: Bruce Momjian To: Alvaro Herrera Cc: Marc =?iso-8859-1?Q?Recht=E9?= , PostgreSQL www Subject: Re: Backend Flowchart / Developer doc Message-ID: <20200423170626.GB4210@momjian.us> References: <20200416151729.GA9284@alvherre.pgsql> <20200421153109.GD19613@momjian.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="r5Pyd7+fXNt84Ff3" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200421153109.GD19613@momjian.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Thread moved to www for patch application. Please apply the attached patch to update the text of the backend flowchart. Thanks. --------------------------------------------------------------------------- On Tue, Apr 21, 2020 at 11:31:09AM -0400, Bruce Momjian wrote: > On Thu, Apr 16, 2020 at 11:17:29AM -0400, Alvaro Herrera wrote: > > On 2020-Apr-15, Marc Rechté wrote: > > > > > Hello, > > > > > > Don't know if this the correct list to submit this issue. > > > > > > On the https://www.postgresql.org/developer/backend/, it mentions a > > > Query.qual field which does not exist in the Query structure. > > > > I think that diagram (and the accompanying wiki page) requires a *lot* > > of more significant updating than just that field. It is wildly > > outdated. > > I developed the attached patch to fix the items I saw needed updating. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription + --r5Pyd7+fXNt84Ff3 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="backend.diff" diff --git a/templates/pages/developer/backend.html b/templates/pages/developer/backend.html index ab7e5d6..7337a07 100644 --- a/templates/pages/developer/backend.html +++ b/templates/pages/developer/backend.html @@ -56,7 +56,7 @@ or SelectStmt.

The statement is then identified as complex (SELECT / INSERT / -UPDATE / DELETE) or simple, e.g CREATE USER, ANALYZE, +UPDATE / DELETE) or simple, e.g CREATE ROLE, ANALYZE, etc. Simple utility commands that do not require the executor are processed by statement-specific functions in the commands module. Complex statements require more handling.

@@ -64,11 +64,12 @@ Complex statements require more handling.

The parser takes a complex query, and creates a Query structure that contains all the elements used by complex queries. -Query.qual holds the WHERE clause qualification, which is filled +Query.jointree holds the FROM and WHERE clauses, which is filled in by transformFromClause() and href="https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/parser/parse_clause.c">transformWhereClause(). Each table referenced in the query is represented by a RangeTableEntry, +href="https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/nodes/parsenodes.h">RangeTblEntry, and they are linked together to form the range table of the query, which is generated by transformFromClause(). @@ -95,8 +96,8 @@ system.

The optimizer uses the Query structure to determine the best table join order and join -type of each table in the RangeTable, using Query.qual(WHERE -clause) to consider optimal index usage.

The FROM +and WHERE clauses) to consider optimal index usage.

The
path module then generates an optimal Plan, --r5Pyd7+fXNt84Ff3--