Skip to Content
Course content

We begin tracing the lifecycle of a query from the moment it hits the server. This chapter deconstructs the lexical analysis and parsing phases, where SQL text is transformed into an internal parse tree. Students will investigate how the "Traffic Cop" routes queries and handles utility versus optimizable statements.

Outside Reading
  • Official Docs: Chapter 52: System Catalogs. (Specifically assign the pages on pg_class and pg_attribute so students understand what the parser is checking).
  • Official Docs: Chapter 53: Frontend/Backend Protocol. (How the wire protocol delivers the query string).
  • GitHub Source: src/backend/parser/scan.l and src/backend/parser/gram.y. These are the actual Flex and Bison files. Have students trace how a SELECT keyword is tokenized and mapped to a grammar rule.
  • GitHub Source: src/backend/tcop/postgres.c. The "Traffic Cop" main loop. Read the exec_simple_query() function.
Rating
0 0

There are no comments for now.

to be the first to leave a comment.