Skip to content

Latest commit

 

History

History
31 lines (27 loc) · 1.87 KB

FullOuterJoinQuery.md

File metadata and controls

31 lines (27 loc) · 1.87 KB

Using of "FULL OUTER JOIN" in queries (FullOuterJoinQuery)

Description

You should not use FULL OUTER JOIN in queries, especially in PostgreSQL database. It is better to rewrite query without FULL OUTER JOIN.

Examples

Query below will lead to high load on PostgreSQL database.

Procedure Test1()

    Query = New Query;
    Query.Text = "SELECT
                   |    Goods.Product AS Product,
                   |    ISNULL(SalesPlan.Sum, 0) AS PlanSum,
                   |    ISNULL(SalesActual.Sum, 0) AS ActualSum
                   |FROM
                   |    Goods AS Goods
                   |        LEFT JOIN SalesPlan AS SalesPlan
                   |            FULL OUTER JOIN SalesActual AS SalesActual // Should trigger here
                   |            ON SalesPlan.Product = SalesActual.Product
                   |        ON Goods.Product = SalesPlan.Product";

EndProcedure

Sources