Re: Some questions about PostgreSQL source code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Олег Царев <zabivator(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Some questions about PostgreSQL source code
Date: 2009-05-06 15:34:49
Message-ID: 6781.1241624089@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

=?KOI8-R?B?78zFxyDjwdLF1w==?= <zabivator(at)gmail(dot)com> writes:
> I need help in study internal structures of PosrgreSQL. Sorry for my bad
> english.
> I try to get information from source code and spend five days for that, but
> now have many questions and few understanding =(
> Source code it's clear, great commented, but studing so difficult system as
> DBMS it's very strong only from source code.

Have you read
http://developer.postgresql.org/pgdocs/postgres/overview.html
? Also, many of the backend modules have README files that are
worth looking at.

> 1) Than AST go to planner for plan normalization and optimization.
> Planner work on AST structures, or build self internal tree of logical plan?

Well, both. The input is a query tree and the output is a plan tree.

> 2) Who set types of any columns? Parser or planner?

The parse analysis phase determines all data types. In principle the
semantics of the query are fully specified by the query tree.

> 1) Where in source build executor's node from logical plan (result of
> planner)?

The planner builds the plan tree (see createplan.c). There's also
a "plan state" tree that's built during ExecutorStart to hold run-time
variables for each plan node. This is needed because the plan tree is
read-only as far as the executor is concerned.

> I try look for this information in source code, and found execAim.c, with
> big swtich.
> In that switch mixed brachnes of nodes, node states, some expressions and
> aggregation.

Uh, no, execAmi just works with planstate trees (I think there's one
function in it that works with plan trees).

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2009-05-06 15:43:18 Re: Some questions about PostgreSQL source code
Previous Message Peter Eisentraut 2009-05-06 15:33:03 Re: bytea vs. pg_dump