Equivalence Rules

Started by Ali Piroozialmost 12 years ago2 messages
#1Ali Piroozi
falipiroozi@gmail.com
1 attachment(s)

Hi

My question is:
Does PostgreSQL implements equivalence rules(from those are listed in
email's attachment)?
Which function or which part of source code(in PostgreSQL ) implements
the equivalence rules?
I think, this should be implemented in query optimization part of
PostgreSQL, but which rule
and where, I don't know?
I want to use that(function or part of source code), to produce the
equivalence Relational Algebras (based on equivalence rules in
attachment) for a given SQL query(Relational Algebra).

Thanks

Attachments:

EquivalenceRules.pdfapplication/pdf; name=EquivalenceRules.pdfDownload
#2Antonin Houska
antonin.houska@gmail.com
In reply to: Ali Piroozi (#1)
Re: Equivalence Rules

There are 2 kinds of rules in this document: for joins and for set
operations.

As for joins, I think they are all about *inner* joins. Postgres (IMO)
"implements" them by not doing anything special if query only contains
inner joins.

On the other hand, attention has to be paid if there's at least one
*outer* join in the query. Identities summarized in 'Valid OUTER JOIN
Optimizations' section of optimizer/README come into play then. I think
make_outerjoininfo() is the code to recognize these relationships in the
original query, and join_is_legal() then to check if new joins (those
not present in the original query) do not change the semantics.

(As for set operations, someone else needs to explain.)

// Antonin Houska (Tony)

On 03/02/2014 09:02 AM, Ali Piroozi wrote:

Hi

My question is:
Does PostgreSQL implements equivalence rules(from those are listed in
email's attachment)?
Which function or which part of source code(in PostgreSQL ) implements
the equivalence rules?
I think, this should be implemented in query optimization part of
PostgreSQL, but which rule
and where, I don't know?
I want to use that(function or part of source code), to produce the
equivalence Relational Algebras (based on equivalence rules in
attachment) for a given SQL query(Relational Algebra).

Thanks

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers