Answer the question
In order to leave comments, you need to log in
How to properly implement search in PostgreSQL by json?
There is a bulletin board and in it - a block with a filter, and the user can save the selected parameters to his bookmarks, before sending to the database, the parameters go through json_encode .
When an ad is added that matches the saved parameters, the person needs to be notified to do this, they need to do a search in the column with the saved parameters.
Question : how best to implement such functionality?
Answer the question
In order to leave comments, you need to log in
And what exactly is the problem?
Do you put all the json in the database? Or do you have a normalized representation of the parameters?
1) If all json then create functional indexes on column with json like https://stackoverflow.com/questions/36075918/postg... .
2) You can still use normalization and create a table with accumulating parameters with fields (id_user, param1, param2 ...) and save the data to the table. the parameter column takes the value 0, 1. and do indexes on the columns. True, there may be difficulties when adding a new field (read, parameter).
If you calculate the cost of hemorrhoid solutions, then 1e is more profitable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question