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

feat: Support functional indexes #8975

Closed
4 tasks done
chenzl25 opened this issue Apr 4, 2023 · 2 comments
Closed
4 tasks done

feat: Support functional indexes #8975

chenzl25 opened this issue Apr 4, 2023 · 2 comments
Assignees
Milestone

Comments

@chenzl25
Copy link
Contributor

chenzl25 commented Apr 4, 2023

Is your feature request related to a problem? Please describe.

Functional indexes are useful when users want to create an index on a field of jsonb column.

Example:

create table t (j jsonb);
create index idx on t(j->'k');
create index idx2 on t(j->>'k');
select * from t where j->>'k' = 'abc';

References:

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

@st1page
Copy link
Contributor

st1page commented Apr 19, 2023

should we need to support the expression in the INCLUDE clause? It might be useful if the json is big.

create table t (j jsonb);
create index idx on t(j->'k') include(j->'v1', j->'v2', (j->'abc')->'abcv1');

@chenzl25
Copy link
Contributor Author

should we need to support the expression in the INCLUDE clause? It might be useful if the json is big.

create table t (j jsonb);
create index idx on t(j->'k') include(j->'v1', j->'v2', (j->'abc')->'abcv1');

PG doesn't support expressions in included columns, so I think we don't need to support it as well. BTW, you can always put these expressions at the end of the index columns to achieve the same goal.

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

No branches or pull requests

2 participants