Did you create a GIN index on subscriptions column to support the &&
operator?
> 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
Le 07/07/2019 à 16:33, Thomas Kellerer a écrit :
Omar Roth schrieb am 07.07.2019 um 15:43:
Currently, the query I'm using to generate a user's feed is:
```
SELECT * FROM channel_videos WHERE ucid IN (SELECT
unnest(subscriptions) FROM
users WHERE email = $1) ORDER BY published DESC;
```
You
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 te
Omar Roth schrieb am 07.07.2019 um 15:43:
Currently, the query I'm using to generate a user's feed is:
```
SELECT * FROM channel_videos WHERE ucid IN (SELECT unnest(subscriptions) FROM
users WHERE email = $1) ORDER BY published DESC;
```
You could try an EXISTS query without unnest:
select cv