Random result order when not using order by clause

Hi guys,

I’ve noticed that when you submit a query like this one:

SELECT * FROM bucket WHERE type = ‘voip_call’ and sender = ‘foreign-key’ LIMIT 10

that there’s no default ORDER BY sorting in place and the results I’m getting are randomly selected, which means that the result set changes every time I submit the query. I’ve noticed the same behaviour with the GROUP BY clause, means every time I’m using it I’m getting different result sets.

Best,
Marcel

Yes, your observation is correct.

Thanks,
Gerald

Does this issue can be fixed?

Hi @atom_yang,

There is no issue to be fixed. With N1QL, ORDER BY is required if a specific result order is desired.

Gerald

When I use order by after group by ,my result shows random.

Please try it with 4.5, and post the specific query.