Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rum_anyarray_addon_ops index not working #104

Open
everimbaq opened this issue Mar 21, 2022 · 1 comment
Open

rum_anyarray_addon_ops index not working #104

everimbaq opened this issue Mar 21, 2022 · 1 comment

Comments

@everimbaq
Copy link

everimbaq commented Mar 21, 2022

Or replace my question to "how to use rum index with rum_anyarray_addon_ops index?"

I have a table 'test_array', i want to index text array elements and order by another column. I created SQL as follows:

CREATE TABLE test_array (i text[],, score int8);

INSERT INTO test_array VALUES ('{}', 1), ('{0}',2), ('{1,2,3,4}',3), ('{1,2,3}',4), ('{1,2}',5),('{1}',6);

CREATE INDEX idx_array3 ON test_array USING rum (i rum_anyarray_addon_ops, score) with (attach='score', to='i');

explain  select * from test_array where i && '{1,2}' order by score offset 1 limit 5;

When i have few data, the query plan is like this :
image

But after inserted with 1 million data, the query plan is like this:
image

The costs has no difference with gin index sorting, and they both have "Bitmap Heap Scan" ,it seams that the index not working or not properly used ?

@everimbaq
Copy link
Author

everimbaq commented Mar 21, 2022

environment:

Mac m1(arm) + postgres14.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant