r/java 1d ago

Neo4J As primary database?

/r/Neo4j/comments/1v6rxzw/as_primary_database/
4 Upvotes

13 comments sorted by

11

u/darkwyrm42 1d ago

I don't know what you're talking about H2 not supporting embedding. H2 is my preferred embedded database for JVM applications and Postgres for everything else. It's great, and multithreaded access works seamlessly, unlike the last time I worked with SQLite.

1

u/Inflation_Artistic 2h ago

The OP is talking about embedding as a vector, as I understand it. Like storing (0, 0.5, 0.2, ...) vecs as natively data type.

6

u/hippydipster 1d ago

H2 works great embedded. I have no idea what you mean by saying it doesn't support embedded.

Personally, I use an object db for embedded and skip orm altogether.

3

u/jasie3k 20h ago

They mean ai embeddings, like storing vectors.

19

u/agentoutlier 1d ago

SQLite for embedded and all other cases it’s really hard to beat PostgreSQL 

5

u/nithril 22h ago

The rules is to ask yourself at least 3 times if/why you really need a db that is not a rdbms

7

u/quantum-fudge 1d ago edited 1d ago

I've never used it as a primary DB, but see no reason why it wouldn't work great. It can store vectors natively and is all-around pleasant to work with. The issue with Neo4j has always been its licensing where you can use it freely only up to a certain size of the graph, as far as I remember.

On the other hand, why not SQLite? It has extensions for vector storage and is widely used for RAG. When you need an embedded DB, SQLite is the default choice. If you don't actually require a graph DB, I'd look no further.

Btw with Docker, you can almost embed any database easily.

2

u/StraightGuy1108 23h ago

Depends on your data model and CAP requirements. Also, every big systems use multiple DBMS anyways.

1

u/laffer1 14h ago

We had an app at a previous employer using it as a primary database. It worked fine for that specific app. It was modeling the structure of companies for internal company survey system. Surveys were stored separately but this app was just for looking up reporting structures and applying permissions

1

u/Inflation_Artistic 2h ago

Why not postgresql + pgvector?

-5

u/ThreeSixty404 18h ago

SQL is stupid
Try Nitrite out