Database Reference
In-Depth Information
Figure 5.4. Graph of a social network using intermediate nodes to differentiate between relationships to user and
film nodes.
Is this a better way of representing the data for the social networking application? Unfortu-
nately, the answer is that it depends on your application. Determining the best data repres-
entation and indexing strategy depends heavily on both the data that you want to store and
the way that you want to interact with that data. Later in the topic we'll discuss the trade-
offs between different graph representations, but for the moment we'll focus on indexing.
Themaintrade-offwhenitcomes toindexingisthatthemoreindexingyouhave,themore
disk space you'll need, the greater the performance hit you'll take on inserts and updates
to the graph, and the more code you'll usually need to manage the creation and updating
ofindexes.Theadvantageisenhancedperformanceifyourindexingstrategycaneliminate
large portions of the graph from consideration when querying.
5.6.1. Performance benefit of indexing when querying
The graph in figure 5.5 shows how marked the difference is between a simple search of all
user nodes in the graph and the use of an index. This graph shows the average time to look
up a random user node.
 
Search WWH ::




Custom Search