下面是为JSONB创建索引的当前代码。Index("mytable_data_idx_id_key", Mytable.data['id'].astext, postgresql_using='gin')
但我犯了个错误。sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) data type text has no default operator class for access method "<e
SELECT * FROM Posts WHERE to_tsvector(body) @@ to_tsquery('postgresql'); CREATE INDEX PostText_GIN ON Posts USING GIST(PostText);
之后,使用@@文本搜索操作符的查询将使用90-100秒。因此,GiST索引确实改进了未索