asterixdb-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Carey <dtab...@gmail.com>
Subject Re: Limit clause
Date Wed, 06 Apr 2016 19:58:03 GMT
(And clearly both optimizations are *really* important for performance - 
both in real use cases and also in benchmarks.)

On 4/6/16 8:37 AM, Taewoo Kim wrote:
> Hello Magnus,
>
> Right now, the search does not stop until it finds all tuples that 
> satisfies the given predicate. However, if you have an ORDER BY clause 
> before LIMIT, it can stop sorting process in ORDER BY early. That is, 
> it picks top K (in your example, K is 2) and sorting process stops early.
>
> Actually, if the plan qualifies as an index-only plan (the given 
> predicate can be covered by a secondary index search and you only 
> return secondary key field and/or primary key field), the LIMIT can be 
> applied to an index-search so that an index-search can be stopped 
> earlier after finding K tuples. This feature is already implemented 
> but in the code-review now. It would be applied soon.
>
> Best,
> Taewoo
>
> On Wed, Apr 6, 2016 at 7:22 AM, Magnus Kongshem 
> <kongshem@online.ntnu.no <mailto:kongshem@online.ntnu.no>> wrote:
>
>     Hey,
>
>     Performing a query with the limit clause, does this cause the
>     query to stop searching when it reaches the value of the limit
>     parameter(like in SQL), or does it keep searching for every
>     matching object and then return the number of objects specified by
>     the limit? Example below:
>
>     use dataverse XXX;
>     from $obj in dataset YYY
>         where $obj.timestamp >= 1412121600
>         and $obj.timestamp <= 1412726400
>         limit 2
>     return $obj;
>
>     Followup questions may occur.
>
>     -- 
>
>     Mvh
>
>     Magnus Alderslyst Kongshem
>     +47 415 65 906 <tel:%2B47%20415%2065%20906>
>
>


Mime
View raw message