Sample Header Ad - 728x90

PostgreSQL: hstore trgm search on fixed key

1 vote
2 answers
503 views
I have a table of products with custom properties for each product. So I have props::hstore column in my table. I want the user to be able to search products by key/value by first selecting the key and then entering the value with autocomplete feature. So I need two steps here: 1. Get all the keys in props field. SELECT DISTINCT with skeys should work here, but I don't understand how to create index. 2. Find most relavent values for fixed key (autocomplete feature). But seems like gin_trgm_ops can create index only on value not on value for fixed keys. Also, maybe it can be a good idea to change the hstore with jsonb, but I don't see why it can be more perfomant.
Asked by Ximik (155 rep)
Feb 6, 2019, 02:24 PM
Last activity: Feb 22, 2019, 09:48 PM