Managing Indexes

本文深入解析了PeopleSoft应用中记录定义的内部索引管理,包括如何通过应用设计师查看和编辑索引,以及如何使用SQL查询获取索引详细信息。同时揭示了PeopleTools索引与数据库索引之间的差异,以及应用设计师如何影响索引信息显示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Table indexes should be managed internally through application designer for each record definition. You can view indexes by opening a record definition (e.g. PSRECDEFN) and selecting Tools > Data Administration > Indexes.

This will give you a list of the indexes currently defined through application designer for that record:

change-record-indexes.png

As you can see in this example, the record PSRECDEFN has six indexes. One key index (index ID _) and five user indexes (index IDs A-E).

If you choose any of the index IDs (first column) and press the Edit Index button you will see a window that gives you further options and a comment for that index:

edit-index-dialog.png

It is a good idea of getting into the habit of adding comments when you add your own user indexes to records.

Index Information

The following queries gives you a summary of the indexes on a particular PeopleSoft record.

The first query works at the PeopleTools meta-data layer. It uses the PeopleTools record definition table (PSRECDEFN) and the PeopleTools index definition table (PSINDEXDEFN). It returns the record name, description, a count of the number of indexes set on that record in PeopleTools, the SQL table name (if set), the PeopleSoft index name, index ID and index type.

Note that the primary key index is always unique and is always named PS_ + RECNAME. For instance the primary index for PSRECDEFN is PS_PSRECDEFN. Also the index ID is always a single underscore _ and the index type is 1 for key.

The second query works at the Oracle database layer by checking the DBA_INDEXES Oracle system table for indexes that relate to the specified PeopleSoft record. In order to run this query, you will need to be logged in as a user with access to DBA_INDEXES.

Note that you can substitute DBA_INDEXES with ALL_INDEXES however, DBA_INDEXES can see more than ALL_INDEXES and may include indexes not visible throughALL_INDEXES depending on the account you are logged in as.

Don't forget to replace <record_name> with the appropriate PeopleTools record name.

PeopleTools Index Information

select
    R.RECNAME,
    R.RECDESCR,
    R.INDEXCOUNT,
    R.SQLTABLENAME,
    'PS' || I.INDEXID || I.RECNAME as PS_INDEXNAME,
    I.INDEXID,
    (case
        when I.INDEXTYPE = 1 then 'Key'
        when I.INDEXTYPE = 2 then 'User'
        when I.INDEXTYPE = 3 then 'Alt'
        when I.INDEXTYPE = 4 then 'User'
        else 'Unknown'
     end) as PS_INDEXTYPE   
from
    PSRECDEFN R inner join PSINDEXDEFN I
    on R.RECNAME = I.RECNAME
where
    R.RECTYPE = 0
    and R.RECNAME = '<record_name>'
order by
    R.RECNAME, PS_INDEXTYPE, I.INDEXID
;

Oracle Database Index Information

select
    R.RECNAME,
    R.RECDESCR,
    R.SQLTABLENAME,
    DI.OWNER,
    DI.TABLE_NAME as DB_TABLENAME,
    DI.INDEX_NAME as DB_INDEXNAME,
    DI.INDEX_TYPE as DB_INDEXTYPE,
    DI.UNIQUENESS,
    DI.STATUS,
    DI.NUM_ROWS,
    DI.LAST_ANALYZED
from
    PSRECDEFN R inner join DBA_INDEXES DI
    on R.RECNAME = replace(DI.TABLE_NAME, 'PS_', '') 
where
    R.RECTYPE = 0
    and R.RECNAME = '<record_name>'
order by
    DI.TABLE_NAME, DI.UNIQUENESS desc, DI.INDEX_NAME
;

PeopleTools Indexes vs Database Indexes

While running the above queries, you may find some discrepencies between index information in PeopleTools and index information in the Oracle database. To further complicate matters, application designer may be misinforming you!

To explain what I mean, I found that the record ACCT_CD_TBL only had three indexes in PeopleTools. I confirmed this using the PeopleTools index information query above. The index count returned by PSRECDEFN was 3, and there were only 3 index IDs in PSINDEXDEFN (_, 0, 1).

However, when I looked at the index information through application designer for this table, it was showing the same information as the second query which uses the Oracle system table DBA_INDEXES:

change-record-indexes-misinformation.png

