Gonza

Gonza

What are the persistence options in Ash?

So for my resources, and assuming I can’t yet guarantee 100% uptime, is it either Postgres or SQLite? Is there a way of perhaps working with ETS and saving its state to disk from Ash? There is no MongoDB support just yet, right?


EDIT: A little context, in case it helps: My goal here is to a) simplify my systems as much as I can. If I could just do away with the database and all its accompanying headaches, I would be a happy man. And b) engineer my systems to be performant from the start. The fewer roundtrips to external services, the better. Again, if I could just work in-memory, for most or even all parts of my apps, it would probably be ideal.
I get that it’s not always realistic or feasible though, of course. I’m only trying to get the lay of the land for now, so to speak.

Marked As Solved

zachdaniel

zachdaniel

Creator of Ash

Ultimately, using PostgreSQL is that simplification. We have in memory options, and they are useful when you need them but the truth is (and this is true for pretty much any app, framework, language) that choosing an in memory store when a database would suffice is riddled with caveats, new challenges, and solving solved problems.

In the case of Ash, AshPostgres is the only data layer that supports every capability of Ash. AshSqlite doesnt support aggregates or atomic updates, but if you must eliminate a service, then I’d suggest using Sqlite and mounting it on a persistent volume.

There are very few universals in software engineering but probably the closest I’ve come to is “just use Postgres if at all possible”.

Also Liked

FlyingNoodle

FlyingNoodle

So you want to build a system that should be persistent and scale also in the future but at the same time you don’t want to use the very software that was invented to do exactly this?

You can spin up a postgres instance somewhere for almost free and then connect to it using a query string. It can’t get any easier than this.

If you are not happy with the supplier of your DB as a service, you simply dump it, spin up a new copy somewhere else, load the dump and bob’s your aunty.

I would focus my efforts on trying to solve business problems and not re-invent things like performant persistent storage.

Gonza

Gonza

Sorry, I wasn’t trying to twist your words. I just saw that migration as a problem, but I see it wasn’t, only an opportunity you took to improve your system.

Thank you all for your replies. I learned a lot today

frankdugan3

frankdugan3

Postgres releases require the use of pg_upgrade for major versions, while minor versions will migrate seamlessly. Every distro handles this differently, but Arch specifically expects you to do the upgrade yourself. It’s a minor nuisance, but major Postgres releases only happen once a year.

Edit: Forget to mention, but on Debian, I think most people use the official apt repo the Postgres team provides, which namespaces by version number. So, you never get caught off-guard with a version change while installing updates. Or they provide the option of using one that automatically upgrades and migrates for you, always keeping it the latest version without hassle. That’s what do personally.

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is quite...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 47930 226
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement