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 1puk3j-0008Rz-Uq for pgsql-general@arkaria.postgresql.org; Fri, 05 May 2023 01:16:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1puk3i-0001Ni-Aq for pgsql-general@arkaria.postgresql.org; Fri, 05 May 2023 01:16:30 +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 1puk3h-0001MX-VY for pgsql-general@lists.postgresql.org; Fri, 05 May 2023 01:16:29 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1puk3b-000a9p-6A for pgsql-general@lists.postgresql.org; Fri, 05 May 2023 01:16:28 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1puk3Y-00FgW8-Uu; Thu, 04 May 2023 21:16:20 -0400 Date: Thu, 4 May 2023 21:16:20 -0400 From: Bruce Momjian To: Wen Yi Cc: PostgreSQL General Subject: Re: What type of Compiler to SQL? Memory-Image (Load-and-Go) Format? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, May 5, 2023 at 01:00:37AM +0000, Wen Yi wrote: > Hi team, > I am a newbie to the postgres. > When I am studying the compiler,the text book tell me there is there type of > compiler. > > 1. Assembly Language Format > 2. Relocatable Binary Format > 3. Memory-Image (Load-and-Go) Format > > I check the postgres's sql compiler, and it's achieved by lex & yacc. > So What type of Compiler to SQL? Is Memory-Image (Load-and-Go) Format ? Lex and yacc load command-specific structures, or a Query structure for SELECT, INSERT, UPDATE, DELETE, MERGE. The Query structure is converted into a Plan which is executed by the executor. It is not compiled into assembly language. See this: https://www.postgresql.org/developer/backend/ A -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Embrace your flaws. They make you human, rather than perfect, which you will never be.