Re: Perfomance of IN-clause with many elements and possible solutions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Dmitry Lazurkin <dilaz03(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Perfomance of IN-clause with many elements and possible solutions
Date: 2017-07-24 22:15:03
Message-ID: CAKFQuwaHP_ZzCQZVdt-6DrjV0WHaSaYJDoDCNX-nf3NNXGUtHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jul 24, 2017 at 3:12 PM, Dmitry Lazurkin <dilaz03(at)gmail(dot)com> wrote:

> And I have one question. I don't understand why IN-VALUES doesn't use
> Semi-Join? PostgreSQL has Hash Semi-Join... For which task the database
> has node of this type?
>

​Semi-Join is canonically written as:

SELECT *
FROM tbl
WHERE EXISTS (SELECT 1 FROM tbl2 WHERE tbl.id = tbl2.id)

The main difference between IN and EXISTS is NULL semantics.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry Lazurkin 2017-07-24 22:22:30 Re: Perfomance of IN-clause with many elements and possible solutions
Previous Message Dmitry Lazurkin 2017-07-24 22:12:04 Re: Perfomance of IN-clause with many elements and possible solutions