USE CASES

Problems you’ve probably had.

A delete run in production. A cache that’s always behind. The same customer five times. Each story below is a problem where the answer depends on how things connect, with an example of the query that answers it.

Jump to a problem

Engineering

The tests passed. Production didn’t.

The graph was mocked in CI because starting a real one for every run was too slow and too heavy. The mock didn’t know about the unique constraint, so the duplicate customer turned up in production instead.

Galactus DB answers its first query 0.8 seconds after docker run and idles at about 11 MB (Galactus DB 2.4.3 on an Intel Core i9-13900K, image already pulled). That makes it practical for every test run to start its own database, load the production schema and throw the whole thing away afterwards. Constraints, indexes and query plans then behave in CI the way they will in production.

docker run → production schema → test → remove the container
// At the start of the test run: the same schema as production
CREATE CONSTRAINT customer_email IF NOT EXISTS
FOR (c:Customer) REQUIRE c.email IS UNIQUE;

CREATE (:Customer {email: 'test@example.com'});
CREATE (:Customer {email: 'test@example.com'});  // fails here, as it would in production
Quickstart

Someone ran the delete in production.

It’s 5:40pm on a Friday. A clean-up script meant for staging has just removed every order from last quarter. The last backup is from midnight, and today’s orders came in after it.

Keep a replica that applies each change an hour after it happens. When something goes wrong, pause it. It still holds the data as it was before the mistake, so you can copy back what was lost while the main database keeps taking orders. Or promote the replica with one statement and point the app at it.

Bad delete → pause the delayed replica → copy back what was lost → resume
ALTER DATABASE orders SET CHANGE STREAM ON;
CREATE DATABASE orders_delayed AS REPLICA OF DATABASE orders
  OPTIONS {mode: 'backup', applyDelay: '1h'};

// 5:41pm
ALTER DATABASE orders_delayed PAUSE REPLICATION;

// on orders_delayed: last quarter is still there
MATCH (o:Order) WHERE date('2026-07-01') <= o.placed < date('2026-10-01')
RETURN count(o);
Replicas

The cache was right yesterday.

A customer changes their address and the order page shows the old one for another ten minutes. The search index still lists a product that sold out this morning. Every system that copies the data is out of date in its own way.

A subscription delivers each committed change, in commit order, to whatever needs to know: a cache, a search index, a warehouse. Selectors narrow it to the labels and properties that matter to that consumer. The server remembers how far each subscriber has read, so a restarted worker carries on from where it stopped.

Commit → subscription → cache, search index and warehouse, in order
CREATE SUBSCRIPTION storefront ON DATABASE shop
  FOR (p:Product) ON CREATE, DELETE, PROPERTY stock UPDATE
  FOR (c:Customer) ON PROPERTY address UPDATE;
Subscriptions

The month-end report slows down checkout.

Finance runs the big report on the first of the month, and for twenty minutes every customer request competes with it. Moving it to the night shift just means finance waits instead.

Run reports on a read-only replica that follows the main database transaction by transaction. The heavy query gets its own copy and customers keep theirs. The replica can sit on the same instance or, with Enterprise, on a server of its own.

Main database → read-only replica → reports and dashboards
ALTER DATABASE shop SET CHANGE STREAM ON;
CREATE DATABASE shop_reports AS REPLICA OF DATABASE shop;

// the report connects to shop_reports
MATCH (c:Customer)-[:PLACED]->(o:Order)
WHERE o.placed >= date.truncate('month', date()) - duration('P1M')
RETURN c.region, count(o) AS orders, sum(o.total) AS revenue
Replicas

A query ran all weekend.

On Friday afternoon somebody left the upper bound off a path pattern. By Monday it had been walking the graph for sixty hours, and nobody could say which query it was or who had started it.

Give every statement a time limit on the server, and let a driver ask for a shorter one. List what is running with the user and elapsed time, and stop the one that shouldn’t be. EXPLAIN then shows the plan without running it, so you can see what went wrong before it runs again.

