Some questions about PostgreSQL source code

From: Олег Царев <zabivator(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Some questions about PostgreSQL source code
Date: 2009-05-06 14:54:54
Message-ID: 54f48e4f0905060754t2c18e6b3vf437416e4716c2eb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello all!
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.

How to PostgreSQL process query?
I found some description on
http://anoncvs.postgresql.org/cvsweb.cgi/~checkout~/pgsql/src/tools/backend/index.html<http://anoncvs.postgresql.org/cvsweb.cgi/%7Echeckout%7E/pgsql/src/tools/backend/index.html>
Nevetheless i have questions.

Parser translate from text of query to AST.

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

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

After planner, called physical plan - executor.

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

2) How to executor's node bulding, linked, and use one another? For example
how to linked Table Scan and Sort on query select a,b,c,d from table order
by a,b? Let's assume query work without indexes, for simple describing.

3) What the function called on Prepare/Execute? How this calls translated to
executor's nodes?

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.
What is mind that switch in execAim.c? How to Prepare/Execute/Fetch work
with executor's nodes?

4) How to manipulate data on the nodes? I understand from comments, what
every node use own childs for get "tuple", where "tuple" - list of "cells".
I didn't found "cells" in source code =(
Can you descrivbe me, how to one node get data from source node, return data
for parent, and what is "data" and where i can found in source code this
entity?

For start, this questions it's very important for me.
Thank you.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-05-06 15:00:06 Re: text_pattern_ops and complex regexps
Previous Message Stephen Frost 2009-05-06 14:45:44 text_pattern_ops and complex regexps