1 """RQL to SQL generator for native sources. |
1 """RQL to SQL generator for native sources. |
2 |
2 |
3 |
3 |
4 SQL queries optimization |
4 SQL queries optimization |
5 ~~~~~~~~~~~~~~~~~~~~~~~~ |
5 ~~~~~~~~~~~~~~~~~~~~~~~~ |
6 1. EUser X WHERE X in_group G, G name 'users': |
6 1. CWUser X WHERE X in_group G, G name 'users': |
7 |
7 |
8 EUser is the only subject entity type for the in_group relation, |
8 CWUser is the only subject entity type for the in_group relation, |
9 which allow us to do :: |
9 which allow us to do :: |
10 |
10 |
11 SELECT eid_from FROM in_group, EGroup |
11 SELECT eid_from FROM in_group, CWGroup |
12 WHERE in_group.eid_to = EGroup.eid_from |
12 WHERE in_group.eid_to = CWGroup.eid_from |
13 AND EGroup.name = 'users' |
13 AND CWGroup.name = 'users' |
14 |
14 |
15 |
15 |
16 2. Any X WHERE X nonfinal1 Y, Y nonfinal2 Z |
16 2. Any X WHERE X nonfinal1 Y, Y nonfinal2 Z |
17 |
17 |
18 -> direct join between nonfinal1 and nonfinal2, whatever X,Y, Z (unless |
18 -> direct join between nonfinal1 and nonfinal2, whatever X,Y, Z (unless |