Time limit → list running queries → stop one → EXPLAIN the plan
// GDB_QUERY_TIMEOUT_MS=30000 gives every statement 30 seconds
SHOW TRANSACTIONS;
TERMINATE TRANSACTIONS 'query-42';

EXPLAIN MATCH (a:Person {id: $id})-[:KNOWS*]->(b:Person)
RETURN count(b);
Time limits

It was the service three hops away.

The billing database needs twenty minutes of downtime. The services that call it directly are easy to list. The one three hops away, behind a queue and an internal API, is the one that pages somebody at 2am.

Keep services, databases, queues and the teams that own them in a graph, filled from your deploy manifests or service catalogue. One variable-length path answers “what depends on this, however indirectly?” and tells you who to warn before the change.

Database ← service ← service ← service, with the owning team for each
MATCH path = (s:Service)-[:DEPENDS_ON*1..6]->(:Database {name: $db})
RETURN s.name, s.team, length(path) AS hops
ORDER BY hops, s.name
Variable-length paths

Do our customers share a database?

It’s question 14 on the security questionnaire from your biggest prospect. The answer is yes: their data is kept apart by a customer ID in every query, and one missing filter away from a very bad week.

Give each customer a database of their own. Commercial runs any number of databases on one instance, and creating one is a single statement, so it can happen at sign-up. A session opened on one customer’s database cannot read another’s, and each can be backed up, restored or removed on its own.

Sign-up → CREATE DATABASE → every session opens on that customer’s database
// at sign-up
CREATE DATABASE tenant_0142 IF NOT EXISTS;

// every request for this customer: driver.session(database: 'tenant_0142')
MATCH (o:Order) RETURN count(o);  // only ever this customer’s orders

// when they leave, their data goes with them
DROP DATABASE tenant_0142;
Databases

The shop has to work when the internet doesn’t.

The store’s connection drops twice a week. When it does, the tills can’t check stock in the next branch or apply a bundle discount, because those answers live in a data centre two hundred miles away.

Run the graph on the server already in the back office. The image is about 5 MB to download, there are ARM64 and AMD64 builds, and it idles at about 11 MB. A replica of the central catalogue stays current while the line is up and keeps answering when it isn’t. With Enterprise at the centre, every store follows it over an encrypted Bolt connection.

Central catalogue → replica in each store → tills query locally
// on the store server
CREATE DATABASE catalogue
  AS REPLICA OF 'bolt+s://central.example.com:7687/catalogue';

MATCH (p:Product {sku: $sku})-[:IN_BUNDLE]->(b:Bundle)<-[:IN_BUNDLE]-(other:Product)
RETURN b.name, b.discount, collect(other.name) AS bundled_with
Images and platforms

Tables and SQL

The customers are in one database and their orders in another.

The graph knows who knows whom, and a second database knows who bought what. Any question that needs both, such as what a customer’s friends ordered last week, becomes two queries, a join in application code and a nightly job to keep the ids in step.

Give each customer node a typed orders table with a primary key, constraints and an index. One statement follows the relationships and reads the rows, and an order is written in the same transaction as the graph change beside it. There is one database to back up and one to pay for.

Customer → KNOWS → friend → the friend’s orders table → rows
MATCH (:Customer {id: $id})-[:KNOWS]->(f:Customer)
CALL (f) SQL {
  SELECT sku, placed_at, amount FROM f.orders
  WHERE placed_at >= $since
  ORDER BY placed_at DESC LIMIT 3
}
RETURN f.name, sku, placed_at, amount
Tables and SQL

The statement needs a running balance.

Every account page shows the balance after each entry. Working it out in the application means loading the whole history, and exporting it to a reporting system means the balance is from last night.

SQL on the account’s own table has window functions, so the running total is one query over the rows that belong to that account, read at the moment you ask. Results follow SQLite, and we check them against it on thousands of generated queries.