A total of 11 indexes. What's going on? By the way I've only shown the bottom of the scroll in the screenshot, but be assured there were a total of 11 indexes including the primary index (_) and 10 user indexes (0-9).

Initially I thought I was looking in the wrong PeopleTools tables. But eventually I figured it was application designer playing tricks. To confirm this, I traced application designer while performing a build index script (Build > Current Definition > Create Indexes & Build script file).

Here's the trace output:

create-index-build-script-trace.png

Turns out application designer also uses DBA_INDEXES when it loads index information and creates build scripts! So it can appear that indexes exist in PeopleTools when in fact they really don't.

Index Management

To get a better picture of PeopleTools indexes versus database indexes, the following queries identify cases where indexes exist in PeopleTools but not in the database or vice versa, when they exist in the database but not in PeopleTools.

Indexes that exist in PeopleTools but not in the database

select
    R.RECNAME,    
    R.RECDESCR,
    R.INDEXCOUNT,
    R.SQLTABLENAME,
    'PS' || I.INDEXID || I.RECNAME as PS_INDEXNAME,
    I.INDEXID,
    (case
        when I.INDEXTYPE = 1 then 'Key'
        when I.INDEXTYPE = 2 then 'User'
        when I.INDEXTYPE = 3 then 'Alt'
        when I.INDEXTYPE = 4 then 'User'
        else 'Unknown'
     end) as PS_INDEXTYPE
from
    PSRECDEFN R inner join PSINDEXDEFN I
    on R.RECNAME = I.RECNAME
where
    R.RECTYPE = 0
    and not exists (
        select  1
        from    DBA_INDEXES
        where   INDEX_NAME = 'PS' || I.INDEXID || I.RECNAME
    )
order by
    R.RECNAME, PS_INDEXNAME
;

Indexes that exist in the database but not in PeopleTools

Note you will need to replace <owner> with the database user that owns your PeopleTools tables (e.g. SYSADM).

select
    DI.OWNER,
    DI.TABLE_NAME,
    DI.INDEX_NAME,
    DI.INDEX_TYPE as DB_INDEXTYPE,
    DI.UNIQUENESS,
    DI.STATUS,
    DI.NUM_ROWS,
    DI.LAST_ANALYZED,
    nvl(R.RECNAME, 'Not Found in Application Designer') as RECNAME
from
    DBA_INDEXES DI left outer join PSRECDEFN R
    on replace(DI.TABLE_NAME, 'PS_', '') = R.RECNAME
where
    DI.OWNER = '<owner>'
    and not exists (
        select  1
        from    PSINDEXDEFN
        where   'PS' || INDEXID || RECNAME = DI.INDEX_NAME
    )
order by
    DI.OWNER, DI.TABLE_NAME
;

Hopefully these queries help you find out what's really going on with your indexes.

内容概要:该研究通过在黑龙江省某示范村进行24小时实地测试,比较了燃煤炉具与自动/手动进料生物质炉具的污染物排放特征。结果显示,生物质炉具相比燃煤炉具显著降低了PM2.5、CO和SO2的排放(自动进料分别降低41.2%、54.3%、40.0%;手动进料降低35.3%、22.1%、20.0%),但NOx排放未降低甚至有所增加。研究还发现,经济性和便利性是影响生物质炉具推广的重要因素。该研究不仅提供了实际排放数据支持,还通过Python代码详细复现了排放特征比较、减排效果计算和结果可视化,进一步探讨了燃料性质、动态排放特征、碳平衡计算以及政策建议。 适合人群:从事环境科学研究的学者、政府环保部门工作人员、能源政策制定者、关注农村能源转型的社会人士。 使用场景及目标:①评估生物质炉具在农村地区的推广潜力;②为政策制定者提供科学依据,优化补贴政策;③帮助研究人员深入了解生物质炉具的排放特征和技术改进方向;④为企业研发更高效的生物质炉具提供参考。 其他说明:该研究通过大量数据分析和模拟,揭示了生物质炉具在实际应用中的优点和挑战,特别是NOx排放增加的问题。研究还提出了多项具体的技术改进方向和政策建议,如优化进料方式、提高热效率、建设本地颗粒厂等,为生物质炉具的广泛推广提供了可行路径。此外,研究还开发了一个智能政策建议生成系统,可以根据不同地区的特征定制化生成政策建议,为农村能源转型提供了有力支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值