Question
DXC Technology
BE
Last activity: 30 May 2018 5:40 EDT
Indexing on pzinskey
Dears,
I have an activity which uses a class in which two keys are defined which are not pzinskey.
During obj-open-by-handle operation inside the acitivity, ofcourse the pzinskey is used as handle. But it comes to my notice that the pzinskey is not defined as a key for the class , neither is the db table having an index on pzinskey.
In such cases, will there be performance issues when we use obj-open-by-handle when pzinskey is not explicity indexed in database nor is a key in the class.
Please advise.
regards,
Jagan
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
JPMorgan Services India Pvt Ltd
IN
pzInsKey is not something that we will define in Keys of a class.pzInsKey will be generated internally by using the Keys defined for a class or class group when the object is saved initially.
Please refer to below link for more info.
https://community.pega.com/sites/default/files/help_v731/procomhelpmain.htm
DXC Technology
BE
Thanks for the reply.
Ok. Fine if pzinskey is internally generated.
I will alter my question to better understand.
Is it necessary to index the column pzinskey in the database table of the class for the obj-open-by-handle function to perform better. ?
Is it necessary to also make it as primary key in the database table?
Currently only the other two keys mentioned as keys in class are primary keys in database and there is no indexing on pzinskey column in database table.
EPAM Systems, Inc.
ES
I just got little confused, are you referring to "Externally Mapped Class" or OOTB class? If it's an OOTB class, you need to worry about the indexing of the pzInsKey.
It's a handle, sometimes known as an internal key, is a permanent representation of an object instance key in an external form. A handle uniquely identifies the instance, though in a format that differs from the normal presentation. Internally, the pzInsKey property holds the handle value for the object.
A handle identifies the class, certain key parts, and (for rules and some other classes) the creation date and time of a single instance. Handle values are in the format:
CLASSNAME CLASSKEY ! NAME #YYYYMMDD T HHMMSSTTTTMMM GMT
The primary key column for almost all Pega Platform database tables is named pzInsKey, which corresponds to the pzInsKey property known as the internal key or handle. This permanent key is generated internally by concatenating other properties in the instance and, for rules, from the date and time the object is first saved. The key uniquely defines an instance.
Because the initial portion of the pzInsKey value contains the object class (the value of property pxObjClass), objects of different classes can be stored together in one table with no chance of key collisions.
Refer,
- https://community.pega.com/sites/default/files/help_v72/procomhelpmain.htm
I just got little confused, are you referring to "Externally Mapped Class" or OOTB class? If it's an OOTB class, you need to worry about the indexing of the pzInsKey.
It's a handle, sometimes known as an internal key, is a permanent representation of an object instance key in an external form. A handle uniquely identifies the instance, though in a format that differs from the normal presentation. Internally, the pzInsKey property holds the handle value for the object.
A handle identifies the class, certain key parts, and (for rules and some other classes) the creation date and time of a single instance. Handle values are in the format:
CLASSNAME CLASSKEY ! NAME #YYYYMMDD T HHMMSSTTTTMMM GMT
The primary key column for almost all Pega Platform database tables is named pzInsKey, which corresponds to the pzInsKey property known as the internal key or handle. This permanent key is generated internally by concatenating other properties in the instance and, for rules, from the date and time the object is first saved. The key uniquely defines an instance.
Because the initial portion of the pzInsKey value contains the object class (the value of property pxObjClass), objects of different classes can be stored together in one table with no chance of key collisions.
Refer,
- https://community.pega.com/sites/default/files/help_v72/procomhelpmain.htm
- https://pdn.pega.com/node/1046676
There will be no performance issue in case of OOTB class.
Hope it answers your query. Kindly notify if it does by marking this post as answered for larger Pega audience.
Regards,
Asif
DXC Technology
BE
Thanks for the details Asif.
I guess i should have mentioned that the class is a functional one, meaning not Pega owned class.
The class for eg. Make_Tea has two keys which are not pzinskey.
The corresponding mapped db table also a column pzinskey which is neither primary key , nor indexing is done on this db column.
Thus the question of performance when this column is being used by the Obj-open-by-handle function.
Hope its clear now. Could you answer please.
thanks
DXC Technology
BE
Any updates on this please. thanks.
PEG
GB
If pzInsKey isn't a primary key for this table, then you can use an Obj-Browse to query the table based on the two key columns.
Then build your logic around this to ensure that it's returned one record (and only one record if needed).
PEG
GB
In my humble opinion, unless there is specific reason why this table shouldn't have pzInsKey as primary key, it should have pzInskey as primary key.
I see 2 reason for this:
-Performances.
-Prevent duplication.
PzInskey should be unique.
If we look a Pega out of the box table, all the one I have checked so far have pzInskey as primary key.
Check for out of the box tables with similar use in your system (like for work cases for instance) wether they do have pzInsKey as primary index.
Check how the table was created to explain this (manualy, wizard...)
It is better to stick to what Pega software expect to avoid surprise, unless there is a good reason for it.