Benjamin-Philip

Benjamin-Philip

Introduction

Ash seems to be great with regular relational data. However when I tried it out for a hobby project, where I had to represent a hierarchy of arbitrary depth, I noticed there isn’t any support for graphs or any other non relational data. I propose that data layers for some NoSQL DBs/Postgres Extension be created.

Now, I firmly believe that 90% of modern requirements can be met with a regular RDBMS. It take a very significant load and a number of optimizations elsewhere in the stack before your database becomes a bottleneck. However, there are cases where you genuinely need more than vanilla postgres or even a specialized DB. As such, my approach would be to have as little information outside of standard postgres as possible, while also limiting the number of extra services my app depends on.

Postgres and friends

One approach to enforce this principle is to stick to postgres extensions like Apache AGE (for graphs), TimescaleDB (for time-series) and JSONB (for documents). Since we are only extending the functionality of our primary database, there are 2 main of advantages:

  • No consistency problems/data duplication between DBs (since there’s only one DB)
  • Simplified deployment and reduced footprint (since there’s only one service)

However, this raises the important question: do MySQL and SQLite become second class citizens compared to Postgres in Ash? It’s possible that MySQL has equivalents for all these extensions, and we can support these features on top of AshPostgres and AshMySQL.

NoSQL DBs

The disadvantage with Postgres Extensions is that they may or may not be as performant as specialized solutions. Additionally they tend to have a smaller user base than specialized solutions. Supporting NoSQL DBs though, is a difficult task:

  • How do we decide how much data to duplicate between DBs?
  • How do we ensure consistency?
  • When does an implementation become too opinionated and actively hinder the user when he steps off the beaten path?
  • Are Postgres, MySQL and SQLite even replaceable (as they are now) when used with conjunction with a NoSQL DB?

I personally think that integrating additional databases is a problem best solved on a case-by-case basis. I don’t even think Ash trying to solve for the scale and the unique cases that demand a NoSQL database is even right thing to do, since the vast majority of Ash’s users don’t and will not operate at that scale.

Further Steps

The main question to answer is if we want to go with supporting the database extensions, or the NoSQL DBs or both and we fill in the details after that.

If we were to go with just Postgres, the order I would implement these would be:

  1. jsonb (already supported) → Document DB
  2. timescaledb (since it’s essentially a regular table, but optimized for time) → Time-Series DB
  3. pgvector (since it’s just an extra datatype with a few vector specific extensions to SQL) → Vector DB
  4. age (since graphs are queried with Cypher and not SQL) → Graph DB
  5. postgis (since a lot of specialized GIS expertise is required) → Geospatial DB

I’m happy to help if this a direction Ash Core wants to go.

If there’s demand, we could support hstore as a Redis replacement, but I’m not sure for what’s the point in the context of Elixir (or even if you need it anyway when you’ve got jsonb).

Showing Posts 1 to 7

garrison

garrison

Not to take away from your overall point, but can you explain what you mean by this? A relational database (e.g. Postgres) should be more than capable of modeling a tree (“hierarchy”) or graph. Does the problem you ran into have to do with Ash specifically?

Benjamin-Philip

Benjamin-Philip OP

I wanted to model the sub-organizations in a parent organization - each group could be split into smaller groups. In essence this a tree with unbounded depth. In retrospect, I could have handled this with CTEs or ltree.

I could probably pull off ltree with Ash or Ecto fragments.

Again, the main point is we could do with some data layers for non-tabular data. This will take time, and is a tricky problem to solve, but I think it has a lot of value.

zachdaniel

zachdaniel

Creator of Ash

What about this one? Home — AshNeo4j v0.10.1

Or this one?

Or this one?

Or this one?

Or the builtin ETS/Mnesia data layers?

We have quite a few data layers for non-relational data.

zachdaniel

zachdaniel

Creator of Ash

If you’re referring to relationships not being able to return nested graph (i.e nested) structures, I think that’s less of a limitation than you realize. Data layers also have calculations at their disposal, and we could add various things to make that more ergonomic if/when people need/want it.

Benjamin-Philip

Benjamin-Philip OP

I was unaware of these since they’re not under the ash-project organization. Maybe you should link to them from the main repo.

zachdaniel

zachdaniel

Creator of Ash

We link to the ones we or someone on our team maintains, but not necessarily to community related ones. Best way to explore packages that might fit that bill is with an awesome list like:

https://github.com/mipmip/awesome-ash-framework

or with hex

Benjamin-Philip

Benjamin-Philip OP

Hmm… I didn’t think of looking for an awesome list. I just assumed that community packages didn’t exist yet.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
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
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

Other Trending Topics Top

GenericJam
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
JesseHerrick
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
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews