cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Is the cost to switch between local databases for a single query hight?

Hello guys

The title says everything
To keep it simple and easy to figure out, let's say we have two important nodes in this schema.

3X_f_a_fa4aadd175f9fa1c1f51e91cc67f470251fe5555.png

Node A - A House node named 'A' from Database housing
Proxy node - A unnamed House node from Database following

The 'proxy node' of the node A is a node that only contains the uuid and database name of the node A to be use as a proxy or gateway to or from the actual node A.

The purpose of the following database is to split the housing data who never change from the following data who change every minute and don't share at all the same model.

But, they do share some exact same House nodes. Let's say the housing database would simply and mostly contain House and Owner nodes.

The following database will contain a FollowUp node with description, contact,etc. connected to one or multiple House(s) ( proxy nodes ) containing only the properties necessary to reach their sibling in the housing database.

When a client is querying the housing database, the main and frequent question who needs to be optimise is:

What are the House(s) who have x housing space?
Where x is a positive integer

The tricky part is, the House(s) who fits with the x number must return their coordinates AND their color too. The color belongs to the follow-up associated to the House in the following database and NOT the House of the housing database. The reason is a FollowUp belongs to a user and each user has their followUp and they decide the way a house will be colored.

So I did or will do what I have to do: (With fabric I guess)

!!Not tested request!!

USE housing
MATCH (house:House {housing:x})
CALL
{
WITH house
USE followUp
MATCH (proxyHouse:House {uuid:house.uuid})<-[:INCLUDE]-(f:followUp)
RETURN f.color AS color
}
RETURN house.uuid AS uuid, color

As I recently learned that I can't use the USE clause two times for two different database in the same query without Fabric I will have to use Fabric but I guess the query structure will be the same.

So the question, does doing it this way is expensive? ( Yeah I know I can put the color property in the proxy node and create an index but the point is more about multidatabase approach)
Is there a better way to do this?

Is there any Graph Acadamy course about multi database management and best practices?

Thank you

0 REPLIES 0