acrolink
Storing any type of Elixir data in PostgreSQL
I stumbled upon this:
https://medium.com/@kaisersly/storing-any-elixir-data-in-postgres-e8f93367f473
I am looking for a way to store transient data in PostgreSQL. Basically, LLMChains that can grow big in size.
Is there any better way to do it ? The article suggests using :binary and Term. Or is this actually the perfect way to do it ?
Marked As Solved
Aetherus
Maybe, just maybe, you can add two columns, one is for the key (indexed), and the other is for the arbitrary Erlang/Elixir data structure encoded in binary.
Also Liked
Aetherus
:erlang.term_to_binary(term) compresses the data by default.
:erlang.term_to_binary(term, compressed: 9) compress the data at highest level.
:erlang.term_to_binary(term, compressed: false) turns off the compression.
benwilson512
How big is big? Past a certain point you probably want an object store. Before that though binary and term are quite useful. If you want want to be able to search it from within the DB though consider :jsonb
dimitarvp
If size is an issue you either use term_to_binary with compression or just use a full-blown object store as @benwilson512 suggested.
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









