Re: NOT IN subquery optimization

From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: "Li, Zheng" <zhelli(at)amazon(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NOT IN subquery optimization
Date: 2020-04-02 04:50:58
Message-ID: af3c2a22-013f-6d78-195a-3a923c4fa07d@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

You should do small rebase (conflict with 911e7020770) and pgindent of
the patch to repair problems with long lines and backspaces.

I am reviewing your patch in small steps. Questions:
1. In the find_innerjoined_rels() routine you stop descending on
JOIN_FULL node type. I think it is wrong because if var has NOT NULL
constraint, full join can't change it to NULL.
2. The convert_NOT_IN_to_join() routine is ok, but its name is
misleading. May be you can use something like make_NOT_IN_to_join_quals()?
3. pull_up_sublinks_qual_recurse(). Comment:
"Return pullout predicate (x is NOT NULL)..."
may be change to
"Return pullout predicate (x is NOT NULL or NOT EXISTS...)"?
4. is_node_nonnullable():
I think one more case of non-nullable var may be foreign key constraint.

--
Andrey Lepikhov
Postgres Professional
https://postgrespro.com
The Russian Postgres Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2020-04-02 05:03:31 Re: Autovacuum vs vac_update_datfrozenxid() vs ?
Previous Message Dilip Kumar 2020-04-02 04:43:31 Re: pg_stat_statements issue with parallel maintenance (Was Re: WAL usage calculation patch)