Skip to Main Content
Spotfire Ideas Portal
Status Future Consideration
Product Spotfire
Categories Installation
Created by Guest
Created on Feb 21, 2023

Improve performance of query retrieving user authorization for more than 300% by removing order by statement

We discovered a Spotfire query that retrieves user authorization, which has the highest cost and is used more than 400 times an hour on our system. It contains an "order by" statement. If this statement is removed it performs 300% faster.

Although TIBCO states that it is hard to change, because the ordering is used in the whole application, The query is mal performing and should be improved.


This is the query:


********************** Query********************


with PARENT_GROUPS_4USER_CTE (GROUP_NAME, GROUP_ID, LEVEL, ISPRIM, PRIMARY_GROUP_ID)


as ( select g.GROUP_NAME, g.GROUP_ID, 1,


case when ((select PRIMARY_GROUP_ID from USERS where USER_ID = @P0) = g.GROUP_ID) then 1 else 0 end ISPRIM, g.PRIMARY_GROUP_ID


from GROUP_MEMBERS gm, GROUPS g where gm.MEMBER_USER_ID = @P1 and g.GROUP_ID = gm.GROUP_ID


union all select g.GROUP_NAME, g.GROUP_ID, 999,


case when ((select PRIMARY_GROUP_ID from USERS where USER_ID = @P2) = g.GROUP_ID)


then 1 else 0 end ISPRIM, g.PRIMARY_GROUP_ID from GROUPS g where g.GROUP_ID = @P3


union all select g.GROUP_NAME, g.GROUP_ID, LEVEL + 1, case when (cte.PRIMARY_GROUP_ID = g.GROUP_ID)


then 1 else 0 end ISPRIM, g.PRIMARY_GROUP_ID from GROUP_MEMBERS gm, PARENT_GROUPS_4USER_CTE cte, GROUPS g


where gm.MEMBER_GROUP_ID = cte.GROUP_ID and g.GROUP_ID = gm.GROUP_ID )


select pk.CATEGORY_NAME, pk.PREFERENCE_NAME, pk.CLASS_TYPE, pv.PREFERENCE_VALUE, pv.PREFERENCE_BLOB_VALUE, pv.LAST_MODIFIED


from ( select GROUP_NAME, GROUP_ID, LEVEL, ISPRIM, PRIMARY_GROUP_ID from PARENT_GROUPS_4USER_CTE ) as x, PREFERENCE_KEYS pk, PREFERENCE_VALUES pv


where pv.GROUP_ID = x.GROUP_ID and pv.PREFERENCE_ID = pk.PREFERENCE_ID


order by pk.CATEGORY_NAME, pk.PREFERENCE_NAME, x.LEVEL, ISPRIM desc, x.GROUP_NAME


************************************************************

  • Attach files
  • Admin
    Miguel Díez
    Reply
    |
    Mar 2, 2023

    Hi Ernst,

    Is the query performance now working as expected, after the indexing rebuild in the database, as suggested by TIBCO support?

    Thanks

    6 replies