Pipes not good for performance?

Example:

UNWIND [2, 1, 11, 89, 23] AS p return p | order by p desc | limit 3 | return collect($-.p) as top3
UNWIND [2, 1, 11, 89, 23] AS p with p as q order by q desc limit 3 return collect(q) as top3

These two queries are giving the same results. The first option (in my opinion way more elegant) is consistently a few hundred microseconds slower than the second one.

UNWIND [2, 1, 11, 89, 23] AS p with p as q order by q desc limit 3 return collect(q) as top3

I find the with p as q part quite ugly.

Because their execution plans are not the same, you can add PROFILE to the front of the ngql, and you can see their execution plans and the time for each validator.

the docs EXPLAIN and PROFILE - Nebula Graph Database Manual

1 Like

that is cypher style.