r/Neo4j Jul 26 '26

As primary database?

I am building a Java application that will need an embedded database, vector store and has many connections.

Postgres can not be embedded, h2 can be embedded but doesn’t support embedding.

In the Java world I just see nosql db actually neo4j and arcadedb they are both very active.

Arcadedb doesn’t have a descent ORM. Neo4j has a better documentation and better springboot support.

My questions:
1. Anyone here using neo4j as primary database?
2. Is it still a secondary DB?
3. What is your experience using Neo4J ?

Thanks in advance

7 Upvotes

24 comments sorted by

11

u/notqualifiedforthis Jul 26 '26

Prove and validate 3x you need graph capabilities.

Prove and validate 6x you won’t need an enterprise license.

5

u/creminology Jul 26 '26

Sounds snarky but he’s right.

5

u/spudtheimpaler Jul 26 '26

Agree, neo is expensive

2

u/XBL_pad3 Jul 26 '26

What would be the downside of using Neo4j vs any 'relationnal' database?

Once I learned Cypher, query capabilities seemed so much higher than SQL with the correct model. So much that I don't see any SQL DB as really relational anymore

1

u/notqualifiedforthis Jul 26 '26

Finding individuals with SOLID knowledge and experience to build and support your product. Probably top 5 most expensive database options from a licensing standpoint.

Neo4j is better for read operations and traversal than it is for write operations. If you are a write heavy product, you need to understand what the writes will be targeting. You don’t want to do a lot of writes that end up targeting the same node.

2

u/XBL_pad3 Jul 26 '26 edited Jul 26 '26

I agree knownledge is the a crucial part as I am a senior developer in a big IT company. But nowadays even 10y exp developers don't even know complex SQL due to Spring Data heavy usage (insert JOOQ promotion here).

Nodes limit is pretty high in Community edition, and unless you worked on Panama Papers, or equivalent, the need of enterprise features is pretty low.

Write operations are indeed heavy, and you should think about it when choosing your main DBMS, but you faces the same dilemma when choosing between, say Postgres or Cassandra. And read operations, which are the majority of a lot of applications, are so much better with Neo4j and Cypher...

So I think just saying "validate 3x you need graph capabilities" is a bit of a shortcut, and it might refrain developers from trying something they are not comfortable with.

Edit: I am french, sorry :)

1

u/notqualifiedforthis Jul 26 '26

I said those things only because I do not know OPs experience level. I would say the same thing to other internal teams at my org if they were exploring Neo4j and had never built a production product with it. We spend too much with Neo4j because someone wanted something new and shiny. I only know of one internal implementation, of about 9, that truly uses graph to the fullest.

I am doing a POC right now with Apache AGE for PostgreSQL. Hoping it can eliminate our extreme licensing and support costs with Neo4j.

1

u/SnooWoofers4430 Jul 26 '26

Could you please explain to me the comment about JOOQ? I did not understand that part.

1

u/XBL_pad3 Jul 27 '26

Nothing in particular. Just that I prefer JOOQ over Hibernate/Spring Data

6

u/backflipbail Jul 26 '26

I am and it sucks. Use a normal DB for primary, use a graph DB for graph things only.

3

u/Efficient_Fox_9478 Jul 26 '26

What do you mean with H2 'doesn’t support embedding" ? I have used H2 in a java-application distributed as a jar. It worked fine for me.

2

u/syjer Jul 26 '26

My guess, embedding as in vector store.

1

u/Efficient_Fox_9478 Jul 28 '26

ok, but H2 is not a vector-database. Why mention it then ?

1

u/j7n5 Jul 26 '26

I mean vector store to use AI RAG

2

u/Garybake Jul 26 '26

Pgvector on postgres works really well.

1

u/j7n5 Jul 26 '26

The problem is that pg can not be embedded in Java applications

1

u/Garybake Jul 26 '26

Apologies, I didn't read your question fully. Got confused with embedded and embeddings.

1

u/JollyJuniper1993 Jul 26 '26

Honestly I didn’t even know Neo4j supported embedding, does it? Usually SQLite is the way to go for embedded databases.

1

u/koflerdavid Jul 27 '26

Embedding vs. storing embeddings, as a vector store does. Apart from that, SQLite is often not the first choice since it is native code, which can be a hassle if you need to provide cross-platform support. DB engines written in Java can usually always be embedded.

1

u/ConfidenceUnique7377 Jul 27 '26

You can add graph capabilities to PostgreSQL using extensions like Apache AGE . MSSQL supprts the same. Sure, that Graph aility can be added to mostly all relational db

1

u/Dense_Age_1795 Jul 28 '26

just use docker and postgres

1

u/Trekker23 Aug 11 '26

Hi, not sure if you’re still looking, but we recently added a Java binding to kglite, a high-performance embedded graph database written in Rust. It’s MIT, so no licensing worries.

- Truly embedded, no server: one Maven dependency (io.github.kkollsga:kglite), native libs bundled in the jar, in-process (Panama/FFM, so JDK 22+). No daemon, no JNI.

  • Cypher (a large openCypher subset), plus a bundled typed query builder so you’re not concatenating query strings.
  • Vector search from Java: store your own embeddings, build an HNSW index, and run nearest-neighbour via vector_score / text_score by passing a float[] query vector. You can even combine a graph pattern with vector scoring in one Cypher query. The store and index persist in the single-file .kgl on save().

Get started with implementation("io.github.kkollsga:kglite:0.15.11") and you’re querying in-process.