You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by "Dmitriy B. (Jira)" <ji...@apache.org> on 2019/10/09 13:51:00 UTC

[jira] [Updated] (SYNCOPE-1502) Find anytos using FIQL: SQL improvements

     [ https://issues.apache.org/jira/browse/SYNCOPE-1502?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitriy B. updated SYNCOPE-1502:
--------------------------------
    Description: 
PR contains improvements when AnyTOs are searched using FIQL queries:

The resulted SQL query that finds any_to_keys can have a huge list with OR clauses for effective realms. This can be replaced to the IN clause.

{code:sql}

SELECT u.any_id,sv.username FROM (SELECT DISTINCT any_id FROM user_search WHERE (realm_id=? AND any_id IN ( SELECT DISTINCT any_id FROM user_search WHERE lastChangeDate<=?))) u,user_search sv WHERE u.any_id=sv.any_id AND u.any_id IN (SELECT any_id FROM user_search WHERE realm_id IN (SELECT id AS realm_id FROM Realm WHERE id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=?)) ORDER BY sv.username ASC

{code}

When any tos are searched by keys a lot of single sql queries are executed. This can be improved using single SQL query with In clause.

  was:
PR contains improvements when AnyTOs are searched using FIQL queries:

The resulted SQL query that finds any_to_keys can have a huge list with OR clauses for effective realms. This can be replaced to the IN clause.

{code:sql}

SELECT u.any_id,sv.username FROM (SELECT DISTINCT any_id FROM user_search WHERE (realm_id=? AND any_id IN ( SELECT DISTINCT any_id FROM user_search WHERE lastChangeDate<=?))) u,user_search sv WHERE u.any_id=sv.any_id AND u.any_id IN (SELECT any_id FROM user_search WHERE realm_id IN (SELECT id AS realm_id FROM Realm WHERE id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=?)) ORDER BY sv.username ASC

{code}

When any tos are searched by keys a lot of single sql queries are executes. This can be improved using single SQL query with In clause.


> Find anytos using FIQL: SQL improvements
> ----------------------------------------
>
>                 Key: SYNCOPE-1502
>                 URL: https://issues.apache.org/jira/browse/SYNCOPE-1502
>             Project: Syncope
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 2.1.5
>            Reporter: Dmitriy B.
>            Priority: Major
>
> PR contains improvements when AnyTOs are searched using FIQL queries:
> The resulted SQL query that finds any_to_keys can have a huge list with OR clauses for effective realms. This can be replaced to the IN clause.
> {code:sql}
> SELECT u.any_id,sv.username FROM (SELECT DISTINCT any_id FROM user_search WHERE (realm_id=? AND any_id IN ( SELECT DISTINCT any_id FROM user_search WHERE lastChangeDate<=?))) u,user_search sv WHERE u.any_id=sv.any_id AND u.any_id IN (SELECT any_id FROM user_search WHERE realm_id IN (SELECT id AS realm_id FROM Realm WHERE id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=? OR id=?)) ORDER BY sv.username ASC
> {code}
> When any tos are searched by keys a lot of single sql queries are executed. This can be improved using single SQL query with In clause.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)