appscot / sails-orientdb

OrientDB adapter for Waterline / Sails.js ORM
MIT License
25 stars 23 forks source link

Unexpected behavior and very slow query response, hence compromised functionality #131

Closed nidaca closed 9 years ago

nidaca commented 9 years ago

Hello,

I have a very simple use case (from a large project): two models, model Person and model File, a simple one-way association between them, let's say 'avatar' (which is an optional attribute). So the waterline model of Person contains the definition of the association: { .... avatar: { model: 'file'; } ... }.

Now I make the following waterline query: Person.find( { key: 'value' } ).populate('avatar').exec(...), where the 'key' attribute is mapped to a string (indexed) field from the database, from class Person. For the previous query, the key needs to match a given input string value which leads to a record from the Person class with no associated avatar, meaning that the LINK property 'avatar' for this record has no value.

The problem is: two OrientDB queries are generated (taken from the debug console):

Anyway, this is not the main goal of this issue description, but:

For the above case scenario the execution of the waterline query will last forever (more than 6 SECONDS !!!). The problem seems to be that the last query receives a parameter with a 'null' value, which completely overwhelms the OrientDB database, I don't know why because it is a straightforward invalid usecase. Shouldn't this null parameter be verified on the adapter side and removed from the query execution ?

Thanks !

[sails-orientdb version: 0.10.55, OrientDB server version: 2.0.12]

nidaca commented 9 years ago

@dmarcelino, any thoughts on this issue ? I'm trying to find a workaround and some feedback would be really great and appreciated ...

nidaca commented 9 years ago

it seems that the issue was solved a few days ago in waterline-cursor@0.0.6: https://github.com/balderdashy/waterline-cursor/pull/8

dmarcelino commented 9 years ago

Cool! Thanks for the update, closing this.