Re: Performance improvement for queries with IN clause

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Andreas Karlsson <andreas(at)proxel(dot)se>
Cc: Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Performance improvement for queries with IN clause
Date: 2019-11-09 12:11:00
Message-ID: CAA4eK1LBUXWzmO84XPM5HXT1XT=xYpRAPHDvmnXNiy4jdt3EoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 9, 2019 at 5:22 PM Andreas Karlsson <andreas(at)proxel(dot)se> wrote:
>
> On 11/8/19 2:52 PM, Rafia Sabih wrote:
> > Now, my question is shouldn't we always use this list in sorted order,
> > in other words can there be scenarios where such a sorting will not
> > help? I am talking about only the cases where the list consists of all
> > constants and could fit in memory. Basically, when we are
> > transforming the in expression and found that it consists of all
> > constants, then sort it as well, codewise at transfromAExprIn, of course
> > there might be better ways to accomplish this.
> >
> > So, your thoughts, opinions, suggestions are more than welcome.
>
> If it is worth sorting them should depend on the index, e.g. for hash
> indexes sorting would just be a waste of time.
>

I think we also need to be careful that this might lead to regression
for cases where the list is already sorted.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2019-11-09 13:25:10 Re: TestLib::command_fails_like enhancement
Previous Message Eugen Konkov 2019-11-09 12:10:13 Re: Does 'instead of delete' trigger support modification of OLD