Account → entries table → window function → balance after each entry
MATCH (a:Account {id: $id})
CALL (a) SQL {
  SELECT posted_at, amount,
         sum(amount) OVER (ORDER BY posted_at) AS balance
  FROM a.entries
  ORDER BY posted_at DESC LIMIT 20
}
RETURN posted_at, amount, balance
Window functions

Which customers bought the recalled part?

A supplier recalls a batch. The orders sit in each customer’s own table, so the question spans all of them, and the answer then needs each customer’s city to plan the collections.

A table type gives every customer’s orders the same definition and one global index across all of them. A single SQL read finds the matching rows wherever they live, owner() gives the node that holds each row, and Cypher carries on through the graph from there.

Global index → matching rows → owner node → LIVES_IN → city
CALL SQL {
  SELECT owner(o) AS c, o.id AS order_id, o.amount AS amount
  FROM Order AS o
  WHERE o.sku = $sku AND o.placed_at >= $since
}
MATCH (c)-[:LIVES_IN]->(city:City)
RETURN city.name, c.name, order_id, amount
Table types and global indexes

The answer was two documents away.

The support bot found the right paragraph and still gave the wrong answer. The paragraph was correct when it was written. The policy that replaced it, and the region it leaves out, were in other documents.

Store your chunks as nodes and link them to the products, people and policies they mention. Vector search finds a place to start, and a hop or two through the graph brings back what is attached to it. The model sees the exception as well as the rule.

Question embedding → closest chunks → shared topics → related chunks
CALL db.index.vector.queryNodes('chunk_embedding', 5, $question)
YIELD node AS chunk, score
MATCH (chunk)-[:MENTIONS]->(topic)<-[:MENTIONS]-(related:Chunk)
WHERE related <> chunk
RETURN chunk.text, score, collect(DISTINCT topic.name) AS topics,
       collect(DISTINCT related.text)[..3] AS related
Vector indexes

Which customers are still on 4.2?

Someone asks the assistant in your team chat. Without your data it guesses, or tells them to go and look it up. Connected to Galactus DB through the MCP server, it can look it up itself.

The assistant reads the schema, writes a Cypher query and runs it as a database user you choose. Give that user a read-only role and the database refuses any write, whatever the prompt says. Every tool call goes into an audit log, so you can see exactly what it asked.

Question → get-schema → read-cypher → an answer built from real rows
// What the assistant ran for "who is still on 4.2?"
MATCH (c:Customer)-[:RUNS]->(:Release {version: $version})
RETURN c.name, c.plan
ORDER BY c.plan, c.name
The MCP server

Someone here has fixed this before.

A new engineer spends two days on a timeout that was fixed eighteen months ago, by someone in another team who still sits three desks away. The fix is in an old ticket that no keyword search turned up.

Embed your tickets, incidents and pull requests, and link them to the people who resolved them and the systems they touched. Vector search finds past work that resembles the new problem, and the graph turns it into names of people you can ask today.

Problem description → similar past tickets → who resolved them → who is still here
CALL db.index.vector.queryNodes('ticket_embedding', 20, $problem)
YIELD node AS ticket, score
MATCH (ticket)<-[:RESOLVED]-(p:Person {active: true})
RETURN p.name, p.team, count(ticket) AS similar_fixes, max(score) AS best_match
ORDER BY similar_fixes DESC, best_match DESC LIMIT 5
Vector indexes

Across the business

Each account looked fine on its own.

One account looks normal. So does the next. The ring only shows up when you notice they sign in from the same phone and all send money to the same third account.

Put accounts, devices, cards and payments in a graph and that overlap becomes a query instead of an afternoon in a spreadsheet. Start from a flagged account, find everyone who shares its devices, then follow where their money went.

Flagged account → shared device → linked accounts → onward payments
MATCH (flagged:Account {id: $id})-[:USED]->(d:Device)<-[:USED]-(other:Account)
WHERE other <> flagged
OPTIONAL MATCH (other)-[pay:SENT]->(onward:Account)
RETURN d.fingerprint, other.id,
       collect(onward.id) AS paid_to, sum(pay.amount) AS total
