This post is not about a database feature newly supported in PeopleTools, but PeopleTools is capable of doing something new that could negatively impact the database. When I saw the following warning in the PeopleTools 8.54 release notes, I thought I should look into it.
"PeopleTools has added an Advanced Query Security option to Application Designer. This feature allows up to five Query Security Records to be associated with a single record, including the ability to associate security with non-key fields. While powerful, this feature should be used sparingly because multiple additional joins will affect query performance."
The PeopleTools documentation shows how to add multiple query security records in Application Designer, but doesn't really explain what effect it will have on queries on that record.
PeopleTools has always allowed a query security record to be defined on a record. This is the record properties for JOB.
I am going to create a simple example query that joins PS_JOB and PS_NAMES. These records have different query security records, so both query security records appear in the PS/Query.
SELECT B.EMPLID, B.DEPTID
FROM PS_JOB B, PS_EMPLMT_SRCH_QRY B1, PS_NAMES A, PS_PERALL_SEC_QRY A1
WHERE ( B.EMPLID = B1.EMPLID
AND B.EMPL_RCD = B1.EMPL_RCD
AND B1.OPRID = 'PS'
AND A.EMPLID = A1.EMPLID
AND A1.OPRID = 'PS'
AND ( B.EFFDT =
(SELECT MAX(B_ED.EFFDT) FROM PS_JOB B_ED
WHERE B.EMPLID = B_ED.EMPLID
AND B.EMPL_RCD = B_ED.EMPL_RCD
AND B_ED.EFFDT <= SYSDATE)
AND B.EFFSEQ =
(SELECT MAX(B_ES.EFFSEQ) FROM PS_JOB B_ES
WHERE B.EMPLID = B_ES.EMPLID
AND B.EMPL_RCD = B_ES.EMPL_RCD
AND B.EFFDT = B_ES.EFFDT)
AND B.EMPLID = A.EMPLID
AND A.EFFDT =
(SELECT MAX(A_ED.EFFDT) FROM PS_NAMES A_ED
WHERE A.EMPLID = A_ED.EMPLID
AND A.NAME_TYPE = A_ED.NAME_TYPE
AND A_ED.EFFDT <= SYSDATE) ))
The new version of the same query, but this time with multiple query security records if force, is below. Note that:
- A1, B1 are the query security records defined on the record properties that have always been present in PeopleTools.
- B4, B5, B6 are the advanced query security records. Note that EMPLNT_SRCH_QRY has join criteria on the columns specified in the Advanced Query Security Mapping dialogue.
- EMPLMT_SRCH_QRY gets joined twice to JOB because it is the query security record B1 and an advanced query security record B4, so the advanced settings are in addition to the standard setting. Be careful not to duplicate records. The PS/Query Security Join Optimization setting (introduced in PeopleTools 8.52) does not help with this.
- The standard query security record is stored in PSRECDEFN.QRYSRCRECNAME, while the advanced query security record definitions are stored in a new PeopleTools table PSRECSECFLDMAPS.
SELECT B.EMPLID, B.DEPTID
FROM PS_JOB B, PS_EMPLMT_SRCH_QRY B1, PS_EMPLMT_SRCH_QRY B4,
PS_PERALL_SEC_QRY B5, PS_PERS_SRCH_QRY B6,
PS_NAMES A, PS_PERALL_SEC_QRY A1
WHERE ( B.EMPLID = B1.EMPLID
AND B.EMPL_RCD = B1.EMPL_RCD
AND B1.OPRID = 'PS'
AND B.EMPLID = B4.EMPLID
AND B.EMPL_RCD = B4.EMPL_RCD
AND B4.OPRID = 'PS'
AND B.EMPLID = B5.EMPLID
AND B5.OPRID = 'PS'
AND B.EMPLID = B6.EMPLID
AND B6.OPRID = 'PS'
AND A.EMPLID = A1.EMPLID
AND A1.OPRID = 'PS'
AND ( B.EFFDT =
(SELECT MAX(B_ED.EFFDT) FROM PS_JOB B_ED
WHERE B.EMPLID = B_ED.EMPLID
AND B.EMPL_RCD = B_ED.EMPL_RCD
AND B_ED.EFFDT <= SYSDATE)
AND B.EFFSEQ =
(SELECT MAX(B_ES.EFFSEQ) FROM PS_JOB B_ES
WHERE B.EMPLID = B_ES.EMPLID
AND B.EMPL_RCD = B_ES.EMPL_RCD
AND B.EFFDT = B_ES.EFFDT)
AND B.EMPLID = A.EMPLID
AND A.EFFDT =
(SELECT MAX(A_ED.EFFDT) FROM PS_NAMES A_ED
WHERE A.EMPLID = A_ED.EMPLID
AND A.NAME_TYPE = A_ED.NAME_TYPE
AND A_ED.EFFDT <= SYSDATE) ))
Conclusion
I know from previous experience that having just two different query security records on different base records, as in the first example above can lead to significant performance problems. This new feature has the potential to add up to five more per record.I can see that this feature could have occasional application where the additional security is not joined by a key field. However, I would generally echo the sentiment in the release notes, and use it sparingly. Instead of two query security records, could you merge them into one security record?
No comments :
Post a Comment