In this section, we will look at what the query rewriting system is and when and where are the rules used by PostgreSQL.
Introducing the query rewriting system
What is the query rewriting system?
The query rewriting system is an internal component that is responsible for disassembling and rewriting a statement, transforming it into another. There are particular cases in which a statement cannot be executed, but must be transformed into another statement in order for the system to be able to perform the job.
The query rewriting system is responsible for understanding and carrying out transformation on the fly. Thanks to this feature, we can bounce a query against table A to a query against another table, B, transparently....