AQL Object Literal Simplification: ArangoDB Query Optimization
ArangoDB’s devel
branch recently saw a change that makes writing some AQL queries a bit simpler.
The change introduces an optional shorthand notation for object attributes in the style of ES6’s enhanced object literal notation.
For example, consider the following query that groups values by age
attribute and counts the number of documents per distinct age
value:
FOR doc IN collection
COLLECT age = doc.age WITH COUNT INTO length
RETURN { age: age, length: length }
The object declaration in the last line of the query is somewhat redundant because one has to type identical attribute names and values:
RETURN { age: age, length: length }
In this case, the new shorthand notation simplifies the RETURN
to:
RETURN { age, length }
In general, the shorthand notation can be used for all object literals when there is an attribute name that refers to a query variable of the same name.
It can also be mixed with the longer notation, e.g.:
RETURN { age, length, dateCreated: DATE_NOW() }
ArangoDB 2.6.3: Maintenance Release for Stability & Performance
A maintenance release of ArangoDB is available, we have fixed an issue with NULL bytes inside attribute values (#1409) that occurs when fetching a document via REST API.
Release 2.5.6 and 2.6.3 can be downloaded from arangodb.com/download now.
Mastering AQL: Return Distinct Values | ArangoDB Blog
Last week saw the addition of the RETURN DISTINCT
for AQL queries. This is a new shortcut syntax for making result sets unique.
For this purpose it can be used as an easier-to-memorize alternative for the already existing COLLECT
statement. COLLECT
is very flexible and can be used for multiple purposes, but it is syntactic overkill for making a result-set unique.
The new RETURN DISTINCT
syntax makes queries easier to write and understand.
Here’s a non-scientific proof for this claim:
Compare the following queries, which both return each distinct age
attribute value from the collection:
FOR doc IN collection
COLLECT age = doc.age
RETURN age
With RETURN DISTINCT
:
FOR doc IN collection
RETURN DISTINCT doc.age
Clearly, the query using RETURN DISTINCT
is more intuitive, especially for AQL beginners. Apart from that, using RETURN DISTINCT
will save a bit of typing compared to the longer COLLECT
-based query.
Internally both COLLECT
and RETURN DISTINCT
will work by creating an AggregateNode
. The optimizer will try the sorted and the hashed variants for both, so they should perform about the same.
However, the result of a RETURN DISTINCT
does not have any guaranteed order, so the optimizer will not insert a post-SORT
for it. It may do so for a regular COLLECT
.
As mentioned before, COLLECT
is more flexible than RETURN DISTINCT
. Notably, COLLECT
is superior to RETURN DISTINCT
when the result set should be made unique using more than one criterion, e.g.
FOR doc IN collection
COLLECT status = doc.status, age = doc.age,
RETURN { status, age }
This is currently not achievable via RETURN DISTINCT
, as it only works with a single criterion.
ArangoDB Nightly Travis Builds: Continuous Integration Updates
Great news for driver maintainers that want access to the latest developments in ArangoDB. Many of you have asked us if we can provide a nightly build of our ArangoDB database to improve CI test automation using Travis-CI. The Travis builds for ArangoDB 2.6, 2.7 and devel will be generated and published shortly after midnight (GMT).
Arango Weekly 30: New Performance Results & O’Reilly Article
Maybe you’ve noticed that there was no ArangoDB newsletter last week. So here’s the news of the last two weeks and the announcement that during the summer our NL will be biweekly. 🙂
In the meantime we’ve improved the performance of the shortest path implementation significantly and rerun the Multi-Model performance tests. The article Data modeling with multi-model databases – a use case for multi-model databases – was a huge success on O’Reilly Radar last week, it had the most page views of all Radar articles. It’s worth to read.
Finally, Mesosphere launched it’s SDK and developer program and we are proud to be one of the first partners that integrate into DCOS. Stay tuned, there will be more to come.
Keep an eye on our blog or follow us on Twitter for news about ArangoDB.
ES6 Features in New V8 Upgrade | ArangoDB Blog
ArangoDB 2.6 uses V8 engine version 3.31.74.1 for running its own and all user-defined JavaScript code. In ArangoDB 2.7 (currently in development), we have upgraded V8 to version 4.3.61.
The new V8 version in ArangoDB 2.7 provides several additional ES6 Harmony features that can be used to improve JavaScript usability and code quality. This blog post showcases strong mode and rest parameters, and also shows how to activate TurboFan, V8’s new JIT compiler for JavaScript.
ArangoDB 2.7 is in development right now, but it can be tried today by compiling it from source.
Multi-Model Benchmark: Round 1 Results | ArangoDB Blog
It’s time for another update of my NoSQL performance blog series. This hopefully concludes the first part of this series with the initial databases ArangoDB, MongoDB, Neo4J and OrientDB and I can now start to check out other databases. I’m getting a lot of requests to test others as well and I’ll try to add them as soon as possible. Pull requests to my repository are also more than welcome. Remember it is all open-source.
The first set of benchmarks was started as a proof that multi-model can compete with specialized solutions and I started with the corresponding top dogs (Neo4J and MongoDB) for graphs and documents. After the first blog post, we were asked by the community to include OrientDB as the other multi-model database, too, which makes sense and therefore I expanded the initial lineup.
Concluding the tests did take a bit longer than expected, because vendors took up the challenge and improved their products with impressive results – as we asked them to do. Still, for each iteration we needed some time to run all tests, see below. However, on the upside, everyone can benefit from the improvements, which is an awesome by-product of the benchmark tests. (more…)
Data Modeling with Multi-Model Databases: ArangoDB Insights
Max published an article on O’Reilly Radar about the use case he presented on Strata+Hadoop World in London earlier this year.
Read how multi-model databases can be used in an aircraft fleet maintenance system by mixing different data models within the same data store.
A query language like AQL can help to answer maintenance questions like:
- What are all the parts in a given component?
- Given a (broken) part, what is the smallest component of the aircraft that contains the part and for which there is a maintenance procedure?
- Which parts of this aircraft need maintenance next week?
Read on: O’Reilly Radar – Data modeling with multi-model databases
ArangoDB 2.6.2: Maintenance Release for Enhanced Stability
ArangoDB 2.6.2 maintenance release available – ArangoDB download
- fixed issue #1383: bindVars for HTTP API doesn’t work with empty string
- fixed handling of default values in Foxx manifest configurations
- fixed handling of optional parameters in Foxx manifest configurations
Read more about the new features in ArangoDB 2.6 in our What’s new article, the AQL 2.5 vs. 2.6 performance shootout or our latest performance comparison of multi-model and specialized DB’s (MongoDB, Neo4j).
Arango Weekly 29: New Release 2.6.1 & Updated Benchmark
This week we published a 2.6.1 maintenance release. A few weeks ago we published a performance comparison. Since it has raised a lost of interest and the discussions around it have led to improvements in all products we’ve updated the benchmark comparison .
In addition we’ve also released a performance comparison between ArangoDB 2.5 and 2.6.
Stay tuned and follow @arangodb for more news.
Get the latest tutorials,
blog posts and news:
Thanks for subscribing! Please check your email for further instructions.