Re: N1QL Slow using order by compared to views

2016-09-04 Thread Gerald
Hi folks,

You need an index on postingDate. In 4.5.0, an index on postingDate will be 
used for both the WHERE clause and the ORDER BY, assuming the WHERE clause 
should say postingDate instead of postingData.

You can post your EXPLAIN output n the Couchbase N1QL forum, and we will 
take a look there.

On Friday, September 2, 2016 at 9:19:17 AM UTC-7, tiny gipxy wrote:
>
> Hi Gerald, 
>
> I got same issue with ordering: 
> select * from default where postingData > 20160801 order by 
> postingDate  => very slow 27s
> but
> select * from default where postingData > 20160801  limit 10 => very 
> fast 100ms
>
> I'm using couchbase 4.5.0-2601. Can you advise this ? thank you
>
> Regards, 
> On Wednesday, December 30, 2015 at 11:12:01 PM UTC+8, Gerald wrote:
>>
>> Hi Dipen,
>>
>> AS I posted on the Couchbase forum, the next release includes this fix 
>> for the performance of ORDR BY with LIMIT: 
>> http://review.couchbase.org/#/c/57495/
>>
>> Gerald
>>
>> On Monday, December 28, 2015 at 10:16:48 AM UTC-8, Dipen Patel wrote:
>>>
>>> Hello
>>>
>>> N1QL Performance on Order By
>>>
>>> We are testing N1QL and found a Performance issue when using a order by 
>>> in the query.
>>>
>>> I have index on type and lastName.
>>>
>>> Test Case:
>>> * ordering by an attribute (lastName)
>>> * paging using skip and limiting to 50
>>>
>>> The N1QL query returns the same results over 1.6 - 2.5 seconds
>>> Select r.id, r.fullName FROM my_bucket r 
>>> WHERE r.type='user'
>>> Order By r.lastName limit 50
>>>
>>> Using a view returns back ~700 ms.
>>>
>>> If I remove the order by in the N1QL statement, the results come back 
>>> under 100ms
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to couchbase+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: N1QL Slow using order by compared to views

2015-12-30 Thread Gerald
Hi Dipen,

AS I posted on the Couchbase forum, the next release includes this fix for 
the performance of ORDR BY with 
LIMIT: http://review.couchbase.org/#/c/57495/

Gerald

On Monday, December 28, 2015 at 10:16:48 AM UTC-8, Dipen Patel wrote:
>
> Hello
>
> N1QL Performance on Order By
>
> We are testing N1QL and found a Performance issue when using a order by in 
> the query.
>
> I have index on type and lastName.
>
> Test Case:
> * ordering by an attribute (lastName)
> * paging using skip and limiting to 50
>
> The N1QL query returns the same results over 1.6 - 2.5 seconds
> Select r.id, r.fullName FROM my_bucket r 
> WHERE r.type='user'
> Order By r.lastName limit 50
>
> Using a view returns back ~700 ms.
>
> If I remove the order by in the N1QL statement, the results come back 
> under 100ms
>
> Thanks.
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to couchbase+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.