Paths and pathfinding

We have the same customer five times.

J. Smith in the CRM, John Smith in billing and Jon Smith in support, all with the same phone number and delivery address. Marketing emails him three times a week, and nobody can say what he is worth to you.

Load records from each system as nodes and link them to the phone numbers, emails and addresses they contain. Records that share an identifier end up next to each other. Compare their names to decide which belong to the same person, then link them to one customer record.

Record → shared phone, email or address → record from another system
MATCH (a:Record)-[:HAS]->(id:Identifier)<-[:HAS]-(b:Record)
WHERE elementId(a) < elementId(b)
  AND apoc.text.jaroWinklerDistance(a.name, b.name) > 0.85
RETURN a.source, a.name, b.source, b.name, collect(id.value) AS shared
Text functions

Three suppliers, one factory.

You buy the part from three suppliers so that one failure can’t stop the line. Then a fire at a plant you’ve never heard of stops all three, because they all bought the same component from it.

Map your suppliers, their suppliers and the components that pass between them. A variable-length path back from each product shows where the routes meet, so you find the single points of failure while there is still time to add another source.

Product ← direct suppliers ← their suppliers ← the one they all share
MATCH (:Product {sku: $sku})<-[:SUPPLIES]-(direct:Supplier)
      <-[:SUPPLIES*1..4]-(upstream:Supplier)
WITH upstream, collect(DISTINCT direct.name) AS feeds
WHERE size(feeds) > 1
RETURN upstream.name, upstream.country, feeds
ORDER BY size(feeds) DESC
Variable-length paths

Where’s the nearest engineer who can fix it?

A chiller fails at a supermarket in Leeds. The nearest engineer is twelve miles away but isn’t certified for that model. The one who is already has two jobs booked today.

Keep engineers, certifications, sites and jobs in one graph, with locations stored as points. One query filters by distance, follows the certifications and counts today’s workload, so dispatch only sees the people who can actually go.

Site → failed asset → model → certified engineers nearby → today’s jobs
MATCH (site:Site {id: $site})-[:HAS]->(:Asset {id: $asset})-[:MODEL]->(m:Model)
MATCH (e:Engineer)-[:CERTIFIED_FOR]->(m)
WITH site, e, point.distance(e.location, site.location) AS metres
WHERE metres < 50000
OPTIONAL MATCH (e)-[:ASSIGNED]->(j:Job {date: date()})
RETURN e.name, round(metres / 1609.34) AS miles, count(j) AS jobs_today
ORDER BY jobs_today, miles LIMIT 5
Spatial types

People who bought the tent also bought the stove.

It is one of the oldest ideas in retail. The shop that makes the suggestion at the right moment sells the stove, and in a graph the suggestion is two hops away.

Connect customers to what they view, buy and rate. Start with plain co-purchase counts like the query below. When you need more, node similarity, KNN and FastRP embeddings run inside the database, and you rank the results by what you care about, such as stock, margin or how new an item is.

Customer → purchases → customers who bought the same → what else they bought
MATCH (me:Customer {id: $id})-[:BOUGHT]->(:Product)
      <-[:BOUGHT]-(peer:Customer)-[:BOUGHT]->(rec:Product)
WHERE NOT (me)-[:BOUGHT]->(rec)
RETURN rec.name, count(DISTINCT peer) AS bought_by
ORDER BY bought_by DESC LIMIT 10
Similarity algorithms

Nobody decided that Sam should see payroll.

Sam is a contractor. Contractors sit inside the engineering group, engineering was given the analyst role years ago, and analysts can read payroll. Nobody decided it. It just happened.

Nested groups and inherited roles are quick to set up and slow to audit with joins. In a graph, “who can read this, and how?” is a single path query. Run it before an audit, or every time a group changes.

User → nested groups → role → resource
MATCH (u:User)-[:MEMBER_OF*1..6]->(:Group)-[:GRANTED]->(role:Role)
      -[:CAN_READ]->(:Resource {name: $resource})
