Re: NOT IN subquery optimization - Mailing list pgsql-hackers

From Li, Zheng
Subject Re: NOT IN subquery optimization
Date
Msg-id E0D3286D-B229-40BD-8AEE-1F7FA820028C@amazon.com
Whole thread Raw
In response to NOT IN subquery optimization  ("Li, Zheng" <zhelli@amazon.com>)
List pgsql-hackers
Hi Hackers,

I'm sending an updated patch:
1. add GUC enable_not_in_transform to guard the optimization/transformation, the guc is on by default.
2. fix a bug: bail out NOT IN transformation early in convert_ANY_sublink_to_join so that parse->rtable doesn't get
appendedconditions are not met for the transformation.
 
3. add a CTE not in test case.

Here are the conditions for the transformation:
/*
 *Allow transformation from NOT IN query to ANTI JOIN if ALL of the
 * following conditions are true: 
 * 1. The GUC apg_not_in_transform_enabled is set to true.
 * 2. the NOT IN subquery is not hashable, in which case an expensive
 *     subplan will be generated if we don't transform.
 * 3. the subquery does not define any CTE.
 */

Regards,
-----------
Zheng Li
AWS, Amazon Aurora PostgreSQL
        
        
    
    


Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Role membership and DROP
Next
From: Mark Dilger
Date:
Subject: Re: Missing dependency tracking for TableFunc nodes