This however will all the documents for the associated event (may be many?) so the two-query solution may be more efficient. you put every type of object in a different collection, instead of having a type attribute. Ģ) the alternative is to do everything is a single query and return just the first and last documents from it: LET results = ( Using multiple collections for different types of things mainly pays off, when it allows you to avoid adding FILTER statements in queries. If there are no matching documents for the specified _id_event value, the queries will return null each. Just one document is returned from each query, and only that document is returned per query. the very first log entry, and the most recent log entry: [ġ) the first one is to execute two queries and return just the top/bottom document from each: RETURN [Īs you can see, one query is using sort order DESC and the other is using sort order ASC. I want a query that will return an array with only the first and last items, i.e. Here's an example: FOR event IN EventTran I’m trying to work out a query to return an array of only the first and last (by timestamp) EventTran documents for a specified id_event. EventTran attributes include a timestamp, and a reference to the parent _id_event. I have a transaction detail collection ( EventTran) that logs update details on its parent table ( Event). The performance will very likely not be an issue.I need help with an ArangoDB AQL query. But I'd suggest not missing the opportunity to structure the data in the most useful way. ArangoDB is a multi-model database system since it supports three data models (graphs, JSON documents, key/value) 1 with one database core and a unified query language AQL (ArangoDB Query Language). Species taxonomy isn't my field and the examples are probably nonsense. ArangoDB is a free and open-source native graph database system developed by ArangoDB Inc. You'd be creating alternative interconnect networks using exactly / mostly same set of species nodes. If there are multiple schools of thought, multiple classifications, or other frameworks that describe alternate pathing between the species then I'd be looking at capturing each in a different edge collection.įor example if one taxonomy pathing is arrived at by jaw shape, another always uses the pelvis, if countryX has another method, and another is DNA based it could be instructive to dedicate an edge collection to each. And start with one collection for the 'begats' edge collection to capture the species evolution pathways. In your example I'd probably have one collection for the species nodes. I've chosen to focus on modeling the relationships to best represent the dataset and have not regretted this. This amount of data presents no performance challenges to ArangoDB. I've got a taxonomy project in ArangoDB that seems roughly equivalent in terms of the data record count that you report. Will I be using a single instance or a distributed cluster? Honestly, either! Whatever will speed up reads. I'm not worried about write speed at all. This project will almost exclusively be READING. Please see the comments for some questions and answers.Īlmost every single query will span multiple types. If that makes sense? 6 degrees of Kevin Bacon type thing. The types of queries would be shortest path and any connectedness between each. Type can have multiple parents and children. If I break this out into different edge collections, it would be 4 collections with about 300,000 rows in each. My specific questions is: Does building graphs in ArangoDB, that uses multiple collections, take a performance hit? Will using one large collection be more efficient for graphs? There's a small possibility that it would be useful in the future for features I haven't thought of yet. Putting they different types in different collections would only be for superficial organizational reasons. I will be building a graph that connects all of these.Įxample: parent/child of ancient homo species: Homo habilis->Homo floresiensis->Homo erectus->Homo sapiens I'm building an ArangoDB edge collection that consists of many "types".
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |