Skip to content

Question: jsquery in order by #10

New issue

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

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

Already on GitHub? # to your account

Open
EliSnow opened this issue Apr 30, 2015 · 2 comments
Open

Question: jsquery in order by #10

EliSnow opened this issue Apr 30, 2015 · 2 comments

Comments

@EliSnow
Copy link

EliSnow commented Apr 30, 2015

I see how I can use the jsquery @@ operator in a WHERE clause or in a CHECK constraint. Is there an operator in either of the opclasses which would allow the use of the index in an ORDER BY clause? For example, suppose I have a table full of jsonb documents which look like:

{"time":1430432587, "place":"zoo", "animal_counts":{"monkeys":77, "tigers":3, "elephants":9.4}}

I would like to sort by animal_counts.tigers and I would like that sort to use the index.

@akorotkov
Copy link
Contributor

Unfortunately, that's not possible to this in GIN indexes yet. You could create btree expression index on js->'animal_counts'->'tigers'.

@EliSnow
Copy link
Author

EliSnow commented Aug 10, 2015

What is the status of VODKA indices making it into Postgres master?

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

No branches or pull requests

2 participants