asterixdb-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Magnus Kongshem <>
Subject Re: Limit clause
Date Thu, 07 Apr 2016 06:54:27 GMT
Thanks for the detailed reply, I recommend documenting this!

What I'm doing is testing different queries to find their execution time,
and if the results from my query contains 12 million objects, the browser
is having trouble displaying the entire list(it is chopped of some where
along the way). So I tested with the limit clause and got the same
execution time (give or take a few seconds). So, is there another way of
performing a query to get the execution time without having to print the
entire result? Or is limit the best workaround for this use case? Recall my
example query below where I use "return $obj;".



Magnus Alderslyst Kongshem
+47 415 65 906

On Wed, Apr 6, 2016 at 9:58 PM, Mike Carey <> wrote:

> (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 <
> <>> 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 <%2B47%20415%2065%20906>

View raw message