By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
create table mytable (id int, value text[]);
insert into mytable values (1,'{"dog", "cat", "fish"}');
insert into mytable values (2,'{"elephant", "mouse"}');
insert into mytable values (3,'{"lizard", "dog", "parrot"}');
insert into mytable values (4,'{"bear", "bird", "cat"}');
1 rows affected
1 rows affected
1 rows affected
1 rows affected
select * from mytable where array['dog', 'cat']&&(value);
id | value |
---|---|
1 | {dog,cat,fish} |
3 | {lizard,dog,parrot} |
4 | {bear,bird,cat} |