Make LIMIT be processed in the driver level
- Dominant language
- Go
- Stars
- 984
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
At the moment, it seems that only for the `g.Triples` driver call, in `data_access.go`, the `LIMIT` information (`stmLimit` variable there) is being passed to the driver through the `MaxElements` field of `LookupOptions`.
For the other driver calls this `MaxElements` field of `LookupOptions` does not seem to be used, and the `LIMIT` operation is apparently executed solely in the planner level (after all the data was already returned from the driver), truncating the result table with the `queryPlan.limit()` method. This is not optimal as there was no need to return all that data from the driver just for it to be truncated later, with only a portion of it being useful.
Then, the performance could be a little better if this `LIMIT` processing was done directly in the driver level, as it already seems to be the case for `g.Triples`.
**N.B.** Note that there is a difference between rows in the table result and triples returned from a driver call (for more on that, refer to `addTriples` in `data_access.go`). Be attentive when truncating one or the other as for the final result to still be what is expected.
Contributor guide
Assessment
This issue has not been assessed yet.