RETURN DISTINCT u.name, role.name
Variable-length paths

Scheduling

Everyone’s day works until someone calls in sick.

The rota took a morning to build. At twenty to seven one person calls in sick, and their visits need new homes before eight without wrecking everyone else’s day.

Keep people, visits and bookings in the graph. The Native Scheduler reads the current bookings as a baseline, so the re-plan moves only the visits that have to move, keeps travel between visits realistic and books double-up visits on two people at one start.

Visit → current booking → people still available → new plan
MATCH (v:Visit) WITH collect(v) AS visits
MATCH (p:Staff) WITH visits, collect(p) AS staff
CALL gdb.schedule.solve({tasks: visits, resources: staff,
  task: {required: 'coalesce(t.people, 1)',
         baselineStart: '[(p)-[b:BOOKED]->(t) | b.start][0]',
         baselineResources: '[(p)-[:BOOKED]->(t) | p]'},
  resource: {windows: 'CASE WHEN r.sick THEN [] ELSE null END'}})
YIELD task, resources, start
RETURN task.name, [p IN resources | p.name], start
Re-planning recipe

She’s in three dances and needs fifteen minutes to change.

Two stages, two sessions and a hundred dances. Half the dancers appear in more than one, each needs time to change costume, and the heats have to finish before the finals.

Dances are tasks, stages are resources, and the dancers are participants: the graph says who is in each dance, and each dancer’s timeline needs fifteen minutes between dances. A setup table adds the stage’s change between styles, and precedence keeps heats ahead of finals.

Dance ← dancers (participants) → stage and session → running order
MATCH (d:Dance) WITH collect(d) AS dances
MATCH (s:Stage) WITH dances, collect(s) AS stages
CALL gdb.schedule.solve({tasks: dances, resources: stages,
  task: {duration: 't.minutes', kind: 't.style',
         participants: '[(p:Dancer)-[:DANCES_IN]->(t) | p]'},
  participant: {changeover: 15},
  setups: [{from: '*', to: '*', time: 5}]})
YIELD task, resource, start
RETURN task.name, resource.name, start ORDER BY start
See it in the demo

The surgeon is free. The theatre isn’t.

An operation needs a surgeon with the right speciality, an anaesthetist and a theatre, all at the same moment. Each has their own commitments, and a theatre needs cleaning between cases.

List what each operation needs, each from its own pool. The scheduler only books an operation when all three are free together, at one shared start, and never half-books it. Emergencies are fixed in place and everything else fits around them.

Operation → surgeon + anaesthetist + theatre → one start
CALL gdb.schedule.solve({tasks: $ops, resources: $staff,
  needs: [{count: 1, where: 'r:Surgeon AND r.speciality = t.speciality'},
          {count: 1, where: 'r:Anaesthetist'},
          {count: 1, where: 'r:Theatre'}],
  resource: {changeover: 'CASE WHEN r:Theatre THEN 20 ELSE 0 END'},
  task: {fixedStart: 't.fixedAt', priority: 't.urgency'}})
YIELD task, resources, start, end
Theatre list recipe

No student sits two exams at once.

Three hundred exams, four halls and students who take different combinations of subjects. Nobody should sit two at the same time, or three in a day, and the big hall can hold several exams if the seats add up.

Cohorts or students link to the exams they sit, so they become participants whose timelines can’t overlap. Halls have seats as units and each exam uses as many as it has students. A per-day rule caps exams per student.

Student → sits → exam → hall seats → day
CALL gdb.schedule.solve({tasks: $exams, resources: $halls,
  task: {demand: 't.students',
         participants: '[(c:Cohort)-[:SITS]->(t) | c]'},
  resource: {units: 'r.seats'},
  participant: {changeover: duration({minutes: 30})},
  constraints: [{type: 'maxTasks', per: 'participant',
                 count: 2, period: duration({days: 1})}]})
YIELD task, resource, start
Exam timetable recipe

