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

From: Dmitry Lazurkin <dilaz03(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "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-08-01 16:24:13
Message-ID: 66821561-f2f6-21e4-8f91-37a2b23b768e@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/01/2017 07:13 PM, Jeff Janes wrote:
> I think that HashSet is a Java-specific term. It is just a hash table
> in which there is no data to store, just the key itself (and probably
> a cash of the hashcode of that key), correct?

Yes. And in Java HashSet implemented on top of HashMap (:

> I think a more general solution would be to get the planner and
> executor to run the in-list query using the Hash Join, the same way it
> runs the in-VALUES one.

Have additional plan nodes big overhead?

> I was impressed at how well the JSON and hstore worked, you might want
> to look at how they do it. It is must be using an internal hash table
> of some sort.

JSONB and HSTORE keep sorted pairs and use binary search.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Murtuza Zabuawala 2017-08-01 16:33:02 Re: [GENERAL] Not able to create collation on Windows
Previous Message Dan Cooperstock at Software4Nonprofits 2017-08-01 16:21:25 Problem compiling a C function on Windows - not finding _palloc0@4