pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
What type of Compiler to SQL? Memory-Image (Load-and-Go) Format?
5+ messages / 4 participants
[nested] [flat]

* What type of Compiler to SQL? Memory-Image (Load-and-Go) Format?
@ 2023-05-05 01:00  Wen Yi <chuxuec@outlook.com>
  0 siblings, 3 replies; 5+ messages in thread

From: Wen Yi @ 2023-05-05 01:00 UTC (permalink / raw)
  To: PostgreSQL General <pgsql-general@lists.postgresql.org>

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 ?

Thanks in advance!

Yours,
WenYi


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: What type of Compiler to SQL? Memory-Image (Load-and-Go) Format?
@ 2023-05-05 01:16  Bruce Momjian <bruce@momjian.us>
  parent: Wen Yi <chuxuec@outlook.com>
  2 siblings, 1 reply; 5+ messages in thread

From: Bruce Momjian @ 2023-05-05 01:16 UTC (permalink / raw)
  To: Wen Yi <chuxuec@outlook.com>; +Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>

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  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Embrace your flaws.  They make you human, rather than perfect,
  which you will never be.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: What type of Compiler to SQL? Memory-Image (Load-and-Go) Format?
@ 2023-05-05 01:19  Bruce Momjian <bruce@momjian.us>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Bruce Momjian @ 2023-05-05 01:19 UTC (permalink / raw)
  To: Wen Yi <chuxuec@outlook.com>; +Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>

On Thu, May  4, 2023 at 09:16:20PM -0400, Bruce Momjian wrote:
> 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/

Oh, this might help too:

	https://momjian.us/main/writings/pgsql/internalpics.pdf

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Embrace your flaws.  They make you human, rather than perfect,
  which you will never be.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: What type of Compiler to SQL? Memory-Image (Load-and-Go) Format?
@ 2023-05-05 01:43  David G. Johnston <david.g.johnston@gmail.com>
  parent: Wen Yi <chuxuec@outlook.com>
  2 siblings, 0 replies; 5+ messages in thread

From: David G. Johnston @ 2023-05-05 01:43 UTC (permalink / raw)
  To: Wen Yi <chuxuec@outlook.com>; +Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>

On Thu, May 4, 2023 at 6:00 PM Wen Yi <chuxuec@outlook.com> 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
>
>
>
IIUC (I haven't formally studied compilers), none of the above, or, rather,
not applicable.

I can conjure up an analogy that says the assembly language artifact has a
similar relationship to the operating system kernel as the compiled plan
has to the database executor.

David J.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: What type of Compiler to SQL? Memory-Image (Load-and-Go) Format?
@ 2023-05-05 01:51  Christophe Pettus <xof@thebuild.com>
  parent: Wen Yi <chuxuec@outlook.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Christophe Pettus @ 2023-05-05 01:51 UTC (permalink / raw)
  To: Wen Yi <chuxuec@outlook.com>; +Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>



> On May 4, 2023, at 18:00, Wen Yi <chuxuec@outlook.com> 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.
> 	• Assembly Language Format
> 	• Relocatable Binary Format
> 	• 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 ?

Hi,

Those aren't really "types of compilers."  They are different binary output formats that a compiler can generate.

PostgreSQL does not have an "SQL compiler" as such.  (It does have Just-in-Time compilation for some operations, but that's almost certainly not what you are looking for.)  It's an interpreter, in that it transforms the input language to an internal representation and then uses that for its execution, rather than reducing it all the way to machine language.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-05-05 01:51 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 01:00 What type of Compiler to SQL? Memory-Image (Load-and-Go) Format? Wen Yi <chuxuec@outlook.com>
2023-05-05 01:16 ` Bruce Momjian <bruce@momjian.us>
2023-05-05 01:19   ` Bruce Momjian <bruce@momjian.us>
2023-05-05 01:43 ` David G. Johnston <david.g.johnston@gmail.com>
2023-05-05 01:51 ` Christophe Pettus <xof@thebuild.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