Every team needs three days’ rest.

Twelve teams, three pitches and a season of rounds. No team can play twice in a round or on consecutive days, and everyone wants the season to finish on time.

Teams are participants of the fixtures they play, with a three-day changeover. Pitches are resources. A rule allows one match per team per round, and a target at the start of the season packs the rounds as early as the rules allow.

Team → plays → fixture → pitch → round
MATCH (m:Fixture) WITH collect(m) AS fixtures
MATCH (p:Pitch) WITH fixtures, collect(p) AS pitches
CALL gdb.schedule.solve({tasks: fixtures, resources: pitches,
  task: {participants: '[(team:Team)-[:PLAYS]->(t) | team]'},
  participant: {changeover: duration({days: 3})},
  constraints: [{type: 'maxTasks', per: 'participant',
                 count: 1, period: duration({days: 7})}]})
YIELD task, resource, start
Fixtures recipe

Changing from black paint to white takes an hour.

Group every colour together and the line runs efficiently, but some orders go out late. Run in due-date order and half the day is spent cleaning the line.

Each job has a kind, and a setup table says how long each change takes on a line. Lateness follows a curve, so ten minutes late costs little and an hour late costs a lot. The scheduler weighs grouping colours against due dates.

Job → colour → line → setup time → due date
CALL gdb.schedule.solve({tasks: $jobs, resources: $lines,
  task: {kind: 't.colour', target: 't.due - t.minutes', duration: 't.minutes'},
  lateCurve: {points: [[10, 2.5], [20, 15], [60, 100]], smooth: true},
  setups: [{from: 'black', to: 'white', time: 60},
           {from: 'white', to: 'black', time: 25}]})
YIELD task, resource, start, drift
Factory floor recipe

Two bays, five patients at nine o’clock.

There are enough clinicians for everyone who turns up at nine, but only two bays. The third patient waits in the corridor, and the scanner appointment has to go to someone trained on it.

The clinic is a place with two units, so at most two appointments run there at once, whoever takes them. Eligibility follows the graph: a clinician can take an appointment only if they hold every skill it needs. A follow-up can be tied to come 60 to 120 minutes after the first appointment.

Appointment → place (2 bays) and needed skills → clinician
CALL gdb.schedule.solve({tasks: $appointments, resources: $clinicians,
  task: {place: '[(t)-[:AT]->(c) | c][0]'},
  participant: {units: 'p.units'},
  pair: {eligible: 'all(s IN [(t)-[:NEEDS]->(s) | s] WHERE EXISTS { (r)-[:HAS]->(s) })'}})
YIELD task, resource, start
Clinic recipe

Everyone is promised four hours, and nobody works more than eight.

Contracts guarantee hours, the law caps them, and people notice when one colleague gets all the long days. Balancing it by hand every week is where the morning goes.

Rules sit next to the data: a minimum with a penalty for guaranteed hours, a hard maximum per day, and a workload tier that evens out who works most and least. Penalties can follow curves, so being an hour short matters more than being ten minutes short.

Person → contract rules → shifts → balanced rota
CALL gdb.schedule.solve.stats({tasks: $shifts, resources: $staff,
  constraints: [{type: 'minWork', amount: 240, penalty: 10},
                {type: 'maxWork', amount: 480, period: 1440},
                {type: 'idle', penalty: 0.1}],
  objective: ['unassigned', 'penalty', 'workload', 'drift']})
YIELD tasksAssigned, objective
Rota recipe

Evaluate it on your workload.

Bring the queries your application runs. Measure latency, throughput, memory and recovery on your own infrastructure. We can help with the setup.

Plan an evaluation

What to check

  • Do your Cypher queries and drivers work?
  • How much memory do your graph and indexes need?
  • How do concurrent writes and durability affect performance?
  • Does deployment and authentication fit your setup?
  • Which licence fits your use case?
Compatibility guide

Try it with your own data.

Community is free for any use and needs no account or licence key. One Compose file starts the database and Explorer.