Benjamin-Philip

Benjamin-Philip

Non-Relational Data in Ash

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).

Most Liked

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

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

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.

Last Post!

Benjamin-Philip

Benjamin-Philip

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

Where Next?

Trending in Discussions Top

andrielfn
Hey there :waving_hand: I want to introduce Fluxon UI, a modern UI component library for Phoenix LiveView that I have been working on fo...
New
Lucassifoni
Hello, I had started to work on two “convenience” libraries some time ago : DtsBuddy and Pwmx. Due to my SAAS starting to get clients, m...
New
Herve37
We’re evaluating alternatives to Stoplight and looking for feedback on: OpenAPI support Documentation workflows Testing capabili...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
nseaSeb
The IETF published RFC 10008 in June 2026, standardizing a new HTTP method: QUERY. It’s meant to fill the gap between GET (safe/idempoten...
New
GenericJam
A question for the vibe code hive mind: what would people actually want out of a vibe-coded app? Sloppy Joe has ~20 users right now acro...
New
oldpond
Hi Folks! I have a bioinformatics question. My daughter does genetics, and they process these very large jobs when they are crunching d...
New

Other Trending Topics Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2976 91332 914
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
zachdaniel
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses: I had hope...
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
jola
I’ve been bumping into some rough edges recently with Elixir dependencies that use app config and start their own supervision trees and I...
New
quatermain
Hello, I’m sharing my plugin here in forum after some time so it has time to mature and proof yourself. I use Claude Code daily on a pr...
New

We're in Beta

About us Mission Statement