Qqwy
TypeCheck Core Team
I want to create a simple application (But one that is not tightly coupled with Phoenix). One of the things I am considering, is whether it would be better to use Ecto (which right now does mean that an external database like Postgres or MySQL is necessary), or Mnesia:
- I really like Ecto’s query language.
- I really like not being dependent on external services; keeping everything inside OTP-land.
What are the considerations I should make? Why should I pick one over the other?
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
AstonJ
This is a good FAQ on Mnesia - any help?
bentanweihao
Then I think you can go with something like GitHub - meh/amnesia: Mnesia wrapper for Elixir. · GitHub. It’s querying syntax is pretty nice. But I would consider Ecto + Postgres an essential, well supported and documented dependency.
nubunto
Ecto gives you some handy stuff, combined with the speed, reliability and robustness of PostgreSQL. In itself, it can drive architecture adoption if the benefits are large, and believe me, they are.
It is not ~that~ coupled with Phoenix. You can still access the database directly, via PSQL or another client connected directed to it or via the Postgrex driver that Phoenix uses under the hood. PostgreSQL also has a lot of languages that can be used inside of it, such as Python, TCL, JavaScript and C.
Mnesia, on the other hand, is shipped with Erlang and can be used without additional installation. That is also tough to beat. I have experience using the Bolt database with Go, and embedded databases have their advantages in deployment and, sometimes, speed.
dgamidov
And what do you think about using PostgreSQL as persistent storage and Mnesia as cache for dictionaries (which are not supposed to be changed in runtime)?
Or it will be too complex?
Qqwy
Thank you very much for your replies!
You have convinced me to use PostgreSQL with Ecto right now, because it is probably easier to start with and maintain, and having Mnesia’s distributiveness or the extra speed of an in-memory database is not of the most importance for this application (at least at this point in time).
What would be cool, though, is if there would be an Ecto<->Mnesia adapter at some point, because being completely independent from external services remains very compelling.
wojtekmach
I also recommend just sticking with Postgres, at least for now.
Looks like someone already started writing an adapter but it’s not ready for production yet: GitHub - webengineer-max/mnesia_ecto: Ecto adapter for Mnesia · GitHub.
I can wholeheartedly recommend trying to write your own adapter as a weekend project or something - I learned a lot about Ecto’s internals (and appreciated it’s design) by doing so.
Shameless plug: you can look at my experiments at github_ecto or ets_ecto. A bare minimum adapter that does something could be this: lib/ets_ecto.ex (from an early commit in that project)
nubunto
If you are using Mnesia only as a cache, why not use ETS?
dgamidov
Actualy, I haven’t use nor Mnesia, nor ETS, yet!
ourway
I think for It’s better for Erlang/Elixir community to use Mnesia. It has few limitations. I used PostgreSQL in very large and complex projects (Red9.ir) and it has it’s own limitations. Number of connections, parallel processing, slow indexes on very large tables, distribution problems and sometimes strange disconnections due to network problems are few to mention. The main reason not to use Mnesia in lack of good libraries for Elixir. Amnesia is cool but not complete and lacks good documentation.
axelson
Isn’t one of the downsides of Mnesia that it doesn’t handle split brain?