Unable to index my int array ERROR: set-returning functions are not allowed in index expressions

问题描述 投票:0回答:0

CREATE TABLE mytable (
  id SERIAL PRIMARY KEY,
  name VARCHAR(255),
  category_ids INT[]
);

CREATE INDEX mytable_category_ids_elem_idx ON mytable USING gin ((unnest(category_ids)));

我明白了

SQL Error [0A000]: ERROR: set-returning functions are not allowed in index expressions Position: 67

我想加快我的查询,其中有这个条款:

WHERE category_ids = '{1,2,3}'

postgresql
© www.soinside.com 2019 - 2024. All rights reserved.