Kurisu
Please can you help me in choosing a good database model to facilitate search queries using PostgreSQL full text search?
Let’s say I have 3 tables: users, profiles and skills.
Resulting in following associations:
- User
has_oneProfile (:profile) and Profilebelongs_toUser (:user). - User
has_manySkill (:skills) and Skillbelongs_toUser (:user).
My search feature will show users whith user.name, or profile.introduction, or having one or more skills matching the search term.
My problem here is the one-to-many realtionship between users and skills.
I’m thinking to create a denormaized table or a view just for this search feature.
For example skill_documents with user_id and tsv column (to store the concatenation of all skills names of a given user) . This way everytime an user adds, removes or updates a skill the tsv column will be updated accordingly.
Please do you think this is an acceptable solution or what would you suggest me instead?
Thanks
Edit: I’m not finding the general programming category so I put my question in the members only one.
Edit 2: So as suggested by @dimitarvp I moved my question to Elixir category and added Ecto tags. There is no Ecto dedicated category apparently.
Most Liked
entone
I started playing with Sonic recently, and it’s a really nice lightweight full-text search system. It doesn’t have any distributed functionality, but you could potentially run it using a side-car pattern for super-fast full-text search.
You can see my usage here, GitHub - entone/web_archive_viewer: View MAFF webpage archives directly from the compressed Zip file · GitHub
dimitarvp
This is a perfectly valid question for the Ecto category btw.
entone
I’m a big proponent of a polyglot database approach, and choosing the right tool for the job. I think pushing your text data to a purpose built DB allows you to make the right choices with regards to your SQL architecture without sacrificing anything for your search functionality.
Same thing for telemetry data and logs.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









