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-09 14:44:37
Message-ID: DM5PR18MB10510CC0FAA5E7C49F573C09DFF10@DM5PR18MB1051.namprd18.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

The suggested query indeed appears to be faster. Thank you.

> Did you try if a properly normalized model performs better?

I've tested the below schema, which doesn't appear to perform much better but
has a couple other advantages for my application:

```
create table subscriptions (
email text references users(email),
ucid text,
primary key (email, ucid)
);

explain (analyze, buffers) select cv.* from channel_videos cv, subscriptions s
where cv.ucid = s.ucid and s.email = $1;

```

Is there something else here I'm missing?

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Nicolas Charles 2019-07-09 15:21:34 Re: Optimizing `WHERE x IN` query
Previous Message Peter Geoghegan 2019-07-08 00:26:23 Re: UUID v1 optimizations...