1 2 3 4 5 6 7 8 9 10 11 12
| create table if not exists test (id int, js jsonb);
create index if not exists test_js_idx on test using gin (js jsonb_path_ops);
insert into test (id, js) select n, row_to_json(row(uuid_generate_v1(), uuid_generate_v1(), uuid_generate_v1(), uuid_generate_v1(), uuid_generate_v1())) from generate_series(1, 10000000);
select * from test where js @> jsonb '{"f2": "5e36a48c-86f3-11eb-b9d7-0242ac120005"}';
|