[Cubicweb] Re: About RQL language and its correct use

Julien Jehannet julien.jehannet at logilab.fr
Tue Apr 27 10:45:41 CEST 2010


> * Carlos Balderas <carlos.balderas at gmail.com> [26-avr-2010 22:53]:
> Hello List!
> 
> Writting good RQL sentences.
Good topic :)

> Is it better to write rql sentence like:
> ANY X WHERE X is "EntityType", X eid "EID"
> or just something like this:
> ANY X WHERE X eid "EID"

In terms of performance, I think the latter could be a bit faster
but for readibility issue, I will vote for the former.

> ANY X WHERE X is "EntityType", X in_state Y, Y is State, Y name
> "SOMESTATENAME"
> or just something like this:
> ANY X WHERE X is "EntityType", X in_state Y, Y name "SOMESTATENAME"
> or if X is the only entity type that can have "SOMESTATENAME" state
> ANY X WHERE X in_state Y, Y name "SOMESTATENAME"

The last request could be *huge* because 'name' attribute is widespread
among entities. For the same reason as above, I will tend to always
specified the entity type. But in this example, it will be a performance
boost because the internal generated SQL will only concern a table.

> Using "is" sometimes is necesary when we need to filter certain types of
> entities in rql sentences and this kind of structure sometimes helps the
> programmer to understand quickly what we are looking for in the rql query,
> but other times make bigger rql queries and I would like to know if this can
> help to improve or adversely affect the rql performance in some way.

My advice should be to always keep the "is" constraint even if it makes
the request larger.

Note: I'm not an expert. I'm just sharing that in case if someone could
correct me if I'm wrong.
-- 
Julien JEHANNET                                          LOGILAB, Paris (France)
http://www.cubicweb.org                 CubicWeb, le cadriciel du web sémantique
http://www.logilab.org             Dépôt des logiciels libres conçus par Logilab
http://www.logilab.fr       Informatique scientifique & Gestion de connaissances
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20100427/d2895e34/attachment-0048.sig>


More information about the Cubicweb mailing list