Giter VIP home page Giter VIP logo

Comments (3)

alexbakharew avatar alexbakharew commented on July 24, 2024 1

Hi @matcho!

This indeed looks a little bit strange. I will investigate it and then get back to you.

from arangodb.

alexbakharew avatar alexbakharew commented on July 24, 2024

Hi @matcho !

This behavior is expected since your index doesn't contain field _key: Therefore it should be materialized directly from the storage. As a result, it is way slower as expected.

Could you please try to add _key field to primarySort as well? Here is the documentation about how such view with 2 fields in primarySort could be created: https://docs.arangodb.com/3.11/index-and-search/arangosearch/performance/#primary-sort-order

from arangodb.

matcho avatar matcho commented on July 24, 2024

Hi @alexbakharew

Thank you for your answer.

I understand that using a 2-field primarySort would certainly work − we'll try that as soon as possible, although it seems that primarySort cannot be changed on an existing view : const error: /primarySort must be equal to constant. Schema: {"allowedValue":[{"field":"date_obs","asc":false}]} , and view has to be re-created from scratch (no big deal).

What still seems strange is that returning a projection that includes _key is very fast, although _key is not an indexed field in the view : the following query runs in 165ms !

FOR o in obs_geo_view
	SEARCH ANALYZER(GEO_CONTAINS(GEO_POLYGON(france), o.geoloc), "geopoint_pn")
	SORT o.date_obs DESC
	LIMIT 20000, 1000
	RETURN {
	    date_obs: o.date_obs,
	    _key: o._key
	}

Once the 1000 resulting items, including date_obs and _key fields, are returned so fast, what keeps AQL from re-sorting them in-memory ? Sorting 1000 items should take almost no time. In queries mentioned in the original post above, it seems that the optimizer forces the second SORT statement to be executed before pagination, which is not what is expressed in the AQL query, especially query 3 with the sub-query.

So it still looks like an optimizer / AQL issue to me. We should be able to apply a secondary sort after pagination without modifying the view's primarySort. Besides, what if we want to sort after pagination on different fields, in different cases ? We would then have to build multiple views with a different primarySort in each of them, which doesn't seem reasonable.

Thank you

from arangodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.