Re: Optimizing `WHERE x IN` query

From: Omar Roth <omarroth(at)hotmail(dot)com>
To: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Optimizing `WHERE x IN` query
Date: 2019-07-11 22:22:03
Message-ID: DM5PR18MB105110A24BA55ACD72894026DFF30@DM5PR18MB1051.namprd18.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> We had big performance issues with queries like that, and we modified
> them to use && (see
> https://www.postgresql.org/docs/current/functions-array.html ),
> resulting in a big perf boost

Much appreciated! Unfortunately I'm having trouble turning your suggestions
into a working query.

`cv.ucid && u.subscriptions` doesn't appear to work in my case since the
comparison is `text && text[]`. Something like:

```
explain (analyze, buffers) select cv.* from channel_videos cv inner join
(select subscriptions from users where email = $1) as u on array[cv.ucid] &&
u.subscriptions;
```

does work but unfortunately doesn't appear to be faster than the current
query.

Cheers

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Michael Lewis 2019-07-11 22:24:33 Re: Optimizing `WHERE x IN` query
Previous Message Ancoron Luciferis 2019-07-09 22:16:38 Re: Custom opclass for column statistics?