Query is extremely slow when ORDER BY an alias

59 views
Skip to first unread message

Hung Tran

unread,
Jan 20, 2016, 11:41:38 AM1/20/16
to orient-...@googlegroups.com
Hi,

I am using OrientDB version 2.1.8, my Contact table has about 50k records.

It takes 3-5 secords to return 10 records


and its explain is





while it only takes 0.016 seconds without alias in ORDER BY



and its explain is



By looking at their explains, it seems to do a fully cluster scan when alias is used in OrderBy.

Any idea will be very appreciated!

My Best,
Hung Tran

alessand...@gmail.com

unread,
Jan 21, 2016, 11:39:04 AM1/21/16
to OrientDB
Hi,
can you post the complete query ?

Kind regards,
Alessandro

Hung Tran

unread,
Jan 21, 2016, 11:50:18 AM1/21/16
to OrientDB
Hi Alessandro,

You could see the query in each image. Anyway, here they are

SELECT @rid as __x1, Email.Address, Status, OwnedBy.Name FROM Contact ORDER BY __x1 DESC skip 0 limit 10  // took 3.941 sec

SELECT @rid, Email.Address, Status, OwnedBy.Name FROM Contact ORDER BY @rid DESC skip 0 limit 10 // took 0.016 sec

I have also tested with other fields, that shows "ORDER BY an alias" will do a fully cluster scan

My Best,
Hung Tran
Reply all
Reply to author
Forward
0 new messages