Introduction of Hardware and Environment

  • 1,246 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,246
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
33
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. G22.2434.01 Fall 2005 Advanced Database Systems Report of Tuning Project By: Yuhong Chen Student ID: N16413151 [See my comments below beginning with “Dennis:” In general a very nice job though I would have like to hear what happened in your data warehouse experiment] Index Introduction of Hardware and Environment ................................................................................................... 2 Case 1: Reduce the size of large update transactions (Ref. Chapter 2.3.2) .................................................. 4 Case 2: Minimizing DISTINCTs (Ref. Chapter 4.6.1) ...................................................................................... 12 Case 3: Query Tuning (Ref. Chapter 4.6) .......................................................................................................... 20 Case 4: Understanding Access Plan (Ref. Appendix D) ................................................................................. 29 Case 5: Troubleshooting (Ref. Chapter 7) ......................................................................................................... 37 Other Tuning Experiences ................................................................................................................................... 40 Appendix: DDL statement of tables and views in case study. 1
  • 2. 2
  • 3. Introduction of Hardware and Environment: Our Production Database System: Database system: Oracle 9i – 9.2.0.7 Operation System: IBM AIX 5L – 5.1 AIX Server 1: IBM RS6000 – 6H1 Processor: 4 - way CPUs 750 MHz each Memory: 8 G Disks: two 18G disks Raid 1 for applications Twenty-four (24) disks (total size 225 G) RAID 1 for data AIX Server 2: IBM RS6000 – 6F1 Processor: 4 – way CPUs 600 MHz each Memory: 8 G Disks: two 36G disks Raid 1 for applications Ten (10) 72G disks total size 350G RAID 10 for data Comparing Database System: Database system: Microsoft SQL Server 2000 with SP 3 Operation System: Dell OPTIPLEX GX-150 Microsoft Windows XP Professional Workstation Processor: Pentium III 996 MHz Memory: 512 M Disk: One internal IDE disk size 37.2 G About the system of this tuning project: The databases I use for this tuning project is PeopleSoft ERP application for Finance and Human Resource Management. Oracle database engine is used as backend database server. On the above Server list, AIX Server 1 is our production server. AIX Server 2 is Disaster Recovery Server. Because PeopleSoft ERP system is a mature application, we just need a few coding for customize the modules. Almost all problem queries are generated by “Query Builder” for Ad Hoc reports. Our users do not know how to coding SQL. PeopleSoft Application supports multi-database servers: Oracle, IBM DB2, SQL Server, Informix…… PeoperSoft builds the database structure as portable as he can! There are not 3
  • 4. primary key and foreign key for data integration, PeopleSoft use its application to control the data integration. There more than 7,000 tables, 3,000 indexes and 2,000 views in Finance database. There are more than 5,000 tables, 3,000 indexes and 2,000 indexes in HRMS database. For security reason, views are used for different user groups. Most of those views are built on views too (depth to several levels). If we just simply re-write the problem queries using the base tables of views, user cannot submit it through their GUI application interface. Anyway I still have to do what I can do under those restrictions. 4
  • 5. Case 1: Reduce the size of large update transactions (Ref. Chapter 2.3.2) Scenario: We have a table named PS_HR_ACCTG_LINE which storages the data of payroll. There are 200,000 to 300,000 rows added each month after payroll run. We need purge those data once a while. Problem: When our HRMS manager tried to purge data, he used query builder GUI to generate the DDL Statement: DELETE FROM PS_HR_ACCTG_LINE A WHERE A.JOURNAL_DATA < TO_DATE(‘2005-07-01’,’YYYY-MM-DD’); He hits the error “rollback tablespace runs out of space” all the time. Description of Table PS_HR_ACCTG_LINE: SQL> desc ps_hr_acctg_line Name Null? Type ----------------------------------------- -------- ------------------- RUN_DT DATE SEQNUM NOT NULL NUMBER(38) LINE_NBR NOT NULL NUMBER(38) KK_AMOUNT_TYPE NOT NULL VARCHAR2(1) AUDIT_ACTN NOT NULL VARCHAR2(1) IN_PROCESS_FLG NOT NULL VARCHAR2(1) BUDGET_LINE_STATUS NOT NULL VARCHAR2(1) BUDGET_DT DATE BUSINESS_UNIT_GL NOT NULL VARCHAR2(5) JOURNAL_ID NOT NULL VARCHAR2(10) JOURNAL_DATE DATE JOURNAL_LINE NOT NULL NUMBER(38) ACCOUNT NOT NULL VARCHAR2(10) DEPTID NOT NULL VARCHAR2(10) PROJECT_ID NOT NULL VARCHAR2(15) PRODUCT NOT NULL VARCHAR2(6) FUND_CODE NOT NULL VARCHAR2(5) PROGRAM_CODE NOT NULL VARCHAR2(5) CLASS_FLD NOT NULL VARCHAR2(5) AFFILIATE NOT NULL VARCHAR2(5) OPERATING_UNIT NOT NULL VARCHAR2(8) ALTACCT NOT NULL VARCHAR2(10) STATISTICS_CODE NOT NULL VARCHAR2(3) MONETARY_AMOUNT NOT NULL NUMBER(15,2) FOREIGN_AMOUNT NOT NULL NUMBER(15,2) FOREIGN_CURRENCY NOT NULL VARCHAR2(3) RT_TYPE NOT NULL VARCHAR2(5) RATE_MULT NOT NULL NUMBER(15,8) RATE_DIV NOT NULL NUMBER(15,8) STATISTIC_AMOUNT NOT NULL NUMBER(15,2) JRNL_LN_REF NOT NULL VARCHAR2(10) OPEN_ITEM_STATUS NOT NULL VARCHAR2(1) LINE_DESCR NOT NULL VARCHAR2(30) JRNL_LINE_STATUS NOT NULL VARCHAR2(1) JOURNAL_LINE_DATE DATE BUSINESS_UNIT NOT NULL VARCHAR2(5) APPL_JRNL_ID NOT NULL VARCHAR2(10) ACCOUNTING_DT DATE GL_DISTRIB_STATUS NOT NULL VARCHAR2(1) PROCESS_INSTANCE NOT NULL NUMBER(10) CURRENCY_CD NOT NULL VARCHAR2(3) ACCOUNTING_PERIOD NOT NULL NUMBER(38) FISCAL_YEAR NOT NULL NUMBER(38) LEDGER NOT NULL VARCHAR2(10) LEDGER_GROUP NOT NULL VARCHAR2(10) USE_DISTRIBUTION NOT NULL VARCHAR2(1) BUDGET_REF NOT NULL VARCHAR2(8) CHARTFIELD1 NOT NULL VARCHAR2(10) CHARTFIELD2 NOT NULL VARCHAR2(10) CHARTFIELD3 NOT NULL VARCHAR2(10) 5
  • 6. Indexes on the Table: There are two indexes have been built on this table: 1. Unique index PS_HR_ACCTG_LINE on columns RUN_DT, SEQNUM and LINE_NBR; 2. Unique index PSAHR_ACCTG_LINE on columns ACCTOUNT, PROGRAM_CODE, DEPTID AND PROJECT_ID Analysis: Since I know that the size of our rollback tablespace is 3 times of the size of table PS_HR_ACCTG_LINE, we cannot just enlarge rollback tablespace for this issue. Accord to professor’s book, I decide to try two methods: 1. Reduce the size of this transaction: the data type of column JOURNAL_DATE is date. We can reduce the range of date and cut the big batch to several same batch transactions. 2. There is no index on column JOURNAL_DATE. This update process leaded a full table access on table PS_HR_ACCTG_LINE. I tried to create an index on column JOURNAL_DATE, and compare the response time. (index vs. update) Result: Method 1: When I delete the data from PS_HR_ACCTG_LINE based on every two months, the response time was 35min58sec. 497,282 rows deleted. This is not an acceptable response time. Then I reduce the update on one month each time. The response time was 3min9sec and 217,814 rows deleted. This is an acceptable response time. Parameter (Where clause) Number of deleted rows Response time < ’01-OCT-2004’ 497,282 34 min 58 sec < ’01-SEP-2004’ 217,814 3 min 9 sec < ’01-OCT-2004’ 279,468 4 min 6 sec < ’01-NOV-2004’ 289,912 4 min 52 sec < ’01-DEC-2004’ 286,624 4 min 41 sec < ’01-JAN-2005’ 289,188 4 min 29 sec < ’01-FEB-2005’ 286,350 4 min 8 sec < ’01-MAR-2005’ 291,474 / < ’01-APR-2005’ 291,097 5 min 17 sec < ’01-MAY-2005’ 291,667 4 min 23 sec < ’01-JUN-2005’ 255,387 3 min 51 sec < ’01-JUL-2005’ 222,960 3 min 28 sec 6
  • 7. 1200 1000 throughput(rows/sec) 800 throughput(rows/se 600 c) 400 200 0 batch size batch size 497282 rows 271047 rows (avarage) Figure case 1.1 Reduce the size of large update transactions. Compare the batch size of 497282 rows and 271047 rows (which is an average of 10 small batch processes), we can see that throughput got extremely improved (5 times). Method 2: The original execute plan of this delete statement is: SQL> delete from ps_hr_acctg_line where journal_date < '01-OCT-05'; 393426 rows deleted. Elapsed: 00:05:16.56 Execution Plan ---------------------------------------------------------- 0 DELETE STATEMENT Optimizer=CHOOSE (Cost=1961 Card=365703 Byt es=12068199) 1 0 DELETE OF 'PS_HR_ACCTG_LINE' 2 1 TABLE ACCESS (FULL) OF 'PS_HR_ACCTG_LINE' (Cost=1961 Car d=365703 Bytes=12068199) Statistics ---------------------------------------------------------- 640 recursive calls 2833791 db block gets 20728 consistent gets 15772 physical reads 403468520 redo size 800 bytes sent via SQL*Net to client 713 bytes received via SQL*Net from client 3 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 393426 rows processed We can see there is a full table access on the table PS_HR_ACCTG_LINE. Our update statement bases on a column with type date. I created an index on this column to see if it can improve the response time. After I created the index, the SQL explain plan was as the following: 7
  • 8. SQL> create index temp_journal_date on ps_hr_acctg_line(journal_date); Index created. Elapsed: 00:00:13.92 SQL> analyze table ps_hr_acctg_line compute statistics; Table analyzed. Elapsed: 00:02:56.93 SQL> delete from ps_hr_acctg_line where journal_date < '01-OCT-05'; 393426 rows deleted. Elapsed: 00:05:12.33 Execution Plan ---------------------------------------------------------- 0 DELETE STATEMENT Optimizer=CHOOSE (Cost=1961 Card=365703 Byt es=12068199) 1 0 DELETE OF 'PS_HR_ACCTG_LINE' 2 1 TABLE ACCESS (FULL) OF 'PS_HR_ACCTG_LINE' (Cost=1961 Car d=365703 Bytes=12068199) Statistics ---------------------------------------------------------- 736 recursive calls 4166821 db block gets 20772 consistent gets 16714 physical reads 482732932 redo size 801 bytes sent via SQL*Net to client 713 bytes received via SQL*Net from client 3 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 393426 rows processed Our database’s optimizer mode is CHOOSE, which means Oracle will calculate the cost of processing. Even we created an index on column JOURNAL_DATE, it looks like that Oracle did not use the index. But statistics are little different. We can see that there is 4.23 seconds’ improvement between two elapsed times before/after index created. Compares the statistics, we also can see that “recursive calls, db block gets, redo size etc.” are increased a lot. It is not worth to use those system resources to trade 4.23 seconds response time. [Dennis: Also the delete would update the index all the time.] Testing run on Microsoft SQL Server: About the SQL Server environment Since the hardware of my Dell workstation is not very good, I did not convert my whole ERP database to SQL Server from Oracle database Server. I just copied all tables for all queries which each case needs here from Oracle to SQL server. I also created same indexes, views as we have in Oracle Database. Even though, size of SQL testing database is over 4 G. I could not convert data type BLOB column from Oracle to SQL Server. I removed those columns from those tables with data type “LONG” before I copied them to SQL Server. Anyway, my case study doesn’t need those columns. 8
  • 9. The queries I ran on two database are little different too. Some single row functions which Oracle SQLPLUS supports are not supported by SQL Server Transact-SQL. I modified those codes of views, queries to make them executable on SQL Server. That means, the result my testing got from Oracle and SQL Server, could not be compare between database levels. It only can be use to compare before or after tuning in same database engine. Result: Number of deleted rows Response time 393,426 47 sec 609,212 33 sec I was very surprised when I got the result. First of all, I found that the batch size has no affect to the response time. Actually, the larger batch update transaction has bigger throughput than the small one. Second, for a single DDL event, the response time of SQL Server is excellent: [Dennis: Interesting.] Throughput between Oracle and SQL Server Throughput (rows/sec) 10000 8000 6000 4000 2000 0 Oracle SQL Server an update transaction with 393426 rows deleted Figure case 1.2 Througput (rows/sec) of same update transactions between Oracle and SQL Server. Compare the batch size of 393426 rows on Oracle Database Engine and MS SQL Server engine, we can see that throughput of SQL Server is almost 7 time more than Oracle. 9
  • 10. 90000 80000 throughput (rows/sec) 70000 60000 50000 40000 30000 20000 10000 0 393426 rows deleted 609212 rows deleted Figure case 1.3 Througput (rows/sec) of a small update transaction and a big update transaction on SQL Server. Compare the batch size of 393426 rows and 609212 rows on MS SQL Server. We can see that throughput of large update transaction is also bigger. If I have more time for study, I may study what the main factors are which affect the response time between the batch size on different database engines. Log of Test 1: A small batch transaction delete from ps_hr_acctg_line where journal_date < '2005-10-01 00:00:00.000' (393426 row(s) affected) Execution time: 47 seconds Statistics: Counter: Value Average Application Profile Statistics Timer resolution (milliseconds) 0 0 Number of INSERT, UPDATE, DELETE statements 1 0.142857 Rows effected by INSERT, UPDATE, DELETE statements 393426 56203.7 Number of SELECT statements 1 0.714286 Rows effected by SELECT statements 4 3.14286 Number of user transactions 5 4 Average fetch time 0 0 Cumulative fetch time 0 0 Number of fetches 0 0 Number of open statement handles 0 0 Max number of opened statement handles 0 0 Cumulative number of statement handles 0 0 Test 2: A large batch transaction delete from ps_hr_acctg_line where journal_date < '2005-11-01 00:00:00.000' (609212 row(s) affected) Execution time: 33 seconds Statistics: Counter: Value Average Application Profile Statistics Timer resolution (milliseconds) 0 0 Number of INSERT, UPDATE, DELETE statements 1 0.166667 Rows effected by INSERT, UPDATE, DELETE statements 609212 83553.2 Number of SELECT statements 1 0.666667 Rows effected by SELECT statements 4 2.58333 Number of user transactions 5 3.91667 Average fetch time 0 0 10
  • 11. Cumulative fetch time 0 0 Number of fetches 0 0 Number of open statement handles 0 0 Max number of opened statement handles 0 0 Cumulative number of statement handles 0 0 Why SQL Server runs DELETE statement is more effectible than Oracle? I found that I cannot rollback the deleted rows on SQL Server. On the SQL Server on-line book, under the topic “You are about to delete a row or rows” it says: “Choosing yes will delete the selected row from the table. If you say Yes, the deletion will be immediatedly transmitted to the database. You will not be able to undo this change.” I realized that SQL Server only writes redo logs. Oracle writes redo logs and undo(rollback segements). [Dennis: Does this version of sql server have multiversion read consistency?] Then I did a test of SELECT statement: On Oracle: select * from PS_HR_ACCTG_LINE where JOURNAL_DATE < ’01-OCT-05’; 393426 rows selected. Elapsed: 00:11:32.58 On SQL SERVER: select * from PS_HR_ACCTG_LINE where JOURNAL_DATE < ’2005-10-01 00:00:00.000’; Process dead after 34 min running due to memory leak. I also check the update/insert statement. SQL Server cannot rollback the action of executing an UPDATE/INSERT too. SQL Server is an auto-commit database system. [Dennis: Perhaps you need to begin and end transaction] Summery: On Oracle database: 1. Reduce the size of large update transactions can extremely reduce response time and improve the throughput. 2. When we run update statement, it need bigger redo size. The redo size is not calculated by the size of affected data. On MS SQL Server database: 3. The size of batch update transactions does not affect the response time and throughput. It because that SQL Server is an auto commit database system, it executes DDL statements (insert/update/delete) without undo information. All executed DDL action cannot be undo. Conclusion: Reduce the size of large update transactions will help response time and throughput a lot on non-auto-commit database system (such as Oracle – write undo and redo), but not on auto- commit database system (such as SQL Server - write redo only; IBM DB2 – write redo only; Sybase, Informix and MySQL). 11
  • 12. *************************** An Extra Test on SQL Server: I discussed with some DBA friends about auto-commit database system and response time of update transactions. They told me that I can turn off auto-commit on one particle transaction on those database systems. Such as on DB2, add the option parameter “+c” before update transaction command to turn off auto-commit; and on SQL Server, auto commit also can be turned off. I tested the response time after I turned off auto commit of SQL Server. I found that auto- commit on/off doesn’t affect the response time – SQL Server still writes redo log only. Set implicit_transaction on Begin tran delete from ps_hr_acctg_line where journal_date < '2005-09-01 00:00:00.000' (83120 row(s) affected) Execution time: 28 seconds Rollback time: 16 seconds delete from ps_hr_acctg_line where journal_date < '2005-10-01 00:00:00.000' (393426 row(s) affected) Execution time: 23 seconds Rollback time: 1 min 33 seconds 20000 throughput (rows/sec) 15000 83120 rows 10000 393426 rows 5000 0 delete rollback Figure case 1.3 Througput (rows/sec) of a small update transaction and a big update transaction on SQL Server after auto-commit turned off. Compare the batch size of 83120 rows and 393426 rows. After auto commit was turned off, the throughput of DETELE doesn’t affect (33 sec. on 393426 rows with auto-commit on, yesterday). The throughput of rollback process of big batch transaction and small batch transaction are similar. We know that the SQL Server is a database only write redo. I think that relation between execution time and batch size depends on database structure which means the database engine is writing undo only or writing undo AND redo. 12
  • 13. Case 2: Minimizing DISTINCTs (Ref. Chapter 4.6.1) Scenario: Our users use query builder to generate SQL code for their report. They really don’t know how database engine runs SQL. Sometime their queries do not return any result after a few hours running. I helped them to tuning a lot of those problem queries. I found the users add “DISTINCT” to guarantee their queries return unique records all the time, but most of time “DISTINCT” caused the performance problems and those “DISTINCTs” do not needed on the query at all. Problem: I received this problem query on October 3 right after I read section 4.6.1 of professor’s tuning book. I cannot to wait to use the skill I learned from book to tuning the following query: SELECT DISTINCT B.NAME, A.EMPLID, A.EMPL_RCD, TO_CHAR(A.EFFDT,'YYYY-MM-DD'), A.EMPL_STATUS FROM PS_JOB A, PS_B_FAST_EMP_QRY A1, PS_PERSONAL_DTA_VW B, PS_B_FAST_PERS_QRY B1 WHERE A.EMPLID = A1.EMPLID AND A.EMPL_RCD = A1.EMPL_RCD AND A1.ROWSECCLASS = 'CPHR7030' AND B.EMPLID = B1.EMPLID AND B1.ROWSECCLASS = 'CPHR7030' AND ( A.EFFDT = (SELECT MAX(A_ED.EFFDT) FROM PS_JOB A_ED WHERE A.EMPLID = A_ED.EMPLID AND A.EMPL_RCD = A_ED.EMPL_RCD AND A_ED.EFFDT <= SYSDATE) AND A.EFFSEQ = (SELECT MAX(A_ES.EFFSEQ) FROM PS_JOB A_ES WHERE A.EMPLID = A_ES.EMPLID AND A.EMPL_RCD = A_ES.EMPL_RCD AND A.EFFDT = A_ES.EFFDT) AND A.EMPLID = B.EMPLID ); He had been waiting more than 5 hours and got no any date returned! He asked me to kill his session which was processing the query and help tuning it. Description of the involved tables and views in this query: There are 5 tables and 5 views involved in this query. Tables: Like I mentioned above, PS doesn’t use primary key. Here I consider NO NULL with Unique index columns as Key. ***********on FROM clause • PS_JOB, a big table with 217 columns and 87,857 rows Key: emplid, emp_rcd, effdt and effseq. ***********not on FROM clause • PS_PERSON, 10 columns and 13,268 rows Key: emplid • PS_FAST_SCRTY_2, 4 columns and 14,970 rows Key: setid, deptid and rowsecclass • PS_NAMES, 23 columns and 15,179 rows Key: emplid, name_type and effdt 13
  • 14. • PS_PERS_DATA_EFFDIT, 75 columns and 13,441 rows Key: emplid, effdt Views: ***********on FROM clause • PS_B_FAST_EMP_QRY is a view, built on 3 base tables and 1 view Tables: PS_JOB, PS_PERSON AND PS_FAST_SCRTY_2 View: PS_PERSON_NAME • PS_PERSONAL_DTA_VW, built on 1 view View: PS_PERSONAL_NAME • PS_B_FAST_PERS_QRY, built on 2 base tables and 1 view Tables: PS_JOB and PS_FAST_SCRTY_2 view: PS_PERSONAL_DT_FST ***********not on FROM clause • PS_PERSONAL_NAME Table: PS_NAME • PS_PERSONAL_DT_FST Table: PS_NAME Analysis: On the Section 4.6.1 of Professor’s tuning book, Professor says: Generalizing from this example, we conclude that if the fields returned constitute a key of one table T and all other tables perform an equijoin with T by their keys, then the values returned will contain no duplicates, so DISTINCT will be unnecessary. I will say this skill is the most helpful skill for my environment. I have known that 80% of our problem queries caused by “SELECT DISTINCT”, but I don’t know how to get rid of it. I always joke with my co-workers that “select distinct “ is my nightmare! This tuning skill really helps me get rid of 50% of our problem queries. I used to re-rewrite those problems queries before. Let’s go back to check the example problem query. There are 4 objects on FROM CLAUSE. PS_JOB is a table with key. The other 3 objects are views. We have to find out the columns work as key for the result of those views first. PS_B_FAST_EMP-QRY: base on 3 tables and 1 view, PS_PERSON_NAME PS_PERSONAL_DTA-VW: base on view PS_PERSON_NAME PS_B_FAST_QRY: base on two tables and 1 view: PS_PERSONAL_DT_FST 14
  • 15. PS_JOB EMPLID: VARCHAR2(11) EMPL_RCD: NUMBER EFFDT: DATE EFFSEQ: NUMBER DEPTID: VARCHAR2(10) JOBCODE: VARCHAR2(6) POSITION_NBR: VARCHAR2(8) GVT_EFFDT: DATE GVT_EFFDT_PROPOSED: DATE GVT_TRANS_NBR: NUMBER GVT_TRANS_NBR_SEQ: NUMBER GVT_WIP_STATUS: VARCHAR2(3) GVT_STATUS_TYPE: VARCHAR2(3) GVT_NOA_CODE: VARCHAR2(3) GVT_LEG_AUTH_1: VARCHAR2(3) GVT_PAR_AUTH_D1: VARCHAR2(25) PS_B_FAST_PERS_QRY GVT_PAR_AUTH_D1_2: VARCHAR2(25) GVT_LEG_AUTH_2: VARCHAR2(3) EMPLID: A.EMPLID GVT_PAR_AUTH_D2: VARCHAR2(25) ROWSECCLASS: SEC.ROWSECCLASS GVT_PAR_AUTH_D2_2: VARCHAR2(25) ACCESS_CD: SEC.ACCESS_CD GVT_PAR_NTE_DATE: DATE GVT_WORK_SCHED: VARCHAR2(1) GVT_ELIG_FEHB: VARCHAR2(3) GVT_FEHB_DT: DATE GVT_PAY_RATE_DETER: VARCHAR2(1) PS_PERS_DATA_EFFDT GVT_STEP: VARCHAR2(2) GVT_RTND_PAY_PLAN: VARCHAR2(2) GVT_RTND_SAL_PLAN: VARCHAR2(4) EMPLID: VARCHAR2(11) GVT_RTND_GRADE: VARCHAR2(3) EFFDT: DATE GVT_RTND_STEP: NUMBER MAR_STATUS: VARCHAR2(1) GVT_RTND_GVT_STEP: VARCHAR2(2) SMOKER: VARCHAR2(1) GVT_PAY_BASIS: VARCHAR2(2) PS_PERSONAL_DT_FST PER_TYPE: VARCHAR2(1) GVT_COMPRATE: NUMBER(18,6) MAR_STATUS_DT: DATE GVT_LOCALITY_ADJ: NUMBER(7,2) EMPLID: PER.EMPLID SEX: VARCHAR2(1) GVT_BIWEEKLY_RT: NUMBER(9,2) PER_STATUS: PER.PER_STATUS AGE_STATUS: VARCHAR2(1) GVT_DAILY_RT: NUMBER(9,2) PER_TYPE: PDE.PER_TYPE HIGHEST_EDUC_LVL: VARCHAR2(2) GVT_HRLY_RT_NO_LOC: NUMBER(18,6) COUNTRY_NM_FORMAT: A.COUNTRY_NM_FORMAT FT_STUDENT: VARCHAR2(1) GVT_DLY_RT_NO_LOC: NUMBER(9,2) NAME: A.NAME LANG_CD: VARCHAR2(3) GVT_BW_RT_NO_LOC: NUMBER(9,2) NAME_INITIALS: A.NAME_INITIALS YEARS_OF_EXP: NUMBER(4,1) GVT_MNLY_RT_NO_LOC: NUMBER(18,3) NAME_PREFIX: A.NAME_PREFIX APPLID: VARCHAR2(11) GVT_ANNL_RT_NO_LOC: NUMBER(18,3) NAME_SUFFIX: A.NAME_SUFFIX APP_DT: DATE GVT_XFER_FROM_AGCY: VARCHAR2(2) NAME_ROYAL_PREFIX: A.NAME_ROYAL_PREFIX ALTER_EMPLID: VARCHAR2(11) GVT_XFER_TO_AGCY: VARCHAR2(2) NAME_ROYAL_SUFFIX: A.NAME_ROYAL_SUFFIX BILINGUALISM_CODE: VARCHAR2(1) PS_FAST_SCRTY_2 GVT_RETIRE_PLAN: VARCHAR2(1) NAME_TITLE: A.NAME_TITLE HEALTH_CARE_NBR: VARCHAR2(12) GVT_ANN_IND: VARCHAR2(1) LAST_NAME_SRCH: A.LAST_NAME_SRCH HEALTH_CARE_STATE: VARCHAR2(6) GVT_FEGLI: VARCHAR2(2) FIRST_NAME_SRCH: A.FIRST_NAME_SRCH GUARDIAN_CHE: VARCHAR2(40) SETID: VARCHAR2(5) GVT_FEGLI_LIVING: VARCHAR2(1) LAST_NAME: A.LAST_NAME MILIT_SITUATN_ESP: VARCHAR2(3) DEPTID: VARCHAR2(10) GVT_LIVING_AMT: NUMBER FIRST_NAME: A.FIRST_NAME SOC_SEC_AFF_DT: DATE ROWSECCLASS: VARCHAR2(30) GVT_ANNUITY_OFFSET: NUMBER MIDDLE_NAME: A.MIDDLE_NAME GVT_CRED_MIL_SVCE: VARCHAR2(4) ACCESS_CD: VARCHAR2(1) GVT_CSRS_FROZN_SVC: VARCHAR2(4) SECOND_LAST_NAME: A.SECOND_LAST_NAME GVT_MILITARY_COMP: VARCHAR2(1) GVT_PREV_RET_COVRG: VARCHAR2(1) SECOND_LAST_SRCH: A.SECOND_LAST_SRCH GVT_MIL_GRADE: VARCHAR2(3) GVT_FERS_COVERAGE: VARCHAR2(1) NAME_AC: A.NAME_AC GVT_MIL_RESRVE_CAT: VARCHAR2(1) GVT_TYPE_OF_APPT: VARCHAR2(2) PREF_FIRST_NAME: A.PREF_FIRST_NAME GVT_MIL_SEP_RET: VARCHAR2(1) GVT_POI: VARCHAR2(4) PARTNER_LAST_NAME: A.PARTNER_LAST_NAME GVT_MIL_SVCE_END: DATE GVT_POSN_OCCUPIED: VARCHAR2(1) PARTNER_ROY_PREFIX: A.PARTNER_ROY_PREFIX GVT_MIL_SVCE_START: DATE GVT_CONT_EMPLID: VARCHAR2(11) LAST_NAME_PREF_NLD: A.LAST_NAME_PREF_NLD GVT_MIL_VERIFY: VARCHAR2(1) GVT_ROUTE_NEXT: VARCHAR2(11) ORIG_HIRE_DT: PER.ORIG_HIRE_DT GVT_PAR_NBR_LAST: NUMBER GVT_CHANGE_FLAG: VARCHAR2(1) SEX: PDE.SEX GVT_UNIF_SVC_CTR: VARCHAR2(1) GVT_TSP_UPD_IND: VARCHAR2(1) AGE_STATUS: PDE.AGE_STATUS GVT_VET_PREF_APPT: VARCHAR2(1) GVT_PI_UPD_IND: VARCHAR2(1) MAR_STATUS: PDE.MAR_STATUS GVT_VET_PREF_RIF: VARCHAR2(1) GVT_SF52_NBR: VARCHAR2(10) MAR_STATUS_DT: PDE.MAR_STATUS_DT GVT_CHANGE_FLAG: VARCHAR2(1) GVT_S113G_CEILING: VARCHAR2(1) BIRTHDATE: PER.BIRTHDATE GVT_DRAFT_STATUS: VARCHAR2(1) GVT_LEO_POSITION: VARCHAR2(1) BIRTHPLACE: PER.BIRTHPLACE GVT_YR_ATTAINED: DATE GVT_ANNUIT_COM_DT: DATE BIRTHCOUNTRY: PER.BIRTHCOUNTRY DISABLED_VET: VARCHAR2(1) GVT_BASIC_LIFE_RED: VARCHAR2(2) BIRTHSTATE: PER.BIRTHSTATE DISABLED: VARCHAR2(1) GVT_DED_PRORT_DT: DATE DT_OF_DEATH: PER.DT_OF_DEATH ETHNIC_GROUP: VARCHAR2(1) GVT_FEGLI_BASC_PCT: NUMBER(7,6) HIGHEST_EDUC_LVL: PDE.HIGHEST_EDUC_LVL GVT_DISABILITY_CD: VARCHAR2(2) GVT_FEGLI_OPT_PCT: NUMBER(7,6) FT_STUDENT: PDE.FT_STUDENT GRADE: VARCHAR2(3) GVT_FEHB_PCT: NUMBER(7,6) HIGHLY_COMP_EMPL_P: PER.HIGHLY_COMP_EMPL_P SAL_ADMIN_PLAN: VARCHAR2(4) GVT_SUB_AGENCY: VARCHAR2(2) HIGHLY_COMP_EMPL_C: PER.HIGHLY_COMP_EMPL_C GVT_CURR_AGCY_EMPL: VARCHAR2(1) GVT_RETRO_FLAG: VARCHAR2(1) US_WORK_ELIGIBILTY: PDE.US_WORK_ELIGIBILTY GVT_CURR_FED_EMPL: VARCHAR2(1) GVT_RETRO_DED_FLAG: VARCHAR2(1) MILITARY_STATUS: PDE.MILITARY_STATUS GVT_HIGH_PAY_PLAN: VARCHAR2(2) GVT_RETRO_JOB_FLAG: VARCHAR2(1) CITIZEN_PROOF1: PDE.CITIZEN_PROOF1 GVT_HIGH_GRADE: VARCHAR2(3) GVT_RETRO_BSE_FLAG: VARCHAR2(1) CITIZEN_PROOF2: PDE.CITIZEN_PROOF2 GVT_PREV_AGCY_EMPL: VARCHAR2(1) GVT_OTH_PAY_CHG: VARCHAR2(1) SMOKER: PDE.SMOKER GVT_PREV_FED_EMPL: VARCHAR2(1) GVT_DETL_POSN_NBR: VARCHAR2(8) MEDICARE_ENTLD_DT: PDE.MEDICARE_ENTLD_DT GVT_SEP_INCENTIVE: VARCHAR2(1) ANNL_BEN_BASE_OVRD: VARCHAR2(1) SMOKER_DT: PDE.SMOKER_DT GVT_SEP_INCENT_DT: DATE BENEFIT_PROGRAM: VARCHAR2(3) BILINGUALISM_CODE: PDE.BILINGUALISM_CODE GVT_TENURE: VARCHAR2(1) UPDATE_PAYROLL: VARCHAR2(1) HEALTH_CARE_NBR: PDE.HEALTH_CARE_NBR GVT_PAY_PLAN: VARCHAR2(2) GVT_PAY_PLAN: VARCHAR2(2) HEALTH_CARE_STATE: PDE.HEALTH_CARE_STATE BARG_UNIT: VARCHAR2(4) GVT_PAY_FLAG: VARCHAR2(1) GUARDIAN_CHE: PDE.GUARDIAN_CHE ENTRY_DT_FRA: DATE GVT_NID_CHANGE: VARCHAR2(1) MILITARY_STAT_GER: PDE.MILITARY_STAT_GER MILIT_SITUATN_FRA: VARCHAR2(3) SUPERVISOR_ID: VARCHAR2(11) EXPCTD_MILITARY_DT: PDE.EXPCTD_MILITARY_DT CPAMID: VARCHAR2(6) APPT_TYPE: VARCHAR2(1) HR_RESPONSIBLE_ID: PDE.HR_RESPONSIBLE_ID MILITARY_STAT_GER: VARCHAR2(1) MAIN_APPT_NUM_JPN: NUMBER ENTRY_DT_FRA: PDE.ENTRY_DT_FRA EXPCTD_MILITARY_DT: DATE POSITION_OVERRIDE: VARCHAR2(1) MILIT_SITUATN_FRA: PDE.MILIT_SITUATN_FRA HR_RESPONSIBLE_ID: VARCHAR2(11) POSN_CHANGE_RECORD: VARCHAR2(1) CPAMID: PDE.CPAMID MILITARY_STAT_ITA: VARCHAR2(1) EMPL_STATUS: VARCHAR2(1) HONSEKI_JPN: PDE.HONSEKI_JPN MILITARY_TYPE_ITA: VARCHAR2(2) ACTION: VARCHAR2(3) MILITARY_STAT_ITA: PDE.MILITARY_STAT_ITA MILITARY_RANK_ITA: VARCHAR2(50) ACTION_DT: DATE MILITARY_TYPE_ITA: PDE.MILITARY_TYPE_ITA MILITARY_END_ITA: DATE ACTION_REASON: VARCHAR2(3) MILITARY_RANK_ITA: PDE.MILITARY_RANK_ITA HONSEKI_JPN: VARCHAR2(2) LOCATION: VARCHAR2(10) MILITARY_END_ITA: PDE.MILITARY_END_ITA US_WORK_ELIGIBILTY: VARCHAR2(1) TAX_LOCATION_CD: VARCHAR2(10) MILIT_SITUATN_ESP: PDE.MILIT_SITUATN_ESP MILITARY_STATUS: VARCHAR2(1) JOB_ENTRY_DT: DATE SOC_SEC_AFF_DT: PDE.SOC_SEC_AFF_DT CITIZEN_PROOF1: VARCHAR2(10) DEPT_ENTRY_DT: DATE LANG_CD: PDE.LANG_CD CITIZEN_PROOF2: VARCHAR2(10) POSITION_ENTRY_DT: DATE YEARS_OF_EXP: PDE.YEARS_OF_EXP MEDICARE_ENTLD_DT: DATE SHIFT: VARCHAR2(1) APPLID: PDE.APPLID SMOKER_DT: DATE REG_TEMP: VARCHAR2(1) APP_DT: PDE.APP_DT FP_ACTION_2: VARCHAR2(3) FULL_PART_TIME: VARCHAR2(1) GVT_CRED_MIL_SVCE: PDE.GVT_CRED_MIL_SVCE ACTION_REASON: VARCHAR2(3) COMPANY: VARCHAR2(3) GVT_MILITARY_COMP: PDE.GVT_MILITARY_COMP FP_ACTION_REQ: VARCHAR2(1) PAYGROUP: VARCHAR2(3) GVT_MIL_GRADE: PDE.GVT_MIL_GRADE FP_SUPDOC_REQ: VARCHAR2(1) BAS_GROUP_ID: VARCHAR2(3) GVT_MIL_RESRVE_CAT: PDE.GVT_MIL_RESRVE_CAT LAST_UPDATE_DATE: DATE ELIG_CONFIG1: VARCHAR2(10) GVT_MIL_SEP_RET: PDE.GVT_MIL_SEP_RET ELIG_CONFIG2: VARCHAR2(10) GVT_MIL_SVCE_END: PDE.GVT_MIL_SVCE_END ELIG_CONFIG3: VARCHAR2(10) GVT_MIL_SVCE_START: PDE.GVT_MIL_SVCE_START ELIG_CONFIG4: VARCHAR2(10) GVT_MIL_VERIFY: PDE.GVT_MIL_VERIFY ELIG_CONFIG5: VARCHAR2(10) GVT_PAR_NBR_LAST: PDE.GVT_PAR_NBR_LAST ELIG_CONFIG6: VARCHAR2(10) GVT_UNIF_SVC_CTR: PDE.GVT_UNIF_SVC_CTR ELIG_CONFIG7: VARCHAR2(10) GVT_VET_PREF_APPT: PDE.GVT_VET_PREF_APPT ELIG_CONFIG8: VARCHAR2(10) GVT_VET_PREF_RIF: PDE.GVT_VET_PREF_RIF ELIG_CONFIG9: VARCHAR2(10) PS_PERSON BEN_STATUS: VARCHAR2(4) GVT_CHANGE_FLAG: PDE.GVT_CHANGE_FLAG GVT_DRAFT_STATUS: PDE.GVT_DRAFT_STATUS PS_B_FAST_EMP_QRY BAS_ACTION: VARCHAR2(3) GVT_YR_ATTAINED: PDE.GVT_YR_ATTAINED COBRA_ACTION: VARCHAR2(3) EMPLID: VARCHAR2(11) EMPL_TYPE: VARCHAR2(1) DISABLED_VET: PDE.DISABLED_VET PER_STATUS: VARCHAR2(1) EMPLID: A.EMPLID DISABLED: PDE.DISABLED EMPL_RCD: JOB.EMPL_RCD HOLIDAY_SCHEDULE: VARCHAR2(6) BIRTHDATE: DATE STD_HOURS: NUMBER(6,2) ETHNIC_GROUP: PDE.ETHNIC_GROUP BIRTHPLACE: VARCHAR2(30) ROWSECCLASS: SEC.ROWSECCLASS GVT_DISABILITY_CD: PDE.GVT_DISABILITY_CD ACCESS_CD: SEC.ACCESS_CD STD_HRS_FREQUENCY: VARCHAR2(5) BIRTHCOUNTRY: VARCHAR2(3) OFFICER_CD: VARCHAR2(1) GRADE: PDE.GRADE BIRTHSTATE: VARCHAR2(6) NAME: B.NAME SAL_ADMIN_PLAN: PDE.SAL_ADMIN_PLAN LAST_NAME_SRCH: B.LAST_NAME_SRCH EMPL_CLASS: VARCHAR2(3) DT_OF_DEATH: DATE SAL_ADMIN_PLAN: VARCHAR2(4) GVT_CURR_AGCY_EMPL: PDE.GVT_CURR_AGCY_EMPL ORIG_HIRE_DT: DATE NAME_AC: B.NAME_AC GVT_CURR_FED_EMPL: PDE.GVT_CURR_FED_EMPL PER_STATUS: A.PER_STATUS GRADE: VARCHAR2(3) HIGHLY_COMP_EMPL_C: VARCHAR2(1) GRADE_ENTRY_DT: DATE GVT_HIGH_PAY_PLAN: PDE.GVT_HIGH_PAY_PLAN HIGHLY_COMP_EMPL_P: VARCHAR2(1) GVT_HIGH_GRADE: PDE.GVT_HIGH_GRADE STEP: NUMBER GVT_PREV_AGCY_EMPL: PDE.GVT_PREV_AGCY_EMPL STEP_ENTRY_DT: DATE GVT_PREV_FED_EMPL: PDE.GVT_PREV_FED_EMPL GL_PAY_TYPE: VARCHAR2(6) GVT_SEP_INCENTIVE: PDE.GVT_SEP_INCENTIVE ACCT_CD: VARCHAR2(25) GVT_SEP_INCENT_DT: PDE.GVT_SEP_INCENT_DT EARNS_DIST_TYPE: VARCHAR2(1) GVT_TENURE: PDE.GVT_TENURE COMP_FREQUENCY: VARCHAR2(5) GVT_PAY_PLAN: PDE.GVT_PAY_PLAN COMPRATE: NUMBER(18,6) BARG_UNIT: PDE.BARG_UNIT CHANGE_AMT: NUMBER(18,6) ALTER_EMPLID: PDE.ALTER_EMPLID CHANGE_PCT: NUMBER(6,3) ANNUAL_RT: NUMBER(18,3) MONTHLY_RT: NUMBER(18,3) DAILY_RT: NUMBER(18,3) HOURLY_RT: NUMBER(18,6) ANNL_BENEF_BASE_RT: NUMBER(18,3) SHIFT_RT: NUMBER(18,6) SHIFT_FACTOR: NUMBER(4,3) CURRENCY_CD: VARCHAR2(3) BUSINESS_UNIT: VARCHAR2(5) PS_PERSONAL_DTA_VW SETID_DEPT: VARCHAR2(5) SETID_JOBCODE: VARCHAR2(5) EMPLID: PS_PERSON_NAME.EMPLID SETID_LOCATION: VARCHAR2(5) NAME: PS_PERSON_NAME.NAME SETID_SALARY: VARCHAR2(5) REG_REGION: VARCHAR2(5) DIRECTLY_TIPPED: VARCHAR2(1) FLSA_STATUS: VARCHAR2(1) EEO_CLASS: VARCHAR2(1) FUNCTION_CD: VARCHAR2(2) TARIFF_GER: VARCHAR2(2) TARIFF_AREA_GER: VARCHAR2(3) PERFORM_GROUP_GER: VARCHAR2(2) LABOR_TYPE_GER: VARCHAR2(1) SPK_COMM_ID_GER: VARCHAR2(9) HOURLY_RT_FRA: VARCHAR2(3) PS_NAMES ACCDNT_CD_FRA: VARCHAR2(1) PS_PERSON_NAME VALUE_1_FRA: VARCHAR2(5) VALUE_2_FRA: VARCHAR2(5) EMPLID: VARCHAR2(11) EMPLID: A.EMPLID VALUE_3_FRA: VARCHAR2(5) NAME_TYPE: VARCHAR2(3) COUNTRY_NM_FORMAT: A.COUNTRY_NM_FORMAT VALUE_4_FRA: VARCHAR2(5) EFFDT: DATE NAME: A.NAME VALUE_5_FRA: VARCHAR2(5) NAME_PREFIX: VARCHAR2(4) NAME_INITIALS: A.NAME_INITIALS CTG_RATE: NUMBER NAME_SUFFIX: VARCHAR2(15) NAME_PREFIX: A.NAME_PREFIX PAID_HOURS: NUMBER(6,2) LAST_NAME_SRCH: VARCHAR2(30) NAME_SUFFIX: A.NAME_SUFFIX PAID_FTE: NUMBER(7,6) FIRST_NAME_SRCH: VARCHAR2(30) NAME_ROYAL_PREFIX: A.NAME_ROYAL_PREFIX PAID_HRS_FREQUENCY: VARCHAR2(5) FIRST_NAME: VARCHAR2(30) NAME_ROYAL_SUFFIX: A.NAME_ROYAL_SUFFIX UNION_FULL_PART: VARCHAR2(1) MIDDLE_NAME: VARCHAR2(30) NAME_TITLE: A.NAME_TITLE UNION_POS: VARCHAR2(1) LAST_NAME: VARCHAR2(30) LAST_NAME: A.LAST_NAME MATRICULA_NBR: NUMBER COUNTRY_NM_FORMAT: VARCHAR2(3) LAST_NAME_SRCH: A.LAST_NAME_SRCH SOC_SEC_RISK_CODE: VARCHAR2(3) NAME_INITIALS: VARCHAR2(6) FIRST_NAME_SRCH: A.FIRST_NAME_SRCH UNION_FEE_AMOUNT: NUMBER(8,2) NAME_ROYAL_PREFIX: VARCHAR2(15) FIRST_NAME: A.FIRST_NAME UNION_FEE_START_DT: DATE NAME_ROYAL_SUFFIX: VARCHAR2(15) MIDDLE_NAME: A.MIDDLE_NAME UNION_FEE_END_DT: DATE NAME: VARCHAR2(50) SECOND_LAST_NAME: A.SECOND_LAST_NAME EXEMPT_JOB_LBR: VARCHAR2(1) NAME_TITLE: VARCHAR2(30) SECOND_LAST_SRCH: A.SECOND_LAST_SRCH EXEMPT_HOURS_MONTH: NUMBER SECOND_LAST_NAME: VARCHAR2(30) NAME_AC: A.NAME_AC WRKS_CNCL_FUNCTION: VARCHAR2(1) SECOND_LAST_SRCH: VARCHAR2(30) PREF_FIRST_NAME: A.PREF_FIRST_NAME INTERCTR_WRKS_CNCL: VARCHAR2(1) NAME_AC: VARCHAR2(50) PARTNER_LAST_NAME: A.PARTNER_LAST_NAME CURRENCY_CD1: VARCHAR2(3) PREF_FIRST_NAME: VARCHAR2(30) PARTNER_ROY_PREFIX: A.PARTNER_ROY_PREFIX PAY_UNION_FEE: VARCHAR2(1) PARTNER_LAST_NAME: VARCHAR2(30) LAST_NAME_PREF_NLD: A.LAST_NAME_PREF_NLD UNION_CD: VARCHAR2(3) PARTNER_ROY_PREFIX: VARCHAR2(15) NAME_TYPE: A.NAME_TYPE BARG_UNIT: VARCHAR2(4) LAST_NAME_PREF_NLD: VARCHAR2(1) ASOFDATE: A.EFFDT UNION_SENIORITY_DT: DATE ENTRY_DATE: DATE LABOR_AGREEMENT: VARCHAR2(6) EMPL_CTG: VARCHAR2(6) EMPL_CTG_L1: VARCHAR2(6) EMPL_CTG_L2: VARCHAR2(6) SETID_LBR_AGRMNT: VARCHAR2(5) GP_PAYGROUP: VARCHAR2(10) GP_DFLT_ELIG_GRP: VARCHAR2(1) GP_ELIG_GRP: VARCHAR2(10) GP_DFLT_CURRTTYP: VARCHAR2(1) CUR_RT_TYPE: VARCHAR2(5) GP_DFLT_EXRTDT: VARCHAR2(1) GP_ASOF_DT_EXG_RT: VARCHAR2(1) ADDS_TO_FTE_ACTUAL: VARCHAR2(1) CLASS_INDC: VARCHAR2(1) ENCUMB_OVERRIDE: VARCHAR2(1) FICA_STATUS_EE: VARCHAR2(1) FTE: NUMBER(7,6) PRORATE_CNT_AMT: VARCHAR2(1) PAY_SYSTEM_FLG: VARCHAR2(2) BORDER_WALKER: VARCHAR2(1) LUMP_SUM_PAY: VARCHAR2(1) CONTRACT_NUM: VARCHAR2(25) JOB_INDICATOR: VARCHAR2(1) WRKS_CNCL_ROLE_CHE: VARCHAR2(30) BENEFIT_SYSTEM: VARCHAR2(2) WORK_DAY_HOURS: NUMBER(6,2) REPORTS_TO: VARCHAR2(8) FORCE_PUBLISH: DATE JOB_DATA_SRC_CD: VARCHAR2(3) ESTABID: VARCHAR2(12) PRIMARY_JOB: VARCHAR2(1) BOCES_TERM_JOBS: VARCHAR2(1) BOCES_TRM_JOB_PROC: VARCHAR2(1) BOCES_CIVIL_SRV: VARCHAR2(6) 15
  • 16. So, I have to check view PS_PERSON_NAME and PS_FERSONAL_DT_FST first. ** Please find the detail DDL of those views on Appendix. [Dennis: ok] View PS_PERSON_NAME Built on table PS_NAMES, key columns of the table: emplid, name_type, effdt Column emplid – means employee id. It is unique and not null for any employee. On PS_NAME table, one EMPLID may come with different NAME_TYPE and Effdt. View PS_PERSON_NAME returns the NAME_TYPE = ‘PRI’ and max(EFFDT) for each EMPLID. EMPLID acts like the key of view PS_PERSON_NAME View PS_ERSONAL_DT_FST Built on table PS_NAME, PS_PERSON (key: emplid) and PS_PERS_DATA_EFFDT (key: emplid, effdt). View returns PS_PERSON.EMPLID (key of PS_PERSON); On the where clause: Table PS_PERS_DATA_EFFDT join with PS_PERSON, with EMPLID and max(effdt) of a range date –- which return unique result; And Table PS_NAME, restricted NAME_TYPE = ‘PRI’ and max(EFFDT) of a range date, with EMPLID column, EMPLID also can act as the key now, and join with EMPLID of PS_PERSON. Now, we can say that EMPLID acts like the key of view PS_PERSONAL_DT_FST too. PS_B_FAST_EMP_QRY Built on table PS_JOB (key: emplid, emp_rcd, effdt and effseq), table PS_FAST_SCRTY_2 (key: setid, deptid, rowsecclass); Table PS_PERSPN (key: emplid), and view PS_PERSONAL_DT_FST. On where clause of this view, join condition does not cover all key columns of all involved tables and view. It returns a cartesian production of (EMPLID, EMP_RCD) x ROWSECCLASS The key of view would be (EMPLID, EMP_RCD), ROWSECCLASS PS_PERSONAL_DTA_VW Built on view PS_PERSON_NAME, and EMPLID is also acts as the key of result PS_B_FAST_PERS_QRY Built on Tables PS_JOB and PS_FAST_SCRTY_2; and view PS_PERSONAL_DT_FST On where clause of this view, join condition does not cover all key columns of all involved tables and view. It returns a cartesian production of EMPLID x ROWSECCLASS The key of view would be EMPLID , ROWSECCLASS Now, (after a coffee break, of course) I can start to analyze the problem query now. On the SELECT clause, the selected columns do not cover all key columns of table PS_JOB. Column EFFSEQ missed. But on the WHERE clause: AND A.EFFSEQ = (SELECT MAX(A_ES.EFFSEQ) FROM PS_JOB A_ES WHERE A.EMPLID = A_ES.EMPLID AND A.EMPL_RCD = A_ES.EMPL_RCD AND A.EFFDT = A_ES.EFFDT) Guaranteed that selected key columns of table PS_JOB return unique result from PS_JOB; 16
  • 17. PS_FAST_EMP_QRY, because of line AND A1.ROWSECCLASS = 'CPHR7030' , EMPLID becomes a key and join with PS_JOB; PS_B_FAST_PERS_QRY, because of line AND A1.ROWSECCLASS = 'CPHR7030' , EMPLID becomes a key and join with PS_PERSONAL_DTA_VW; PS_ERSONAL_DATA_VW, joins with PS_JOB on its key column EMPLID. We can say it now, The SELECT statement can return the same result without DISTINCT. Result: With DISTINCT: User ran over 5 hours without any data returned. User session was killed by DBA. I also re-ran the same query over 3 hours without any data returned. After DISTINCT removed: 1 min 34.94 seconds! [Dennis: Wow, that’s awesome!] Logs: 20283 rows selected. Elapsed: 00:01:34.94 Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=59 Card=1 Bytes=135) 1 0 NESTED LOOPS (Cost=59 Card=1 Bytes=135) 2 1 NESTED LOOPS (Cost=59 Card=1 Bytes=117) 3 2 NESTED LOOPS (Cost=56 Card=1 Bytes=92) 4 3 NESTED LOOPS (Cost=54 Card=1 Bytes=77) 5 4 NESTED LOOPS (Cost=54 Card=1 Bytes=72) 6 5 NESTED LOOPS (Cost=52 Card=1 Bytes=55) 7 6 VIEW OF 'PS_B_FAST_PERS_QRY' (Cost=49 Card=1 B ytes=24) 8 7 SORT (UNIQUE) (Cost=49 Card=1 Bytes=76) 9 8 FILTER 10 9 NESTED LOOPS (Cost=15 Card=1 Bytes=76) 11 10 NESTED LOOPS (Cost=14 Card=1 Bytes=57) 12 11 NESTED LOOPS (Cost=11 Card=1 Bytes=32) 13 12 NESTED LOOPS (Cost=7 Card=2 Bytes=40) 14 13 INDEX (FAST FULL SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=7 Card=2 Bytes=30) 15 13 INDEX (UNIQUE SCAN) OF 'PS_PERSON' (UNIQUE) 16 12 INDEX (RANGE SCAN) OF 'PS_PERS_DAT A_EFFDT' (UNIQUE) (Cost=2 Card=1 Bytes=12) 17 16 SORT (AGGREGATE) 18 17 FILTER 19 18 INDEX (RANGE SCAN) OF 'PS_PERS_DATA_EFFDT' (UNIQUE) (Cost=2 Card=1 Bytes=12) 20 18 SORT (AGGREGATE) 21 20 FIRST ROW (Cost=2 Card=1 Bytes=12) 17
  • 18. 22 21 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_PERS_DATA_EFFDT' (UNIQUE) (Cost=2 Card=13441) 23 11 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=25) 24 23 INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=1) 25 24 SORT (AGGREGATE) 26 25 FIRST ROW (Cost=2 Card=1 Bytes=14) 27 26 INDEX (RANGE SCAN (MIN/MAX))OF 'PSAJOB' (NON- UNIQUE) (Cost=2 Card=87857) 28 24 SORT (AGGREGATE) 29 28 FIRST ROW (Cost=2 Card=1 Bytes=16) 30 29 INDEX (RANGE SCAN (MIN/MAX))OF 'PSAJOB' (NON- UNIQUE) (Cost=2 Card=87857) 31 10 TABLE ACCESS (BY INDEX ROWID) OF 'PS_FAST_SCRTY_2' (Cost=1 Card=1 Bytes=19) 32 31 INDEX (UNIQUE SCAN) OF 'PS_FAST_SCRTY_2' (UNIQUE) 33 9 SORT (AGGREGATE) 34 33 FILTER 35 34 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=1 Bytes=15) 36 34 SORT (AGGREGATE) 37 36 FIRST ROW (Cost=2 Card=1 Bytes=15) 38 37 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=15179) 39 6 TABLE ACCESS (BY INDEX ROWID) OF 'PS_NAMES' (Cost=3 Card=1 Bytes=31) 40 39 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=1) 41 40 SORT (AGGREGATE) 42 41 FILTER 43 42 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=1 Bytes=15) 44 42 SORT (AGGREGATE) 45 44 FIRST ROW (Cost=2 Card=1 Bytes=15) 46 45 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=15179) 47 5 INDEX (RANGE SCAN) OF 'PSBJOB' (NON-UNIQUE) (Cost=2 Card=1 Bytes=17) 48 47 SORT (AGGREGATE) 49 48 FIRST ROW (Cost=2 Card=1 Bytes=14) 50 49 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87857) 51 47 SORT (AGGREGATE) 52 51 FIRST ROW (Cost=2 Card=1 Bytes=16) 53 52 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87857) 54 4 INDEX (UNIQUE SCAN) OF 'PS_PERSON' (UNIQUE) 55 3 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=1 Bytes=15) 56 55 SORT (AGGREGATE) 57 56 FILTER 58 57 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=1 Bytes=15) 18
  • 19. 59 57 SORT (AGGREGATE) 60 59 FIRST ROW (Cost=2 Card=1 Bytes=15) 61 60 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_NAMES'(UNIQUE) (Cost=2 Card=15179) 62 2 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=25) 63 62 INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=1) 64 63 SORT (AGGREGATE) 65 64 FIRST ROW (Cost=2 Card=1 Bytes=14) 66 65 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87857) 67 63 SORT (AGGREGATE) 68 67 FIRST ROW (Cost=2 Card=1 Bytes=16) 69 68 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87857) 70 1 INDEX (UNIQUE SCAN) OF 'PS_FAST_SCRTY_2' (UNIQUE) Statistics ---------------------------------------------------------- 42 recursive calls 0 db block gets 460815 consistent gets 4367 physical reads 0 redo size 856878 bytes sent via SQL*Net to client 15527 bytes received via SQL*Net from client 1354 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 20283 rows processed Testing run on Microsoft SQL Server: SQL text: SELECT DISTINCT B.NAME, A.EMPLID, A.EMPL_RCD, A.EFFDT, A.EMPL_STATUS FROM PS_JOB A, PS_B_FAST_EMP_QRY A1, PS_PERSONAL_DTA_VW B, PS_B_FAST_PERS_QRY B1 WHERE A.EMPLID = A1.EMPLID AND A.EMPL_RCD = A1.EMPL_RCD AND A1.ROWSECCLASS = 'CPHR7030' AND B.EMPLID = B1.EMPLID AND B1.ROWSECCLASS = 'CPHR7030' AND ( A.EFFDT = (SELECT MAX(A_ED.EFFDT) FROM PS_JOB A_ED WHERE A.EMPLID = A_ED.EMPLID AND A.EMPL_RCD = A_ED.EMPL_RCD AND A_ED.EFFDT <= '2005-12-02') AND A.EFFSEQ = (SELECT MAX(A_ES.EFFSEQ) FROM PS_JOB A_ES WHERE A.EMPLID = A_ES.EMPLID AND A.EMPL_RCD = A_ES.EMPL_RCD AND A.EFFDT = A_ES.EFFDT) AND A.EMPLID = B.EMPLID ) With “DISTINCT”: 20283 rows fetched. Execution time: 06:37 19
  • 20. Without “DISTINCT”: 20283 rows fetched. Execution time: 00:25 900 800 700 Throughput (rows/sec) 600 500 400 300 200 100 0 DISTINCT without DISTINCT Fetch 20283 rows on MS SQL Server Figure case 2.1 Throughput (rows/sec) of a query with “SELECT DISTINCT/SELECT”. Compare the batch size of 20283 rows FETCHED with/without “DISTINCT”. After I removed “distinct” the query throughput is improved 15.88 times. Conclusion: Minimizing DISTINCT in the query can improves the performance and reduces the response time. 20
  • 21. Case 3: Query Tuning (Ref. Chapter 4.6) Scenario: Our Peoplesoft HRMS programmer showed me the following query, and told me it never return any data to her after 30 minutes. She said, she did not miss any join condition; all join were on key column of tables; and it was just a very simple query. She did not understand what the problems were. Problem Query: SELECT a.emplid FROM ps_job a, ps_b_fast_emp_qry a1, ps_jobcode_tbl b, ps_personal_data c, ps_sal_grade_tbl d, ps_employment e WHERE a.emplid = a1.emplid AND a.empl_rcd = a1.empl_rcd AND a1.rowsecclass = 'PPALL' AND e.emplid = a1.emplid AND e.empl_rcd = a1.empl_rcd AND a.effdt = (SELECT max(a_ed.effdt) FROM ps_job a_ed WHERE a.emplid = a_ed.emplid AND a.empl_rcd = a_ed.empl_rcd AND a_ed.effdt <= SYSDATE) AND a.effseq =(SELECT max(a_es.effseq) FROM ps_job a_es WHERE a.emplid = a_es.emplid AND a.empl_rcd = a_es.empl_rcd AND a.effdt = a_es.effdt) AND a.setid_jobcode = b.setid AND b.jobcode = a.jobcode AND b.effdt = (SELECT max(b_ed.effdt) FROM ps_jobcode_tbl b_ed WHERE b.setid = b_ed.setid AND b.jobcode = b_ed.jobcode AND b_ed.effdt <= a.effdt) AND a.emplid = c.emplid AND d.effdt = (SELECT max(d_ed.effdt) FROM ps_sal_grade_tbl d_ed WHERE d.setid = d_ed.setid AND d.sal_admin_plan = d_ed.sal_admin_plan AND d.grade = d_ed.grade AND d_ed.effdt <= SYSDATE) AND a.setid_salary = d.setid AND a.sal_admin_plan = d.sal_admin_plan AND a.grade = d.grade AND a.emplid = e.emplid AND a.empl_rcd = e.empl_rcd Description of the involved tables and views in this query: There are 7 tables and 3 views involved in this query. Tables: ***********on FROM clause • PS_JOB, a big table with 217 columns and 87,857 rows 21
  • 22. Key: emplid, emp_rcd, effdt and effseq. • PS_SAL_GRADE_TBL, 42 columns 1830 rows Key: setid, sal_admin_plan, grade and effdt • PS_EMPLOYMENT. 91 columns and 20291 rows Key: emplid, empl_rcd • PS_JOBCODE_TBL 126 columns and 830 rows Key: setid, jobcode, effdt ***********not on FROM clause • PS_FAST_SCRTY_2, 4 columns and 14,970 rows Key: setid, deptid and rowsecclass • PS_NAMES, 23 columns and 15,179 rows Key: emplid, name_type and effdt • PS_PERSON, 10 columns and 13,268 rows Key: emplid Views: ***********on FROM clause • PS_B_FAST_EMP_QRY is a view, built on 3 base tables and 1 view Tables: PS_JOB, PS_PERSON AND PS_FAST_SCRTY_2 View: PS_PERSON_NAME • PS_PERSONAL_DATA, built on 1 table table: PS_NAME ***********not on FROM clause • PS_PERSONAL_NAME Table: PS_NAME Query Tuning: This query looks similar as the one on Case 2, right? All our problem queries look similar. But they have different problem. 22
  • 23. PS_SAL_GRADE_TBL SETID: VARCHAR2(5) PS_EMPLOYMENT SAL_ADMIN_PLAN: VARCHAR2(4) PS_JOB GRADE: VARCHAR2(3) PS_JOBCODE_TBL EFFDT: DATE EMPLID: VARCHAR2(11) EFF_STATUS: VARCHAR2(1) EMPL_RCD: NUMBER SETID: VARCHAR2(5) EMPLID: VARCHAR2(11) DESCR: VARCHAR2(30) BENEFIT_RCD_NBR: NUMBER EMPL_RCD: NUMBER JOBCODE: VARCHAR2(6) DESCRSHORT: VARCHAR2(10) HOME_HOST_CLASS: VARCHAR2(1) EFFDT: DATE EFFDT: DATE SALARY_MATRIX_CD: VARCHAR2(5) HIRE_DT: DATE EFFSEQ: NUMBER DESCR: VARCHAR2(30) CURRENCY_CD: VARCHAR2(3) REHIRE_DT: DATE GVT_PAY_PLAN: VARCHAR2(2) DEPTID: VARCHAR2(10) MIN_RT_HOURLY: NUMBER(18,6) CMPNY_SENIORITY_DT: DATE JOBCODE: VARCHAR2(6) GVT_OCC_SERIES: VARCHAR2(4) BOCES_QURT_RT_HOUR: NUMBER(14,2) SERVICE_DT: DATE TRN_PROGRAM: VARCHAR2(6) POSITION_NBR: VARCHAR2(8) MID_RT_HOURLY: NUMBER(18,6) PROF_EXPERIENCE_DT: DATE GVT_EFFDT: DATE COMPANY: VARCHAR2(3) MAX_RT_HOURLY: NUMBER(18,6) LAST_VERIFICATN_DT: DATE GVT_FUNC_CLASS: VARCHAR2(2) GVT_EFFDT_PROPOSED: DATE BOCES_QURT_RT_DAIL: NUMBER(14,2) EXPECTED_RETURN_DT: DATE GVT_TRANS_NBR: NUMBER GVT_POSN_TITLE_CD: VARCHAR2(4) MIN_RT_MONTHLY: NUMBER(18,3) TERMINATION_DT: DATE GVT_OFFICIAL_DESCR: VARCHAR2(70) GVT_TRANS_NBR_SEQ: NUMBER BOCES_QURT_RT_MONT: NUMBER(17,2) LAST_DATE_WORKED: DATE GVT_WIP_STATUS: VARCHAR2(3) GVT_ORG_TTL_CD: VARCHAR2(4) MID_RT_MONTHLY: NUMBER(18,3) LAST_INCREASE_DT: DATE GVT_ORG_TTL_DESCR: VARCHAR2(70) GVT_STATUS_TYPE: VARCHAR2(3) MAX_RT_MONTHLY: NUMBER(18,3) OWN_5PERCENT_CO: VARCHAR2(1) GVT_NOA_CODE: VARCHAR2(3) GVT_PAY_BASIS: VARCHAR2(2) MIN_RT_ANNUAL: NUMBER(18,3) BUSINESS_TITLE: VARCHAR2(30) GVT_SUB_AGENCY: VARCHAR2(2) GVT_LEG_AUTH_1: VARCHAR2(3) BOCES_QURT_RT_ANUL: NUMBER(17,2) REPORTS_TO: VARCHAR2(8) GVT_PAR_AUTH_D1: VARCHAR2(25) GVT_POI: VARCHAR2(4) MID_RT_ANNUAL: NUMBER(18,3) SUPERVISOR_ID: VARCHAR2(11) GVT_PAREN_TITLE: VARCHAR2(1) GVT_PAR_AUTH_D1_2: VARCHAR2(25) MAX_RT_ANNUAL: NUMBER(18,3) PROBATION_DT: DATE GVT_LEG_AUTH_2: VARCHAR2(3) GVT_OPM_CERT_NBR: VARCHAR2(8) STEP_INCREM_TYPE: VARCHAR2(1) SECURITY_CLEARANCE: VARCHAR2(1) GVT_POSN_CLASS_STD: VARCHAR2(254) GVT_PAR_AUTH_D2: VARCHAR2(25) STEP_INCREM_ACCUM: VARCHAR2(3) COUNTRY_CODE: VARCHAR2(3) GVT_PAR_AUTH_D2_2: VARCHAR2(25) GVT_POSN_SENS_CD: VARCHAR2(1) MIN_RT_DAILY: NUMBER(18,3) PHONE: VARCHAR2(24) GVT_IA_ACTIONS: VARCHAR2(1) GVT_PAR_NTE_DATE: DATE MID_RT_DAILY: NUMBER(18,3) TIME_RPT_LOC: VARCHAR2(6) GVT_WORK_SCHED: VARCHAR2(1) GVT_EXEC_FIN_DISCL: VARCHAR2(1) MAX_RT_DAILY: NUMBER(18,3) JOB_REPORTING: VARCHAR2(1) GVT_EMP_FIN_INT: VARCHAR2(1) GVT_SUB_AGENCY: VARCHAR2(2) LABOR_AGREEMENT: VARCHAR2(6) DED_TAKEN: VARCHAR2(1) GVT_ELIG_FEHB: VARCHAR2(3) GVT_PATCOB_CD: VARCHAR2(1) EMPL_CTG: VARCHAR2(6) DED_SUBSET_ID: VARCHAR2(3) GVT_CLS_STANDARD: VARCHAR2(15) GVT_FEHB_DT: DATE EMPL_CTG_L1: VARCHAR2(6) GVT_SCD_RETIRE: DATE GVT_PAY_RATE_DETER: VARCHAR2(1) GVT_CLASSIFIER_ID: VARCHAR2(11) EMPL_CTG_L2: VARCHAR2(6) GVT_SCD_TSP: DATE GVT_DT_CLASSIFIED: DATE GVT_STEP: VARCHAR2(2) GVT_MAX_RT_BIWK: NUMBER(9,2) GVT_SCD_LEO: DATE GVT_RTND_PAY_PLAN: VARCHAR2(2) BARG_UNIT: VARCHAR2(4) GVT_MID_RT_BIWK: NUMBER(9,2) GVT_SCD_SEVPAY: DATE GVT_FUND_SOURCE: VARCHAR2(1) GVT_RTND_SAL_PLAN: VARCHAR2(4) GVT_MIN_RT_BIWK: NUMBER(9,2) GVT_SEVPAY_PRV_WKS: NUMBER GVT_RTND_GRADE: VARCHAR2(3) GVT_LEO_POSITION: VARCHAR2(1) GRADE_TITLE_JPN: VARCHAR2(60) GVT_MAND_RET_DT: DATE GVT_PERF_PLAN: VARCHAR2(8) GVT_RTND_STEP: NUMBER MIN_YRS_GRADE: NUMBER GVT_WGI_STATUS: VARCHAR2(1) GVT_RTND_GVT_STEP: VARCHAR2(2) GVT_TARGET_GRADE: VARCHAR2(2) MAX_YRS_GRADE: NUMBER GVT_INTRM_DAYS_WGI: NUMBER GVT_PI_UPD_IND: VARCHAR2(1) GVT_PAY_BASIS: VARCHAR2(2) MIN_GRD_AGE: NUMBER GVT_NONPAY_NOA: VARCHAR2(3) GVT_COMPRATE: NUMBER(18,6) EFF_STATUS: VARCHAR2(1) REVIEW_COUNT: NUMBER GVT_NONPAY_HRS_WGI: NUMBER(6,2) DESCRSHORT: VARCHAR2(10) GVT_LOCALITY_ADJ: NUMBER(7,2) ELIGIBILITY_POINTS: NUMBER(4,1) GVT_NONPAY_HRS_SCD: NUMBER(6,2) GVT_BIWEEKLY_RT: NUMBER(9,2) JOB_FUNCTION: VARCHAR2(3) REG_REGION: VARCHAR2(5) GVT_NONPAY_HRS_TNR: NUMBER(6,2) SETID_SALARY: VARCHAR2(5) GVT_DAILY_RT: NUMBER(9,2) JOB_PROFILE_ID: VARCHAR2(8) GVT_NONPAY_HRS_PRB: NUMBER(6,2) GVT_HRLY_RT_NO_LOC: NUMBER(18,6) SAL_ADMIN_PLAN: VARCHAR2(4) GVT_TEMP_PRO_EXPIR: DATE GRADE: VARCHAR2(3) GVT_DLY_RT_NO_LOC: NUMBER(9,2) GVT_TEMP_PSN_EXPIR: DATE GVT_BW_RT_NO_LOC: NUMBER(9,2) STEP: NUMBER GVT_DETAIL_EXPIRES: DATE MANAGER_LEVEL: VARCHAR2(2) GVT_MNLY_RT_NO_LOC: NUMBER(18,3) GVT_SABBATIC_EXPIR: DATE GVT_ANNL_RT_NO_LOC: NUMBER(18,3) SURVEY_SALARY: NUMBER GVT_RTND_GRADE_BEG: DATE SURVEY_JOB_CODE: VARCHAR2(8) GVT_XFER_FROM_AGCY: VARCHAR2(2) GVT_RTND_GRADE_EXP: DATE GVT_XFER_TO_AGCY: VARCHAR2(2) UNION_CD: VARCHAR2(3) GVT_NOA_CODE: VARCHAR2(3) RETRO_RATE: NUMBER(6,4) GVT_RETIRE_PLAN: VARCHAR2(1) GVT_CURR_APT_AUTH1: VARCHAR2(3) GVT_ANN_IND: VARCHAR2(1) RETRO_PERCENT: NUMBER(6,4) GVT_CURR_APT_AUTH2: VARCHAR2(3) CURRENCY_CD: VARCHAR2(3) GVT_FEGLI: VARCHAR2(2) GVT_APPT_EXPIR_DT: DATE GVT_FEGLI_LIVING: VARCHAR2(1) STD_HOURS: NUMBER(6,2) GVT_CNV_BEGIN_DATE: DATE STD_HRS_FREQUENCY: VARCHAR2(5) GVT_LIVING_AMT: NUMBER GVT_CAREER_CNV_DUE: DATE GVT_ANNUITY_OFFSET: NUMBER COMP_FREQUENCY: VARCHAR2(5) GVT_CAREER_COND_DT: DATE WORKERS_COMP_CD: VARCHAR2(4) GVT_CSRS_FROZN_SVC: VARCHAR2(4) GVT_APPT_LIMIT_HRS: NUMBER GVT_PREV_RET_COVRG: VARCHAR2(1) JOB_FAMILY: VARCHAR2(6) GVT_APPT_LIMIT_DYS: NUMBER JOB_KNOWHOW_POINTS: NUMBER GVT_FERS_COVERAGE: VARCHAR2(1) GVT_APPT_LIMIT_AMT: NUMBER GVT_TYPE_OF_APPT: VARCHAR2(2) JOB_ACCNTAB_POINTS: NUMBER GVT_SUPV_PROB_DT: DATE JOB_PROBSLV_POINTS: NUMBER GVT_POI: VARCHAR2(4) GVT_SES_PROB_DT: DATE GVT_POSN_OCCUPIED: VARCHAR2(1) JOB_POINTS_TOTAL: NUMBER GVT_SEC_CLR_STATUS: VARCHAR2(1) JOB_KNOWHOW_PCT: NUMBER(4,1) GVT_CONT_EMPLID: VARCHAR2(11) GVT_CLRNCE_STAT_DT: DATE GVT_ROUTE_NEXT: VARCHAR2(11) JOB_ACCNTAB_PCT: NUMBER(4,1) GVT_ERN_PGM_PERM: VARCHAR2(2) JOB_PROBSLV_PCT: NUMBER(4,1) GVT_CHANGE_FLAG: VARCHAR2(1) GVT_OCC_SERS_PERM: VARCHAR2(4) GVT_TSP_UPD_IND: VARCHAR2(1) REG_TEMP: VARCHAR2(1) GVT_GRADE_PERM: VARCHAR2(3) DIRECTLY_TIPPED: VARCHAR2(1) GVT_PI_UPD_IND: VARCHAR2(1) GVT_COMP_AREA_PERM: VARCHAR2(2) GVT_SF52_NBR: VARCHAR2(10) MED_CHKUP_REQ: VARCHAR2(1) GVT_COMP_LVL_PERM: VARCHAR2(3) FLSA_STATUS: VARCHAR2(1) GVT_S113G_CEILING: VARCHAR2(1) GVT_CHANGE_FLAG: VARCHAR2(1) GVT_LEO_POSITION: VARCHAR2(1) EEO1CODE: VARCHAR2(1) GVT_SPEP: VARCHAR2(2) EEO4CODE: VARCHAR2(1) GVT_ANNUIT_COM_DT: DATE GVT_WGI_DUE_DATE: DATE GVT_BASIC_LIFE_RED: VARCHAR2(2) EEO5CODE: VARCHAR2(2) GVT_DT_LEI: DATE EEO6CODE: VARCHAR2(1) GVT_DED_PRORT_DT: DATE GVT_FIN_DISCLOSURE: VARCHAR2(1) GVT_FEGLI_BASC_PCT: NUMBER(7,6) EEO_JOB_GROUP: VARCHAR2(4) GVT_FIN_DISCL_DATE: DATE US_SOC_CD: VARCHAR2(6) GVT_FEGLI_OPT_PCT: NUMBER(7,6) GVT_TENURE: VARCHAR2(1) GVT_FEHB_PCT: NUMBER(7,6) IPEDSSCODE: VARCHAR2(1) GVT_DETL_BARG_UNIT: VARCHAR2(4) CAN_PAYEQ_JOB_CLS: VARCHAR2(3) GVT_RETRO_FLAG: VARCHAR2(1) GVT_DETL_UNION_CD: VARCHAR2(3) GVT_RETRO_DED_FLAG: VARCHAR2(1) CAN_NOC_CD: VARCHAR2(4) NEXT_REVIEW_DT: DATE SEASONAL: VARCHAR2(1) GVT_RETRO_JOB_FLAG: VARCHAR2(1) GVT_WELFARE_WK_CD: VARCHAR2(2) GVT_RETRO_BSE_FLAG: VARCHAR2(1) BPS_ACTIVITY_CD: VARCHAR2(6) TENURE_ACCR_FLG: VARCHAR2(1) FUNCTION_CD: VARCHAR2(2) GVT_OTH_PAY_CHG: VARCHAR2(1) FTE_TENURE: NUMBER(3,2) GVT_DETL_POSN_NBR: VARCHAR2(8) BA_CD: VARCHAR2(3) EG_GROUP: VARCHAR2(6) TECHNICAL: VARCHAR2(1) ANNL_BEN_BASE_OVRD: VARCHAR2(1) FTE_FLX_SRVC: NUMBER(3,2) BENEFIT_PROGRAM: VARCHAR2(3) MED_SURV_REQ: VARCHAR2(1) CONTRACT_LENGTH: VARCHAR2(1) EMP_CATEGRY_FRA: VARCHAR2(3) UPDATE_PAYROLL: VARCHAR2(1) APPOINT_END_DT: DATE GVT_PAY_PLAN: VARCHAR2(2) ACTIVITY_TYPE_FRA: VARCHAR2(3) NEE_PROVIDER_ID: VARCHAR2(10) INSEE_CD_FRA: VARCHAR2(4) GVT_PAY_FLAG: VARCHAR2(1) FA_PAY_PROGRAM: VARCHAR2(3) GVT_NID_CHANGE: VARCHAR2(1) JOB_CTG_FRA_CD: VARCHAR2(2) FA_TYPE: VARCHAR2(3) UK_SOC_CD: VARCHAR2(2) SUPERVISOR_ID: VARCHAR2(11) FA_ELIG_DT: DATE APPT_TYPE: VARCHAR2(1) ENCUMBER_INDC: VARCHAR2(1) EDUC_LVL_AD_BTD: DATE POSN_MGMT_INDC: VARCHAR2(1) MAIN_APPT_NUM_JPN: NUMBER OFFICIAL_LANG: VARCHAR2(3) POSITION_OVERRIDE: VARCHAR2(1) EG_ACADEMIC_RANK: VARCHAR2(3) RELAT_TO_OWNER_NLD: VARCHAR2(1) EG_GROUP: VARCHAR2(6) POSN_CHANGE_RECORD: VARCHAR2(1) INS_DAYS_BRA: VARCHAR2(2) EMPL_STATUS: VARCHAR2(1) HP_STATS_DUTIES: VARCHAR2(2) INS_MONTHS_BRA: VARCHAR2(2) HP_STATS_RPT_FLAG: VARCHAR2(1) ACTION: VARCHAR2(3) INS_YEARS_BRA: VARCHAR2(2) ACTION_DT: DATE ENCUMB_SAL_OPTN: VARCHAR2(3) ACTION_REASON: VARCHAR2(3) ENCUMB_SAL_AMT: NUMBER(18,3) LOCATION: VARCHAR2(10) INAIL_CODE: VARCHAR2(11) TAX_LOCATION_CD: VARCHAR2(10) ASCO_CD_AUS: VARCHAR2(6) JOB_ENTRY_DT: DATE PKG_TEMPLATE_ID: VARCHAR2(10) DEPT_ENTRY_DT: DATE PKG_RULE_ID: VARCHAR2(10) POSITION_ENTRY_DT: DATE FUNCTION_AUS: VARCHAR2(1) SHIFT: VARCHAR2(1) ANN_CNTACT_HRS_AUS: NUMBER(6,2) REG_TEMP: VARCHAR2(1) TEACH_WEEKS_AUS: NUMBER FULL_PART_TIME: VARCHAR2(1) CASUAL_TYPE_AUS: VARCHAR2(1) COMPANY: VARCHAR2(3) WORK_DAY_HOURS: NUMBER(6,2) PAYGROUP: VARCHAR2(3) FA_PAY_PROGRAM: VARCHAR2(3) BAS_GROUP_ID: VARCHAR2(3) ELECTION_GROUP: VARCHAR2(5) ELIG_CONFIG1: VARCHAR2(10) LABOR_AGREEMENT: VARCHAR2(6) ELIG_CONFIG2: VARCHAR2(10) FP_PROF_CATG: VARCHAR2(3) ELIG_CONFIG3: VARCHAR2(10) FP_JOB_FMLY: VARCHAR2(4) ELIG_CONFIG4: VARCHAR2(10) FP_OFF_COLAG: VARCHAR2(1) ELIG_CONFIG5: VARCHAR2(10) FP_MATRIX_TYP: VARCHAR2(3) ELIG_CONFIG6: VARCHAR2(10) FP_MATRIX_CD: VARCHAR2(4) ELIG_CONFIG7: VARCHAR2(10) FP_BUSINESS_CD: VARCHAR2(4) ELIG_CONFIG8: VARCHAR2(10) FP_JOBCD_ACC: VARCHAR2(1) ELIG_CONFIG9: VARCHAR2(10) FP_ATCH_AREA: VARCHAR2(4) BEN_STATUS: VARCHAR2(4) FP_JOB_TYP: VARCHAR2(2) BAS_ACTION: VARCHAR2(3) FP_AUTO_RATFY: VARCHAR2(1) COBRA_ACTION: VARCHAR2(3) LAST_UPDATE_DATE: DATE EMPL_TYPE: VARCHAR2(1) REG_REGION: VARCHAR2(5) HOLIDAY_SCHEDULE: VARCHAR2(6) SAL_RANGE_MIN_RATE: NUMBER(18,6) STD_HOURS: NUMBER(6,2) SAL_RANGE_MID_RATE: NUMBER(18,6) STD_HRS_FREQUENCY: VARCHAR2(5) SAL_RANGE_MAX_RATE: NUMBER(18,6) OFFICER_CD: VARCHAR2(1) SAL_RANGE_CURRENCY: VARCHAR2(3) EMPL_CLASS: VARCHAR2(3) SAL_RANGE_FREQ: VARCHAR2(5) SAL_ADMIN_PLAN: VARCHAR2(4) JOB_PROFILE_ID: VARCHAR2(8) GRADE: VARCHAR2(3) BEN_DEFN_PGM: VARCHAR2(3) GRADE_ENTRY_DT: DATE RETIREMENT_SYSTEM: VARCHAR2(1) STEP: NUMBER ERNCD: VARCHAR2(3) STEP_ENTRY_DT: DATE DESCRLONG: LONG GL_PAY_TYPE: VARCHAR2(6) PS_FAST_SCRTY_2 ACCT_CD: VARCHAR2(25) EARNS_DIST_TYPE: VARCHAR2(1) COMP_FREQUENCY: VARCHAR2(5) SETID: VARCHAR2(5) COMPRATE: NUMBER(18,6) DEPTID: VARCHAR2(10) CHANGE_AMT: NUMBER(18,6) ROWSECCLASS: VARCHAR2(30) CHANGE_PCT: NUMBER(6,3) ACCESS_CD: VARCHAR2(1) ANNUAL_RT: NUMBER(18,3) MONTHLY_RT: NUMBER(18,3) DAILY_RT: NUMBER(18,3) HOURLY_RT: NUMBER(18,6) ANNL_BENEF_BASE_RT: NUMBER(18,3) SHIFT_RT: NUMBER(18,6) SHIFT_FACTOR: NUMBER(4,3) CURRENCY_CD: VARCHAR2(3) BUSINESS_UNIT: VARCHAR2(5) SETID_DEPT: VARCHAR2(5) SETID_JOBCODE: VARCHAR2(5) SETID_LOCATION: VARCHAR2(5) SETID_SALARY: VARCHAR2(5) REG_REGION: VARCHAR2(5) DIRECTLY_TIPPED: VARCHAR2(1) FLSA_STATUS: VARCHAR2(1) EEO_CLASS: VARCHAR2(1) FUNCTION_CD: VARCHAR2(2) TARIFF_GER: VARCHAR2(2) TARIFF_AREA_GER: VARCHAR2(3) PERFORM_GROUP_GER: VARCHAR2(2) LABOR_TYPE_GER: VARCHAR2(1) SPK_COMM_ID_GER: VARCHAR2(9) PS_PERSON_NAME HOURLY_RT_FRA: VARCHAR2(3) ACCDNT_CD_FRA: VARCHAR2(1) EMPLID: A.EMPLID VALUE_1_FRA: VARCHAR2(5) COUNTRY_NM_FORMAT: A.COUNTRY_NM_FORMAT VALUE_2_FRA: VARCHAR2(5) NAME: A.NAME VALUE_3_FRA: VARCHAR2(5) NAME_INITIALS: A.NAME_INITIALS VALUE_4_FRA: VARCHAR2(5) NAME_PREFIX: A.NAME_PREFIX VALUE_5_FRA: VARCHAR2(5) PS_B_FAST_EMP_QRY NAME_SUFFIX: A.NAME_SUFFIX CTG_RATE: NUMBER NAME_ROYAL_PREFIX: A.NAME_ROYAL_PREFIX PAID_HOURS: NUMBER(6,2) EMPLID: A.EMPLID NAME_ROYAL_SUFFIX: A.NAME_ROYAL_SUFFIX PAID_FTE: NUMBER(7,6) EMPL_RCD: JOB.EMPL_RCD NAME_TITLE: A.NAME_TITLE PAID_HRS_FREQUENCY: VARCHAR2(5) ROWSECCLASS: SEC.ROWSECCLASS LAST_NAME_SRCH: A.LAST_NAME_SRCH UNION_FULL_PART: VARCHAR2(1) ACCESS_CD: SEC.ACCESS_CD FIRST_NAME_SRCH: A.FIRST_NAME_SRCH UNION_POS: VARCHAR2(1) NAME: B.NAME LAST_NAME: A.LAST_NAME MATRICULA_NBR: NUMBER LAST_NAME_SRCH: B.LAST_NAME_SRCH FIRST_NAME: A.FIRST_NAME SOC_SEC_RISK_CODE: VARCHAR2(3) NAME_AC: B.NAME_AC MIDDLE_NAME: A.MIDDLE_NAME UNION_FEE_AMOUNT: NUMBER(8,2) PER_STATUS: A.PER_STATUS SECOND_LAST_NAME: A.SECOND_LAST_NAME UNION_FEE_START_DT: DATE SECOND_LAST_SRCH: A.SECOND_LAST_SRCH UNION_FEE_END_DT: DATE NAME_AC: A.NAME_AC EXEMPT_JOB_LBR: VARCHAR2(1) PREF_FIRST_NAME: A.PREF_FIRST_NAME EXEMPT_HOURS_MONTH: NUMBER PARTNER_LAST_NAME: A.PARTNER_LAST_NAME WRKS_CNCL_FUNCTION: VARCHAR2(1) PARTNER_ROY_PREFIX: A.PARTNER_ROY_PREFIX INTERCTR_WRKS_CNCL: VARCHAR2(1) LAST_NAME_PREF_NLD: A.LAST_NAME_PREF_NLD CURRENCY_CD1: VARCHAR2(3) NAME_TYPE: A.NAME_TYPE PAY_UNION_FEE: VARCHAR2(1) ASOFDATE: A.EFFDT UNION_CD: VARCHAR2(3) BARG_UNIT: VARCHAR2(4) UNION_SENIORITY_DT: DATE ENTRY_DATE: DATE LABOR_AGREEMENT: VARCHAR2(6) EMPL_CTG: VARCHAR2(6) EMPL_CTG_L1: VARCHAR2(6) EMPL_CTG_L2: VARCHAR2(6) SETID_LBR_AGRMNT: VARCHAR2(5) GP_PAYGROUP: VARCHAR2(10) GP_DFLT_ELIG_GRP: VARCHAR2(1) GP_ELIG_GRP: VARCHAR2(10) PS_NAMES GP_DFLT_CURRTTYP: VARCHAR2(1) PS_PERSON CUR_RT_TYPE: VARCHAR2(5) GP_DFLT_EXRTDT: VARCHAR2(1) EMPLID: VARCHAR2(11) GP_ASOF_DT_EXG_RT: VARCHAR2(1) EMPLID: VARCHAR2(11) NAME_TYPE: VARCHAR2(3) ADDS_TO_FTE_ACTUAL: VARCHAR2(1) PER_STATUS: VARCHAR2(1) EFFDT: DATE CLASS_INDC: VARCHAR2(1) BIRTHDATE: DATE NAME_PREFIX: VARCHAR2(4) ENCUMB_OVERRIDE: VARCHAR2(1) BIRTHPLACE: VARCHAR2(30) NAME_SUFFIX: VARCHAR2(15) FICA_STATUS_EE: VARCHAR2(1) BIRTHCOUNTRY: VARCHAR2(3) LAST_NAME_SRCH: VARCHAR2(30) FTE: NUMBER(7,6) BIRTHSTATE: VARCHAR2(6) FIRST_NAME_SRCH: VARCHAR2(30) PRORATE_CNT_AMT: VARCHAR2(1) DT_OF_DEATH: DATE FIRST_NAME: VARCHAR2(30) PAY_SYSTEM_FLG: VARCHAR2(2) ORIG_HIRE_DT: DATE MIDDLE_NAME: VARCHAR2(30) PS_PERSONAL_DATA BORDER_WALKER: VARCHAR2(1) HIGHLY_COMP_EMPL_C: VARCHAR2(1) LAST_NAME: VARCHAR2(30) LUMP_SUM_PAY: VARCHAR2(1) HIGHLY_COMP_EMPL_P: VARCHAR2(1) COUNTRY_NM_FORMAT: VARCHAR2(3) EMPLID: A.EMPLID CONTRACT_NUM: VARCHAR2(25) NAME: VARCHAR2(50) NAME: A.NAME JOB_INDICATOR: VARCHAR2(1) NAME_INITIALS: VARCHAR2(6) WRKS_CNCL_ROLE_CHE: VARCHAR2(30) NAME_ROYAL_PREFIX: VARCHAR2(15) BENEFIT_SYSTEM: VARCHAR2(2) NAME_ROYAL_SUFFIX: VARCHAR2(15) WORK_DAY_HOURS: NUMBER(6,2) NAME_TITLE: VARCHAR2(30) REPORTS_TO: VARCHAR2(8) SECOND_LAST_NAME: VARCHAR2(30) FORCE_PUBLISH: DATE SECOND_LAST_SRCH: VARCHAR2(30) JOB_DATA_SRC_CD: VARCHAR2(3) NAME_AC: VARCHAR2(50) ESTABID: VARCHAR2(12) PREF_FIRST_NAME: VARCHAR2(30) PRIMARY_JOB: VARCHAR2(1) PARTNER_LAST_NAME: VARCHAR2(30) BOCES_TERM_JOBS: VARCHAR2(1) PARTNER_ROY_PREFIX: VARCHAR2(15) BOCES_TRM_JOB_PROC: VARCHAR2(1) LAST_NAME_PREF_NLD: VARCHAR2(1) BOCES_CIVIL_SRV: VARCHAR2(6) 23
  • 24. I checked the explain plan of this query first: Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=693 Card=1 Bytes=155) 1 0 FILTER 2 1 NESTED LOOPS (Cost=693 Card=1 Bytes=155) 3 2 HASH JOIN (Cost=693 Card=1 Bytes=148) 4 3 NESTED LOOPS (Cost=691 Card=1 Bytes=132) 5 4 NESTED LOOPS (Cost=689 Card=1 Bytes=114) 6 5 NESTED LOOPS (Cost=687 Card=1 Bytes=99) 7 6 NESTED LOOPS (Cost=687 Card=3 Bytes=282) 8 7 HASH JOIN (Cost=687 Card=2 Bytes=152) 9 8 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=25) 10 9 NESTED LOOPS (Cost=13 Card=2 Bytes=80) 11 10 INDEX (FAST FULL SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=7 Card=2 Bytes=30) 12 10 INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=1) 13 12 SORT (AGGREGATE) 14 13 FIRST ROW (Cost=2 Card=1 Bytes=14) 15 14 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87871) 16 12 SORT (AGGREGATE) 17 16 FIRST ROW (Cost=2 Card=1 Bytes=16) 18 17 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87871) 19 8 TABLE ACCESS (FULL) OF 'PS_JOB' (Cost=673 Card=3 Bytes=108) 20 7 INDEX (UNIQUE SCAN) OF 'PS_FAST_SCRTY_2' (UNIQUE) 21 6 INDEX (UNIQUE SCAN) OF 'PS_PERSON' (UNIQUE) 22 5 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=1 Bytes=15) 23 22 SORT (AGGREGATE) 24 23 FILTER 25 24 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) 24
  • 25. (Cost=2 Card=1 Bytes=15) 26 24 SORT (AGGREGATE) 27 26 FIRST ROW (Cost=2 Card=1 Bytes=15) 28 27 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_NA MES' (UNIQUE) (Cost=2 Card=15182) 29 4 INDEX (RANGE SCAN) OF 'PS_SAL_GRADE_TBL' (UNIQUE) (Cost=2 Card=1 Bytes=18) 30 29 SORT (AGGREGATE) 31 30 FIRST ROW (Cost=2 Card=1 Bytes=18) 32 31 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_SAL_GRADE_TBL' (UNIQUE) (Cost=2 Card=1830) 33 3 INDEX (FAST FULL SCAN) OF 'PS0JOBCODE_TBL' (NON-UNIQUE) (Cost=1 Card=830 Bytes=13280) 34 2 INDEX (UNIQUE SCAN) OF 'PS_EMPLOYMENT' (UNIQUE) 35 1 SORT (AGGREGATE) 36 35 FIRST ROW (Cost=2 Card=1 Bytes=14) 37 36 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87871) 38 1 SORT (AGGREGATE) 39 38 FIRST ROW (Cost=2 Card=1 Bytes=16) 40 39 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87871) 41 1 SORT (AGGREGATE) 42 41 INDEX (FAST FULL SCAN) OF 'PS0JOBCODE_TBL' (NON-UNIQUE) (Cost=1 Card=1 Bytes=16) 43 1 SORT (AGGREGATE) 44 43 FILTER 45 44 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=1 Bytes=15) 46 44 SORT (AGGREGATE) 47 46 FIRST ROW (Cost=2 Card=1 Bytes=15) 48 47 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=15182) The optimized Mode we use is CHOOSE. Oracle calculates the cost of this query is 693. On the class of AQuery, I got some a hint when professor talked about “Cost based Optimization” and “Interchange sorting + order preserving operators”. The hint is left all group by, sorting etc. below the bottom of each join. Then I re-wrote the query. Actually what I did was only re-organized the order of WHERE clauses as following: SELECT a.emplid FROM ps_job a, ps_b_fast_emp_qry a1, ps_jobcode_tbl b, ps_personal_data c, ps_sal_grade_tbl d, ps_employment e WHERE a1.emplid = a.emplid AND a1.empl_rcd = a.empl_rcd AND 'PPALL' = a1.rowsecclass AND a1.emplid = e.emplid AND a1.empl_rcd = e.empl_rcd AND b.setid = a.setid_jobcode AND a.jobcode = b.jobcode AND c.emplid = a.emplid AND d.setid = a.setid_salary 25
  • 26. AND d.sal_admin_plan = a.sal_admin_plan AND d.grade = a.grade AND e.emplid = a.emplid AND e.empl_rcd = a.empl_rcd AND c.emplid = a1.emplid AND e.emplid = c.emplid AND b.effdt = (SELECT max(b_ed.effdt) FROM ps_jobcode_tbl b_ed WHERE b_ed.setid = b.setid AND b_ed.jobcode = b.jobcode AND a.effdt >= b_ed.effdt) AND d.effdt = (SELECT max(d_ed.effdt) FROM ps_sal_grade_tbl d_ed WHERE d_ed.setid = d.setid AND d_ed.sal_admin_plan = d.sal_admin_plan AND d_ed.grade = d.grade AND d_ed.effdt <= SYSDATE) AND a.effdt =(SELECT max(a_ed.effdt) FROM ps_job a_ed WHERE a_ed.emplid = a1.emplid AND a_ed.empl_rcd = a.empl_rcd AND a_ed.effdt <= SYSDATE) AND a.effseq =(SELECT max(a_es.effseq) FROM ps_job a_es WHERE a_es.emplid = a1.emplid AND a_es.empl_rcd = a.empl_rcd AND a_es.effdt = a.effdt); This time the query explain plan became to: Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=22 Card=1 Bytes=155) 1 0 FILTER 2 1 HASH JOIN (Cost=22 Card=1 Bytes=155) 3 2 NESTED LOOPS (Cost=20 Card=1 Bytes=139) 4 3 NESTED LOOPS (Cost=18 Card=1 Bytes=121) 5 4 NESTED LOOPS (Cost=15 Card=1 Bytes=85) 6 5 NESTED LOOPS (Cost=13 Card=1 Bytes=70) 7 6 NESTED LOOPS (Cost=13 Card=3 Bytes=189) 8 7 NESTED LOOPS (Cost=13 Card=3 Bytes=174) 9 8 NESTED LOOPS (Cost=13 Card=2 Bytes=80) 10 9 INDEX (FAST FULL SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=7 Card=2 Bytes=30) 11 9 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=25) 26
  • 27. 12 11 INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=1) 13 12 SORT (AGGREGATE) 14 13 FIRST ROW (Cost=2 Card=1 Bytes=14) 15 14 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87871) 16 12 SORT (AGGREGATE) 17 16 FIRST ROW (Cost=2 Card=1 Bytes=16) 18 17 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87871) 19 8 INDEX (UNIQUE SCAN) OF 'PS_FAST_SCRTY_2' (UNIQUE) 20 7 INDEX (UNIQUE SCAN) OF 'PS_PERSON' (UNIQUE) 21 6 INDEX (UNIQUE SCAN) OF 'PS_EMPLOYMENT' (UNIQUE) 22 5 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=1 Bytes=15) 23 22 SORT (AGGREGATE) 24 23 FILTER 25 24 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=1 Bytes=15) 26 24 SORT (AGGREGATE) 27 26 FIRST ROW (Cost=2 Card=1 Bytes=15) 28 27 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=15182) 29 4 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=36) 30 29 INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=1) 31 30 SORT (AGGREGATE) 32 31 FIRST ROW (Cost=2 Card=1 Bytes=14) 33 32 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87871) 34 30 SORT (AGGREGATE) 35 34 FIRST ROW (Cost=2 Card=1 Bytes=16) 36 35 INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=87871) 37 3 INDEX (RANGE SCAN) OF 'PS_SAL_GRADE_TBL' (UNIQUE) (Cost=2 Card=1 Bytes=18) 38 37 SORT (AGGREGATE) 39 38 FIRST ROW (Cost=2 Card=1 Bytes=18) 40 39 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_SAL_GRADE_TBL' (UNIQUE) (Cost=2 Card=1830) 41 2 INDEX (FAST FULL SCAN) OF 'PS0JOBCODE_TBL' (NON-UNIQUE) (Cost=1 Card=830 Bytes=13280) 42 1 SORT (AGGREGATE) 43 42 INDEX (FAST FULL SCAN) OF 'PS0JOBCODE_TBL' (NON-UNIQUE) (Cost=1 Card=1 Bytes=16) 44 1 SORT (AGGREGATE) 45 44 FILTER 46 45 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=1 Bytes=15) 47 45 SORT (AGGREGATE) 48 47 FIRST ROW (Cost=2 Card=1 Bytes=15) 49 48 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=15182) 27
  • 28. Oracle calculates the cost of this query is 22. Result: Before re-write: After 30 minutes running and without any data returned, query process was killed. After I re-order the WHERE clause: 37.56 seconds! [Dennis: Nice! Probably when things get this complicated the optimizer gives up.] 20085 rows selected. Elapsed: 00:00:37.56 Statistics ---------------------------------------------------------- 21 recursive calls 0 db block gets 469078 consistent gets 4462 physical reads 0 redo size 387406 bytes sent via SQL*Net to client 15373 bytes received via SQL*Net from client 1340 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 20085 rows processed Testing run on Microsoft SQL Server: Before query re-written: 20085 rows fetched. Execution time: 01:28 After query re-written: 20085 rows fetched. Execution time: 00:29 28
  • 29. 800 700 600 Throughput (rows/sec) 500 before query re-write 400 after query re-write 300 200 100 0 Oracle SQL Server Figure case 3.1 Throughput (rows/sec) of a query with before/after re-write. Compare the batch size of 20283 rows FETCHED with/without “DISTINCT”. After I removed “distinct” the query throughput is improved 15.88 times. Conclusion: Optimizer of database system is not as smart as we think . When Tuning a SQL, 1. Minimized the data as much as possible before submit it to upper level join. 2. We need care about the join condition of WHERE clause. I used to think that cost base database system is smart enough to detail with nature join - I did not realize that the order of enjoin conditions affects query assess plan. [Dennis: Right. When it gets complicated] 29
  • 30. Case 4: Understanding Access Plan (Ref. Appendix D) Scenario: I tuned a query for one of our developer against our testing environment (added an index to one of the tables). It works fine on our testing environment – execution time is 52.73 seconds (before I tuned the query, it did not return any data after 2 hours). On the next coming morning, our program told me, the query did not work on our production system. Problem Query (works on testing system, does not work on production system): SELECT DISTINCT substr(A.ACCT_CD, 1, 1) ACCTFUNDCODE, substr(A.ACCT_CD, 3, 3) ACCTCOSER, substr(A.ACCT_CD, 7, 4) ACCTPROGRAM, substr(A.ACCT_CD, 12, 4) SHORTACCT, substr(A.ACCT_CD, 17, 3) SUFFIX, substr(A.ACCT_CD, 3, 3) || '.' || substr(A.ACCT_CD, 17, 3) COSER_YR, E.DESCR DESCRACCT, C.NAME EENAME, B.DESCR DESCRJOB, TO_CHAR(P.PAY_END_DT, 'YYYY-MM-DD') PDATE, A.POSTED_ACTUAL_AMT POSTED_ACTUAL_AMT, A.POSTED_ENCUMB_AMT POSTED_ENCUMB_AMT, A.POSTED_ACTUAL_AMT + A.POSTED_ENCUMB_AMT ACTUAL_ENCUMB_AMT FROM PS_BUDGET_ACTUALS A, PS_JOBCODE_TBL B, SYSADM.PS_PERSONAL_DTA_VW C, PS_ACCT_CD_TBL E, PS_PAY_CALENDAR P WHERE A.SETID = B.SETID AND A.JOBCODE = B.JOBCODE AND A.SETID_JOBCODE = 'NCBOC' AND A.ACCT_CD = E.ACCT_CD AND A.FISCAL_YEAR = '2005' AND A.EMPLID = C.EMPLID AND B.SETID = 'NCBOC' AND B.EFFDT = (SELECT MAX(B_ED.EFFDT) FROM PS_JOBCODE_TBL B_ED WHERE B.SETID = B_ED.SETID AND B.JOBCODE = B_ED.JOBCODE AND B_ED.EFFDT <= SYSDATE) AND E.EFFDT =(SELECT MAX(E_ED.EFFDT) FROM PS_ACCT_CD_TBL E_ED WHERE E.ACCT_CD = E_ED.ACCT_CD AND E_ED.EFFDT <= SYSDATE) AND P.COMPANY = 'NCB' AND P.PAYGROUP = 'ACT' AND P.CA_GL_INTFC_RUN = 'Y' AND P.PAY_END_DT =(SELECT MAX(PP.PAY_END_DT) FROM PS_PAY_CALENDAR PP WHERE PP.CA_GL_INTFC_RUN = 'Y' AND PP.PAYGROUP = 'ACT' AND PP.COMPANY = 'NCB') ORDER BY substr(A.ACCT_CD, 1, 1), substr(A.ACCT_CD, 3, 3), substr(A.ACCT_CD, 7, 4), substr(A.ACCT_CD, 12, 4), C.NAME; Analysis: 30
  • 31. The above is query is one of our problem queries, which I cannot remove “distinct”. Table PS_PAY _CALENDAR missed join with other tables. At the beginning, I thought it is impossible that same query works on testing system, but does not work on production system. Our testing database was cloned from production couple of weeks ago. I spent a couple of hours to compare the two environments. I did not find any different. It is weird! Does production system uses same explain plan to process the query as testing system? Explain Plan of TESTING SYSTEM: 39647 rows selected. Elapsed: 00:00:52.73 Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=340 Card=1 Bytes=171) 1 0 SORT (UNIQUE) (Cost=306 Card=1 Bytes=171) 2 1 FILTER 3 2 TABLE ACCESS (BY INDEX ROWID) OF 'PS_ACCT_CD_TBL' (Cost=3 Card=1 Bytes=44) 4 3 NESTED LOOPS (Cost=272 Card=1 Bytes=171) 5 4 HASH JOIN (Cost=269 Card=1 Bytes=127) 6 5 INDEX (FAST FULL SCAN) OF 'PS0NAMES' (NON-UNIQUE) (Cost=15 Card=5 Bytes=155) 7 5 HASH JOIN (Cost=253 Card=1211 Bytes=116256) 8 7 NESTED LOOPS (Cost=2 Card=13 Bytes=676) 9 8 TABLE ACCESS (BY INDEX ROWID) OF 'PS_PAY_CALENDAR' (Cost=1 Card=1 Bytes=14) 10 9 INDEX (UNIQUE SCAN) OF 'PS_PAY_CALENDAR' (UNIQUE) 11 10 SORT (AGGREGATE) 12 11 TABLE ACCESS (FULL) OF 'PS_PAY_CALENDAR' (Cost=1 Card=42 Bytes=588) 13 8 INDEX (FAST FULL SCAN) OF 'PS0JOBCODE_TBL' (NON-UNIQUE) (Cost=1 Card=13 Bytes=494) 14 7 TABLE ACCESS (FULL) OF 'PS_BUDGET_ACTUALS' (Cost=250 Card=42469 Bytes=1868636) 15 4 INDEX (RANGE SCAN) OF 'PS_ACCT_CD_TBL' (UNIQUE) (Cost=2 Card=1) 16 15 SORT (AGGREGATE) 17 16 FIRST ROW (Cost=2 Card=1 Bytes=24) 18 17 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_ACCT_CD_TBL' (UNIQUE) (Cost=2 Card=38794) 19 2 SORT (AGGREGATE) 20 19 INDEX (FAST FULL SCAN) OF 'PS0JOBCODE_TBL' (NON-UNIQUE) (Cost=1 Card=1 Bytes=16) 21 2 SORT (AGGREGATE) 22 21 FILTER 23 22 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2Card=1 Bytes=15) 24 22 SORT (AGGREGATE) 25 24 FIRST ROW (Cost=2 Card=1 Bytes=15) 26 25 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=15007) 31
  • 32. Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 141999 consistent gets 0 physical reads 0 redo size 2273623 bytes sent via SQL*Net to client 29813 bytes received via SQL*Net from client 2645 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 39647 rows processed Explain Plan of PRODUCTION SYSTEM (which query does not work!): Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=353 Card=1 Bytes=171) 1 0 SORT (UNIQUE) (Cost=319 Card=1 Bytes=171) 2 1 FILTER 3 2 TABLE ACCESS (BY INDEX ROWID) OF 'PS_ACCT_CD_TBL' (Cost=3 Card=1 Bytes=44) 4 3 NESTED LOOPS (Cost=285 Card=1 Bytes=171) 5 4 HASH JOIN (Cost=282 Card=1 Bytes=127) 6 5 MERGE JOIN (CARTESIAN) (Cost=18 Card=24 Bytes=1992) 7 6 NESTED LOOPS (Cost=16 Card=2 Bytes=90) 8 7 TABLE ACCESS (BY INDEX ROWID) OF 'PS_PAY_CALENDAR' (Cost=1 Card=1 Bytes=14) 9 8 INDEX (UNIQUE SCAN) OF 'PS_PAY_CALENDAR' (UNIQUE) 10 9 SORT (AGGREGATE) 11 10 TABLE ACCESS (FULL) OF 'PS_PAY_CALENDAR' (Cost=1 Card=42 Bytes=588) 12 7 INDEX (FAST FULL SCAN) OF 'PS0NAMES' (NON-UNIQUE) (Cost=15 Card=2 Bytes=62) 13 6 BUFFER (SORT) (Cost=3 Card=12 Bytes=456) 14 13 INDEX (FAST FULL SCAN) OF 'PS0JOBCODE_TBL' (NON-UNIQUE) (Cost=1 Card=12 Bytes=456) 15 5 TABLE ACCESS (FULL) OF 'PS_BUDGET_ACTUALS' (Cost=263 Card=44417 Bytes=1954348) 16 4 INDEX (RANGE SCAN) OF 'PS_ACCT_CD_TBL' (UNIQUE) (Cost=2 Card=1) 17 16 SORT (AGGREGATE) 18 17 FIRST ROW (Cost=2 Card=1 Bytes=24) 19 18 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_ACCT_CD_TBL' (UNIQUE) (Cost=2 Card=39090) 20 2 SORT (AGGREGATE) 21 20 INDEX (FAST FULL SCAN) OF 'PS0JOBCODE_TBL' (NON-UNIQUE) (Cost=1 Card=1 Bytes=16) 22 2 SORT (AGGREGATE) 23 22 FILTER 24 23 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) (Cost=2Card=1 Bytes=15) 25 23 SORT (AGGREGATE) 32
  • 33. 26 25 FIRST ROW (Cost=2 Card=1 Bytes=15) 27 26 INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_NAMES' (UNIQUE) (Cost=2 Card=15181) The cost of testing system is 340; the cost of product system is 353 – The explain plans are different between testing and production. But it looks like no big different. But what caused the different process steps? Testing system and production database have same parameters, same database structure (tables, indexes - all system analyzed recently). The only different is the data – after we cloned the testing system from Production system, there is no any update on testing system any more. Size of involved database objects (tables or views) of production system and testing system Production System (rows) Testing System (rows) PS_BUDGET_ACTUALS 266502 254816 PS_JOBCODE_TBL 830 827 PS_PERSONAL_DTA_VW 13270 13119 PS_ACCT_CD_TBL 39090 38794 _PAY_CALENDAR 168 168 Thought I don’t think the minor different between the data size of production system and testing system, I have to admit that Oracle calculates the query cost base on the table size. I tried to force the query use RULE BASE to run on the production system – it works now. SELECT /*+ RULE */ DISTINCT substr(A.ACCT_CD, 1, 1) ACCTFUNDCODE, substr(A.ACCT_CD, 3, 3) ACCTCOSER, substr(A.ACCT_CD, 7, 4) ACCTPROGRAM, substr(A.ACCT_CD, 12, 4) SHORTACCT, substr(A.ACCT_CD, 17, 3) SUFFIX, substr(A.ACCT_CD, 3, 3) || '.' || substr(A.ACCT_CD, 17, 3) COSER_YR, E.DESCR DESCRACCT, C.NAME EENAME, B.DESCR DESCRJOB, TO_CHAR(P.PAY_END_DT, 'YYYY-MM-DD') PDATE, A.POSTED_ACTUAL_AMT POSTED_ACTUAL_AMT, A.POSTED_ENCUMB_AMT POSTED_ENCUMB_AMT, A.POSTED_ACTUAL_AMT + A.POSTED_ENCUMB_AMT ACTUAL_ENCUMB_AMT FROM PS_BUDGET_ACTUALS A, PS_JOBCODE_TBL B, SYSADM.PS_PERSONAL_DTA_VW C, PS_ACCT_CD_TBL E, PS_PAY_CALENDAR P WHERE A.SETID = B.SETID AND A.JOBCODE = B.JOBCODE AND A.SETID_JOBCODE = 'NCBOC' AND A.ACCT_CD = E.ACCT_CD AND A.FISCAL_YEAR = '2005' AND A.EMPLID = C.EMPLID AND B.SETID = 'NCBOC' AND B.EFFDT = (SELECT MAX(B_ED.EFFDT) FROM PS_JOBCODE_TBL B_ED WHERE B.SETID = B_ED.SETID AND B.JOBCODE = B_ED.JOBCODE AND B_ED.EFFDT <= SYSDATE) AND E.EFFDT =(SELECT MAX(E_ED.EFFDT) FROM PS_ACCT_CD_TBL E_ED WHERE E.ACCT_CD = E_ED.ACCT_CD AND E_ED.EFFDT <= SYSDATE) AND P.COMPANY = 'NCB' AND P.PAYGROUP = 'ACT' 33
  • 34. AND P.CA_GL_INTFC_RUN = 'Y' AND P.PAY_END_DT =(SELECT MAX(PP.PAY_END_DT) FROM PS_PAY_CALENDAR PP WHERE PP.CA_GL_INTFC_RUN = 'Y' AND PP.PAYGROUP = 'ACT' AND PP.COMPANY = 'NCB') ORDER BY substr(A.ACCT_CD, 1, 1), substr(A.ACCT_CD, 3, 3), substr(A.ACCT_CD, 7, 4), substr(A.ACCT_CD, 12, 4), C.NAME; Explain Plan of the query (RULE base) is same on both production and testing system. Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=HINT: RULE 1 0 SORT (UNIQUE) 2 1 FILTER 3 2 TABLE ACCESS (BY INDEX ROWID) OF 'PS_ACCT_CD_TBL' 4 3 NESTED LOOPS 5 4 NESTED LOOPS 6 5 NESTED LOOPS 7 6 NESTED LOOPS 8 7 TABLE ACCESS (BY INDEX ROWID) OF 'PS_PAY_CALENDAR' 9 8 INDEX (UNIQUE SCAN) OF 'PS_PAY_CALENDAR' (UNIQUE) 10 9 SORT (AGGREGATE) 11 10 TABLE ACCESS (BY INDEX ROWID) OF 'PS_PAY_CALENDAR' 12 11 INDEX (RANGE SCAN) OF 'PS_PAY_CALENDAR' (UNIQUE) 13 7 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOBCODE_TBL' 14 13 INDEX (RANGE SCAN) OF 'PS_JOBCODE_TBL' (UNIQUE) 15 6 TABLE ACCESS (BY INDEX ROWID) OF 'PS_BUDGET_ACTUALS' 16 15 INDEX (RANGE SCAN) OF 'PS_BUDGET_ACTUALS_JOBCODE' (NON-UNIQUE) 17 5 TABLE ACCESS (BY INDEX ROWID) OF 'PS_NAMES' 18 17 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) 19 4 INDEX (RANGE SCAN) OF 'PS_ACCT_CD_TBL' (UNIQUE) 20 2 SORT (AGGREGATE) 21 20 INDEX (RANGE SCAN) OF 'PS_JOBCODE_TBL' (UNIQUE) 22 2 SORT (AGGREGATE) 23 22 INDEX (RANGE SCAN) OF 'PS_ACCT_CD_TBL' (UNIQUE) 24 2 SORT (AGGREGATE) 25 24 FILTER 26 25 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) 27 25 SORT (AGGREGATE) 28 27 INDEX (RANGE SCAN) OF 'PS_NAMES' (UNIQUE) Result: Optimized Mode Production System (sec.) Testing System (sec.) Choose / 52.73 RULE 17.29 1:33.57 Production System: Optimizer=CHOOSE: did not return any result after 5 hours: Optimizer=RULE 34
  • 35. 39647 rows selected. Elapsed: 00:00:17.29 Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 302171 consistent gets 0 physical reads 0 redo size 2273178 bytes sent via SQL*Net to client 29825 bytes received via SQL*Net from client 2645 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 39647 rows processed Testing System: Optimizer=CHOOSE: 52.73 second (log is on above) Optimizer=RULE: 39647 rows selected. Elapsed: 00:01:33.58 Statistics ---------------------------------------------------------- 14 recursive calls 0 db block gets 299727 consistent gets 818 physical reads 0 redo size 2273623 bytes sent via SQL*Net to client 29825 bytes received via SQL*Net from client 2645 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 39647 rows processed Access Tree of Production System (Query does not work.) 35
  • 36. Access Tree of Production System (RULE BASE, Query works.) 36
  • 37. Summary: 2500 2000 throughout (rows/sec) 1500 Production System Testing System 1000 500 0 Choose RULE Optimized Mode On the APPENDIX D of professor tuning book, it talks about the Access Plan of IBM DB2 database system. I think that the access plan of all RDBMS system has similar concept. From this case, I learned: 1. Don’t trust Oracle CHOOSE optimized mode. 2. I don’t know how many percent is – size of data the query needs access - when Oracle calculates the expense of explain. It maybe very a very important part. 3. If optimized mode “CHOOSE” works, do not force query running by RULE base. (To compare the response time of RULE base between production system and testing system – testing system has less data, the response time is 5 times than production system. On the testing, response time of RULE base is 1.5 time of CHOOSE mode. 4. [Dennis: I didn’t quite understand this case study though I found it interesting that using Rule was helpful. My guess is that Rule is helpful when the query gets complex enough. It would be interesting to put exactly the same data on the test system and try it again.] 37
  • 38. Case 5: Troubleshooting (Ref. Chapter 7) Chapter 7 teaches us the skills how to troubleshooting. My experience is, if you know your system well, it is very easy to catch the problem. Like our system – PeopleSoft ERP system. PeopleSoft said, their application has been well tuned. It is correct. We seldom received problem on application side. I may catch dead lock error once or twice a year – we cannot re-product the error. We have 4 – ways CPUs. If we have 2 or 3 processes using 25% CPU each (such as the queries above), our system would be slow, and all users’ processes hang. Unix utility “topas” can help us to find out which process cause the problem. I use the following steps to catch the bad query in our system: Step 1, Use UNIX utility: User: root Command: topas –i 5 ****** On this screen print, we can find out: CPU useage Disk I/O Memory usage Paging status We also can catch top processes. 38
  • 39. Step 2, If I found a top process of user “oracle” from above screen, I would write down of PID of that process. Then, I use “Oracle Enterprise Manager console” to catch database session. The top PID is showed under “OS Process ID” column. Step 3, Just double click the problem session, we can see the detail session information: General information SQL text/explain plan Statistics Locks If it is a problem query, I can catch the SQL text here, and tuning it. 39
  • 40. Step 4, From “General” tab, we can get more information about the session user. I also can kill user’s session here. Tuning SQL TEXT, and ask user run it again. 40
  • 41. Other Tuning Experience 1. Band variables Application uses band variable when they parse SQL statement to database server. Oracle doesn’t treat band variable and regular variable (which parse from SQLPLUS command line) same. [Dennis: bound not band, I think] Such as, in the WHERE clause, Where year = :year Is not as same as Such as, in the WHERE clause, Where year = :year Is not as same as Where year = ‘2005’ I remember I tuned one query when I worked for North Shore Hospital. Our developer forwarded me a query which only needed couple of seconds to return the result from SQLPLUS command line. But if filled in Year parameter from application, and parse the same query to oracle, it needed 3 and half hours to return 3 rows. In This case, we need check query explain plan. Other problem about band variable is – the length of variable. The length of variable is one factor of Oracle optimizer calculating cost. If the same parameter is parse to Oracle the second time, Oracle would not re-calculate the cost. Oracle would use the same explain plan as the first time. It also causes performance problem. 2. RAID We all know that RAID 5 is good for write, and RAID 10 is good for read. [Dennis: I think just the opposite. I’d use Raid 10 for writes and Raid 5 for reads. Is this a typo?] Actually I did not feel any different during the normal work. In general, we use two RAID controllers on one production server. One is for disks which storages Operation System. Another RAID controller is used for disks of data. If a server needs write log on RAID 5 disks, storages data on RAID 10 disks, it may need 3 RAID controllers. (System Administrator will never like this idea.) Our production UNIX server was built on RAID 1. This server was purchased before I work for this company. My co-workers told me that the hardware configuration was recommended by IBM engineer. We got enough headaches on DISK I/O problems and files’ storage. For an example, after I switched some data files between 2 mount points, the running time of one big batch report reduced from 1.5 hour to 15 minutes. 41
  • 42. When we procedure our DR server last year, I asked our System Administrator configure disks array of data to RAID 10. We get rid of those disk I/O and files storage problem at all. 3. Data Warehouse System: Disable foreign key during data loading; Drop all indexes and rebuild them after data loading. In most of case, foreign key is used to force data integration. When we loading data external data into database, we wish I can load data into database first, kick off the bad data later. If foreign keys exist during data loading, it takes huge time to check data integration plus other relative processes. I also recommend dropping all indexes before loading data. I used to create two scripts - Run the one which drops all indexes before data loading, and runs other one which re-create all indexes after data loading. [Dennis: And what happened?] 42
  • 43. Appendix: DDL statement of tables and views in case study Oracle Database: CREATE TABLE SYSADM.PS_JOB ( EMPLID VARCHAR2(11) NOT NULL, EMPL_RCD NUMBER NOT NULL, EFFDT DATE NOT NULL, EFFSEQ NUMBER NOT NULL, DEPTID VARCHAR2(10) NOT NULL, JOBCODE VARCHAR2(6) NOT NULL, POSITION_NBR VARCHAR2(8) NOT NULL, GVT_EFFDT DATE, GVT_EFFDT_PROPOSED DATE, GVT_TRANS_NBR NUMBER NOT NULL, GVT_TRANS_NBR_SEQ NUMBER NOT NULL, GVT_WIP_STATUS VARCHAR2(3) NOT NULL, GVT_STATUS_TYPE VARCHAR2(3) NOT NULL, GVT_NOA_CODE VARCHAR2(3) NOT NULL, GVT_LEG_AUTH_1 VARCHAR2(3) NOT NULL, GVT_PAR_AUTH_D1 VARCHAR2(25) NOT NULL, GVT_PAR_AUTH_D1_2 VARCHAR2(25) NOT NULL, GVT_LEG_AUTH_2 VARCHAR2(3) NOT NULL, GVT_PAR_AUTH_D2 VARCHAR2(25) NOT NULL, GVT_PAR_AUTH_D2_2 VARCHAR2(25) NOT NULL, GVT_PAR_NTE_DATE DATE, GVT_WORK_SCHED VARCHAR2(1) NOT NULL, GVT_SUB_AGENCY VARCHAR2(2) NOT NULL, GVT_ELIG_FEHB VARCHAR2(3) NOT NULL, GVT_FEHB_DT DATE, GVT_PAY_RATE_DETER VARCHAR2(1) NOT NULL, GVT_STEP VARCHAR2(2) NOT NULL, GVT_RTND_PAY_PLAN VARCHAR2(2) NOT NULL, GVT_RTND_SAL_PLAN VARCHAR2(4) NOT NULL, GVT_RTND_GRADE VARCHAR2(3) NOT NULL, GVT_RTND_STEP NUMBER NOT NULL, GVT_RTND_GVT_STEP VARCHAR2(2) NOT NULL, GVT_PAY_BASIS VARCHAR2(2) NOT NULL, GVT_COMPRATE NUMBER(18,6) NOT NULL, GVT_LOCALITY_ADJ NUMBER(7,2) NOT NULL, GVT_BIWEEKLY_RT NUMBER(9,2) NOT NULL, GVT_DAILY_RT NUMBER(9,2) NOT NULL, GVT_HRLY_RT_NO_LOC NUMBER(18,6) NOT NULL, GVT_DLY_RT_NO_LOC NUMBER(9,2) NOT NULL, GVT_BW_RT_NO_LOC NUMBER(9,2) NOT NULL, GVT_MNLY_RT_NO_LOC NUMBER(18,3) NOT NULL, GVT_ANNL_RT_NO_LOC NUMBER(18,3) NOT NULL, GVT_XFER_FROM_AGCY VARCHAR2(2) NOT NULL, GVT_XFER_TO_AGCY VARCHAR2(2) NOT NULL, GVT_RETIRE_PLAN VARCHAR2(1) NOT NULL, GVT_ANN_IND VARCHAR2(1) NOT NULL, GVT_FEGLI VARCHAR2(2) NOT NULL, GVT_FEGLI_LIVING VARCHAR2(1) NOT NULL, GVT_LIVING_AMT NUMBER NOT NULL, GVT_ANNUITY_OFFSET NUMBER NOT NULL, GVT_CSRS_FROZN_SVC VARCHAR2(4) NOT NULL, GVT_PREV_RET_COVRG VARCHAR2(1) NOT NULL, GVT_FERS_COVERAGE VARCHAR2(1) NOT NULL, GVT_TYPE_OF_APPT VARCHAR2(2) NOT NULL, GVT_POI VARCHAR2(4) NOT NULL, GVT_POSN_OCCUPIED VARCHAR2(1) NOT NULL, GVT_CONT_EMPLID VARCHAR2(11) NOT NULL, GVT_ROUTE_NEXT VARCHAR2(11) NOT NULL, GVT_CHANGE_FLAG VARCHAR2(1) NOT NULL, GVT_TSP_UPD_IND VARCHAR2(1) NOT NULL, GVT_PI_UPD_IND VARCHAR2(1) NOT NULL, GVT_SF52_NBR VARCHAR2(10) NOT NULL, GVT_S113G_CEILING VARCHAR2(1) NOT NULL, 43
  • 44. GVT_LEO_POSITION VARCHAR2(1) NOT NULL, GVT_ANNUIT_COM_DT DATE, GVT_BASIC_LIFE_RED VARCHAR2(2) NOT NULL, GVT_DED_PRORT_DT DATE, GVT_FEGLI_BASC_PCT NUMBER(7,6) NOT NULL, GVT_FEGLI_OPT_PCT NUMBER(7,6) NOT NULL, GVT_FEHB_PCT NUMBER(7,6) NOT NULL, GVT_RETRO_FLAG VARCHAR2(1) NOT NULL, GVT_RETRO_DED_FLAG VARCHAR2(1) NOT NULL, GVT_RETRO_JOB_FLAG VARCHAR2(1) NOT NULL, GVT_RETRO_BSE_FLAG VARCHAR2(1) NOT NULL, GVT_OTH_PAY_CHG VARCHAR2(1) NOT NULL, GVT_DETL_POSN_NBR VARCHAR2(8) NOT NULL, ANNL_BEN_BASE_OVRD VARCHAR2(1) NOT NULL, BENEFIT_PROGRAM VARCHAR2(3) NOT NULL, UPDATE_PAYROLL VARCHAR2(1) NOT NULL, GVT_PAY_PLAN VARCHAR2(2) NOT NULL, GVT_PAY_FLAG VARCHAR2(1) NOT NULL, GVT_NID_CHANGE VARCHAR2(1) NOT NULL, SUPERVISOR_ID VARCHAR2(11) NOT NULL, APPT_TYPE VARCHAR2(1) NOT NULL, MAIN_APPT_NUM_JPN NUMBER NOT NULL, POSITION_OVERRIDE VARCHAR2(1) NOT NULL, POSN_CHANGE_RECORD VARCHAR2(1) NOT NULL, EMPL_STATUS VARCHAR2(1) NOT NULL, ACTION VARCHAR2(3) NOT NULL, ACTION_DT DATE, ACTION_REASON VARCHAR2(3) NOT NULL, LOCATION VARCHAR2(10) NOT NULL, TAX_LOCATION_CD VARCHAR2(10) NOT NULL, JOB_ENTRY_DT DATE, DEPT_ENTRY_DT DATE, POSITION_ENTRY_DT DATE, SHIFT VARCHAR2(1) NOT NULL, REG_TEMP VARCHAR2(1) NOT NULL, FULL_PART_TIME VARCHAR2(1) NOT NULL, COMPANY VARCHAR2(3) NOT NULL, PAYGROUP VARCHAR2(3) NOT NULL, BAS_GROUP_ID VARCHAR2(3) NOT NULL, ELIG_CONFIG1 VARCHAR2(10) NOT NULL, ELIG_CONFIG2 VARCHAR2(10) NOT NULL, ELIG_CONFIG3 VARCHAR2(10) NOT NULL, ELIG_CONFIG4 VARCHAR2(10) NOT NULL, ELIG_CONFIG5 VARCHAR2(10) NOT NULL, ELIG_CONFIG6 VARCHAR2(10) NOT NULL, ELIG_CONFIG7 VARCHAR2(10) NOT NULL, ELIG_CONFIG8 VARCHAR2(10) NOT NULL, ELIG_CONFIG9 VARCHAR2(10) NOT NULL, BEN_STATUS VARCHAR2(4) NOT NULL, BAS_ACTION VARCHAR2(3) NOT NULL, COBRA_ACTION VARCHAR2(3) NOT NULL, EMPL_TYPE VARCHAR2(1) NOT NULL, HOLIDAY_SCHEDULE VARCHAR2(6) NOT NULL, STD_HOURS NUMBER(6,2) NOT NULL, STD_HRS_FREQUENCY VARCHAR2(5) NOT NULL, OFFICER_CD VARCHAR2(1) NOT NULL, EMPL_CLASS VARCHAR2(3) NOT NULL, SAL_ADMIN_PLAN VARCHAR2(4) NOT NULL, GRADE VARCHAR2(3) NOT NULL, GRADE_ENTRY_DT DATE, STEP NUMBER NOT NULL, STEP_ENTRY_DT DATE, GL_PAY_TYPE VARCHAR2(6) NOT NULL, ACCT_CD VARCHAR2(25) NOT NULL, EARNS_DIST_TYPE VARCHAR2(1) NOT NULL, COMP_FREQUENCY VARCHAR2(5) NOT NULL, COMPRATE NUMBER(18,6) NOT NULL, CHANGE_AMT NUMBER(18,6) NOT NULL, CHANGE_PCT NUMBER(6,3) NOT NULL, ANNUAL_RT NUMBER(18,3) NOT NULL, MONTHLY_RT NUMBER(18,3) NOT NULL, 44
  • 45. DAILY_RT NUMBER(18,3) NOT NULL, HOURLY_RT NUMBER(18,6) NOT NULL, ANNL_BENEF_BASE_RT NUMBER(18,3) NOT NULL, SHIFT_RT NUMBER(18,6) NOT NULL, SHIFT_FACTOR NUMBER(4,3) NOT NULL, CURRENCY_CD VARCHAR2(3) NOT NULL, BUSINESS_UNIT VARCHAR2(5) NOT NULL, SETID_DEPT VARCHAR2(5) NOT NULL, SETID_JOBCODE VARCHAR2(5) NOT NULL, SETID_LOCATION VARCHAR2(5) NOT NULL, SETID_SALARY VARCHAR2(5) NOT NULL, REG_REGION VARCHAR2(5) NOT NULL, DIRECTLY_TIPPED VARCHAR2(1) NOT NULL, FLSA_STATUS VARCHAR2(1) NOT NULL, EEO_CLASS VARCHAR2(1) NOT NULL, FUNCTION_CD VARCHAR2(2) NOT NULL, TARIFF_GER VARCHAR2(2) NOT NULL, TARIFF_AREA_GER VARCHAR2(3) NOT NULL, PERFORM_GROUP_GER VARCHAR2(2) NOT NULL, LABOR_TYPE_GER VARCHAR2(1) NOT NULL, SPK_COMM_ID_GER VARCHAR2(9) NOT NULL, HOURLY_RT_FRA VARCHAR2(3) NOT NULL, ACCDNT_CD_FRA VARCHAR2(1) NOT NULL, VALUE_1_FRA VARCHAR2(5) NOT NULL, VALUE_2_FRA VARCHAR2(5) NOT NULL, VALUE_3_FRA VARCHAR2(5) NOT NULL, VALUE_4_FRA VARCHAR2(5) NOT NULL, VALUE_5_FRA VARCHAR2(5) NOT NULL, CTG_RATE NUMBER NOT NULL, PAID_HOURS NUMBER(6,2) NOT NULL, PAID_FTE NUMBER(7,6) NOT NULL, PAID_HRS_FREQUENCY VARCHAR2(5) NOT NULL, UNION_FULL_PART VARCHAR2(1) NOT NULL, UNION_POS VARCHAR2(1) NOT NULL, MATRICULA_NBR NUMBER NOT NULL, SOC_SEC_RISK_CODE VARCHAR2(3) NOT NULL, UNION_FEE_AMOUNT NUMBER(8,2) NOT NULL, UNION_FEE_START_DT DATE, UNION_FEE_END_DT DATE, EXEMPT_JOB_LBR VARCHAR2(1) NOT NULL, EXEMPT_HOURS_MONTH NUMBER NOT NULL, WRKS_CNCL_FUNCTION VARCHAR2(1) NOT NULL, INTERCTR_WRKS_CNCL VARCHAR2(1) NOT NULL, CURRENCY_CD1 VARCHAR2(3) NOT NULL, PAY_UNION_FEE VARCHAR2(1) NOT NULL, UNION_CD VARCHAR2(3) NOT NULL, BARG_UNIT VARCHAR2(4) NOT NULL, UNION_SENIORITY_DT DATE, ENTRY_DATE DATE, LABOR_AGREEMENT VARCHAR2(6) NOT NULL, EMPL_CTG VARCHAR2(6) NOT NULL, EMPL_CTG_L1 VARCHAR2(6) NOT NULL, EMPL_CTG_L2 VARCHAR2(6) NOT NULL, SETID_LBR_AGRMNT VARCHAR2(5) NOT NULL, GP_PAYGROUP VARCHAR2(10) NOT NULL, GP_DFLT_ELIG_GRP VARCHAR2(1) NOT NULL, GP_ELIG_GRP VARCHAR2(10) NOT NULL, GP_DFLT_CURRTTYP VARCHAR2(1) NOT NULL, CUR_RT_TYPE VARCHAR2(5) NOT NULL, GP_DFLT_EXRTDT VARCHAR2(1) NOT NULL, GP_ASOF_DT_EXG_RT VARCHAR2(1) NOT NULL, ADDS_TO_FTE_ACTUAL VARCHAR2(1) NOT NULL, CLASS_INDC VARCHAR2(1) NOT NULL, ENCUMB_OVERRIDE VARCHAR2(1) NOT NULL, FICA_STATUS_EE VARCHAR2(1) NOT NULL, FTE NUMBER(7,6) NOT NULL, PRORATE_CNT_AMT VARCHAR2(1) NOT NULL, PAY_SYSTEM_FLG VARCHAR2(2) NOT NULL, BORDER_WALKER VARCHAR2(1) NOT NULL, LUMP_SUM_PAY VARCHAR2(1) NOT NULL, CONTRACT_NUM VARCHAR2(25) NOT NULL, 45
  • 46. JOB_INDICATOR VARCHAR2(1) NOT NULL, WRKS_CNCL_ROLE_CHE VARCHAR2(30) NOT NULL, BENEFIT_SYSTEM VARCHAR2(2) NOT NULL, WORK_DAY_HOURS NUMBER(6,2) NOT NULL, REPORTS_TO VARCHAR2(8) NOT NULL, FORCE_PUBLISH DATE, JOB_DATA_SRC_CD VARCHAR2(3) NOT NULL, ESTABID VARCHAR2(12) NOT NULL, PRIMARY_JOB VARCHAR2(1) NOT NULL, BOCES_TERM_JOBS VARCHAR2(1) NOT NULL, BOCES_TRM_JOB_PROC VARCHAR2(1) NOT NULL, BOCES_CIVIL_SRV VARCHAR2(6) NOT NULL ) LOGGING PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 TABLESPACE PSLARGE STORAGE ( INITIAL 12124160 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 ); CREATE UNIQUE INDEX SYSADM.PS_JOB ON SYSADM.PS_JOB (EMPLID, EMPL_RCD, EFFDT, EFFSEQ) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 1720320 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PS0JOB ON SYSADM.PS_JOB (DEPTID, EMPLID, EMPL_RCD, EFFDT, EFFSEQ) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 3989504 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PS1JOB ON SYSADM.PS_JOB (JOBCODE, EMPLID, EMPL_RCD, EFFDT, EFFSEQ) LOGGING 46
  • 47. PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 3989504 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PS2JOB ON SYSADM.PS_JOB (POSITION_NBR, EMPLID, EMPL_RCD, EFFDT, EFFSEQ) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 1859584 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PS3JOB ON SYSADM.PS_JOB (SUPERVISOR_ID, EMPLID, EMPL_RCD, EFFDT, EFFSEQ) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 40960 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PSAJOB ON SYSADM.PS_JOB (EMPLID, EMPL_RCD, EFFDT, EFFSEQ, DEPTID) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 1720320 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 47
  • 48. BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PSBJOB ON SYSADM.PS_JOB (EMPLID, EMPL_RCD, EFFDT, EFFSEQ, EMPL_STATUS, MAIN_APPT_NUM_JPN, APPT_TYPE) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 40960 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PSCJOB ON SYSADM.PS_JOB (REPORTS_TO) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 40960 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214898 CHECK("EMPLID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214899 CHECK("EMPL_RCD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214900 CHECK("EFFDT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214901 CHECK("EFFSEQ" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214902 CHECK("DEPTID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214903 CHECK("JOBCODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214904 CHECK("POSITION_NBR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214905 CHECK("GVT_TRANS_NBR" IS NOT NULL); 48
  • 49. ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214906 CHECK("GVT_TRANS_NBR_SEQ" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214907 CHECK("GVT_WIP_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214908 CHECK("GVT_STATUS_TYPE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214909 CHECK("GVT_NOA_CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214910 CHECK("GVT_LEG_AUTH_1" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214911 CHECK("GVT_PAR_AUTH_D1" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214912 CHECK("GVT_PAR_AUTH_D1_2" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214913 CHECK("GVT_LEG_AUTH_2" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214914 CHECK("GVT_PAR_AUTH_D2" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214915 CHECK("GVT_PAR_AUTH_D2_2" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214916 CHECK("GVT_WORK_SCHED" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214917 CHECK("GVT_SUB_AGENCY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214918 CHECK("GVT_ELIG_FEHB" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214919 CHECK("GVT_PAY_RATE_DETER" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214920 CHECK("GVT_STEP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214921 CHECK("GVT_RTND_PAY_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214922 CHECK("GVT_RTND_SAL_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214923 49
  • 50. CHECK("GVT_RTND_GRADE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214924 CHECK("GVT_RTND_STEP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214925 CHECK("GVT_RTND_GVT_STEP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214926 CHECK("GVT_PAY_BASIS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214927 CHECK("GVT_COMPRATE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214928 CHECK("GVT_LOCALITY_ADJ" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214929 CHECK("GVT_BIWEEKLY_RT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214930 CHECK("GVT_DAILY_RT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214931 CHECK("GVT_HRLY_RT_NO_LOC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214932 CHECK("GVT_DLY_RT_NO_LOC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214933 CHECK("GVT_BW_RT_NO_LOC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214934 CHECK("GVT_MNLY_RT_NO_LOC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214935 CHECK("GVT_ANNL_RT_NO_LOC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214936 CHECK("GVT_XFER_FROM_AGCY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214937 CHECK("GVT_XFER_TO_AGCY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214938 CHECK("GVT_RETIRE_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214939 CHECK("GVT_ANN_IND" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214940 CHECK("GVT_FEGLI" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB 50
  • 51. ADD CONSTRAINT SYS_C00214941 CHECK("GVT_FEGLI_LIVING" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214942 CHECK("GVT_LIVING_AMT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214943 CHECK("GVT_ANNUITY_OFFSET" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214944 CHECK("GVT_CSRS_FROZN_SVC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214945 CHECK("GVT_PREV_RET_COVRG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214946 CHECK("GVT_FERS_COVERAGE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214947 CHECK("GVT_TYPE_OF_APPT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214948 CHECK("GVT_POI" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214949 CHECK("GVT_POSN_OCCUPIED" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214950 CHECK("GVT_CONT_EMPLID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214951 CHECK("GVT_ROUTE_NEXT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214952 CHECK("GVT_CHANGE_FLAG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214953 CHECK("GVT_TSP_UPD_IND" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214954 CHECK("GVT_PI_UPD_IND" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214955 CHECK("GVT_SF52_NBR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214956 CHECK("GVT_S113G_CEILING" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214957 CHECK("GVT_LEO_POSITION" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214958 CHECK("GVT_BASIC_LIFE_RED" IS NOT NULL); 51
  • 52. ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214959 CHECK("GVT_FEGLI_BASC_PCT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214960 CHECK("GVT_FEGLI_OPT_PCT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214961 CHECK("GVT_FEHB_PCT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214962 CHECK("GVT_RETRO_FLAG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214963 CHECK("GVT_RETRO_DED_FLAG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214964 CHECK("GVT_RETRO_JOB_FLAG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214965 CHECK("GVT_RETRO_BSE_FLAG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214966 CHECK("GVT_OTH_PAY_CHG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214967 CHECK("GVT_DETL_POSN_NBR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214968 CHECK("ANNL_BEN_BASE_OVRD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214969 CHECK("BENEFIT_PROGRAM" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214970 CHECK("UPDATE_PAYROLL" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214971 CHECK("GVT_PAY_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214972 CHECK("GVT_PAY_FLAG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214973 CHECK("GVT_NID_CHANGE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214974 CHECK("SUPERVISOR_ID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214975 CHECK("APPT_TYPE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214976 CHECK("MAIN_APPT_NUM_JPN" IS NOT NULL); 52
  • 53. ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214977 CHECK("POSITION_OVERRIDE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214978 CHECK("POSN_CHANGE_RECORD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214979 CHECK("EMPL_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214980 CHECK("ACTION" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214981 CHECK("ACTION_REASON" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214982 CHECK("LOCATION" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214983 CHECK("TAX_LOCATION_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214984 CHECK("SHIFT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214985 CHECK("REG_TEMP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214986 CHECK("FULL_PART_TIME" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214987 CHECK("COMPANY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214988 CHECK("PAYGROUP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214989 CHECK("BAS_GROUP_ID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214990 CHECK("ELIG_CONFIG1" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214991 CHECK("ELIG_CONFIG2" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214992 CHECK("ELIG_CONFIG3" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214993 CHECK("ELIG_CONFIG4" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214994 53
  • 54. CHECK("ELIG_CONFIG5" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214995 CHECK("ELIG_CONFIG6" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214996 CHECK("ELIG_CONFIG7" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214997 CHECK("ELIG_CONFIG8" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214998 CHECK("ELIG_CONFIG9" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00214999 CHECK("BEN_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215000 CHECK("BAS_ACTION" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215001 CHECK("COBRA_ACTION" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215002 CHECK("EMPL_TYPE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215003 CHECK("HOLIDAY_SCHEDULE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215004 CHECK("STD_HOURS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215005 CHECK("STD_HRS_FREQUENCY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215006 CHECK("OFFICER_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215007 CHECK("EMPL_CLASS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215008 CHECK("SAL_ADMIN_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215009 CHECK("GRADE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215010 CHECK("STEP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215011 CHECK("GL_PAY_TYPE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB 54
  • 55. ADD CONSTRAINT SYS_C00215012 CHECK("ACCT_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215013 CHECK("EARNS_DIST_TYPE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215014 CHECK("COMP_FREQUENCY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215015 CHECK("COMPRATE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215016 CHECK("CHANGE_AMT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215017 CHECK("CHANGE_PCT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215018 CHECK("ANNUAL_RT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215019 CHECK("MONTHLY_RT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215020 CHECK("DAILY_RT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215021 CHECK("HOURLY_RT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215022 CHECK("ANNL_BENEF_BASE_RT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215023 CHECK("SHIFT_RT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215024 CHECK("SHIFT_FACTOR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215025 CHECK("CURRENCY_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215026 CHECK("BUSINESS_UNIT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215027 CHECK("SETID_DEPT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215028 CHECK("SETID_JOBCODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215029 CHECK("SETID_LOCATION" IS NOT NULL); 55
  • 56. ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215030 CHECK("SETID_SALARY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215031 CHECK("REG_REGION" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215032 CHECK("DIRECTLY_TIPPED" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215033 CHECK("FLSA_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215034 CHECK("EEO_CLASS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215035 CHECK("FUNCTION_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215036 CHECK("TARIFF_GER" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215037 CHECK("TARIFF_AREA_GER" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215038 CHECK("PERFORM_GROUP_GER" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215039 CHECK("LABOR_TYPE_GER" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215040 CHECK("SPK_COMM_ID_GER" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215041 CHECK("HOURLY_RT_FRA" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215042 CHECK("ACCDNT_CD_FRA" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215043 CHECK("VALUE_1_FRA" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215044 CHECK("VALUE_2_FRA" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215045 CHECK("VALUE_3_FRA" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215046 CHECK("VALUE_4_FRA" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215047 CHECK("VALUE_5_FRA" IS NOT NULL); 56
  • 57. ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215048 CHECK("CTG_RATE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215049 CHECK("PAID_HOURS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215050 CHECK("PAID_FTE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215051 CHECK("PAID_HRS_FREQUENCY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215052 CHECK("UNION_FULL_PART" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215053 CHECK("UNION_POS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215054 CHECK("MATRICULA_NBR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215055 CHECK("SOC_SEC_RISK_CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215056 CHECK("UNION_FEE_AMOUNT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215057 CHECK("EXEMPT_JOB_LBR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215058 CHECK("EXEMPT_HOURS_MONTH" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215059 CHECK("WRKS_CNCL_FUNCTION" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215060 CHECK("INTERCTR_WRKS_CNCL" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215061 CHECK("CURRENCY_CD1" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215062 CHECK("PAY_UNION_FEE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215063 CHECK("UNION_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215064 CHECK("BARG_UNIT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215065 57
  • 58. CHECK("LABOR_AGREEMENT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215066 CHECK("EMPL_CTG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215067 CHECK("EMPL_CTG_L1" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215068 CHECK("EMPL_CTG_L2" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215069 CHECK("SETID_LBR_AGRMNT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215070 CHECK("GP_PAYGROUP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215071 CHECK("GP_DFLT_ELIG_GRP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215072 CHECK("GP_ELIG_GRP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215073 CHECK("GP_DFLT_CURRTTYP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215074 CHECK("CUR_RT_TYPE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215075 CHECK("GP_DFLT_EXRTDT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215076 CHECK("GP_ASOF_DT_EXG_RT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215077 CHECK("ADDS_TO_FTE_ACTUAL" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215078 CHECK("CLASS_INDC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215079 CHECK("ENCUMB_OVERRIDE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215080 CHECK("FICA_STATUS_EE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215081 CHECK("FTE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215082 CHECK("PRORATE_CNT_AMT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB 58
  • 59. ADD CONSTRAINT SYS_C00215083 CHECK("PAY_SYSTEM_FLG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215084 CHECK("BORDER_WALKER" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215085 CHECK("LUMP_SUM_PAY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215086 CHECK("CONTRACT_NUM" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215087 CHECK("JOB_INDICATOR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215088 CHECK("WRKS_CNCL_ROLE_CHE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215089 CHECK("BENEFIT_SYSTEM" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215090 CHECK("WORK_DAY_HOURS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215091 CHECK("REPORTS_TO" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215092 CHECK("JOB_DATA_SRC_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215093 CHECK("ESTABID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215094 CHECK("PRIMARY_JOB" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215095 CHECK("BOCES_TERM_JOBS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215096 CHECK("BOCES_TRM_JOB_PROC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOB ADD CONSTRAINT SYS_C00215097 CHECK("BOCES_CIVIL_SRV" IS NOT NULL); CREATE OR REPLACE VIEW SYSADM.PS_B_FAST_EMP_QRY ( EMPLID, EMPL_RCD, ROWSECCLASS, ACCESS_CD, NAME, LAST_NAME_SRCH, NAME_AC, PER_STATUS ) AS SELECT A.EMPLID ,JOB.EMPL_RCD ,SEC.ROWSECCLASS ,SEC.ACCESS_CD ,B.NAME ,B.LAST_NAME_SRCH ,B.NAME_AC ,A.PER_STATUS FROM PS_PERSON A ,PS_PERSON_NAME B ,PS_JOB JOB 59
  • 60. ,PS_FAST_SCRTY_2 SEC WHERE A.EMPLID = B.EMPLID AND B.EMPLID = JOB.EMPLID AND JOB.EFFDT= ( SELECT MAX(JOB2.EFFDT) FROM PS_JOB JOB2 WHERE JOB.EMPLID=JOB2.EMPLID AND JOB.EMPL_RCD=JOB2.EMPL_RCD AND JOB2.EFFDT<=TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD')) AND JOB.EFFSEQ= ( SELECT MAX(JOB3.EFFSEQ) FROM PS_JOB JOB3 WHERE JOB.EMPLID=JOB3.EMPLID AND JOB.EMPL_RCD=JOB3.EMPL_RCD AND JOB.EFFDT=JOB3.EFFDT ) AND JOB.DEPTID=SEC.DEPTID AND JOB.SETID_DEPT=SEC.SETID; CREATE OR REPLACE VIEW SYSADM.PS_B_FAST_PERS_QRY ( EMPLID, ROWSECCLASS, ACCESS_CD ) AS SELECT DISTINCT A.EMPLID ,SEC.ROWSECCLASS ,SEC.ACCESS_CD FROM PS_PERSONAL_DT_FST A ,PS_JOB JOB ,PS_FAST_SCRTY_2 SEC WHERE A.EMPLID = JOB.EMPLID AND JOB.EFFDT= ( SELECT MAX(JOB2.EFFDT) FROM PS_JOB JOB2 WHERE JOB.EMPLID=JOB2.EMPLID AND JOB.EMPL_RCD=JOB2.EMPL_RCD AND JOB2.EFFDT<=TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM- DD')) AND JOB.EFFSEQ= ( SELECT MAX(JOB3.EFFSEQ) FROM PS_JOB JOB3 WHERE JOB.EMPLID=JOB3.EMPLID AND JOB.EMPL_RCD=JOB3.EMPL_RCD AND JOB.EFFDT=JOB3.EFFDT ) AND JOB.DEPTID=SEC.DEPTID AND JOB.SETID_DEPT=SEC.SETID; CREATE OR REPLACE VIEW SYSADM.PS_PERSONAL_DTA_VW ( EMPLID, NAME ) AS SELECT EMPLID , NAME FROM PS_PERSON_NAME; CREATE TABLE SYSADM.PS_PERSON ( EMPLID VARCHAR2(11) NOT NULL, PER_STATUS VARCHAR2(1) NOT NULL, BIRTHDATE DATE, BIRTHPLACE VARCHAR2(30) NOT NULL, BIRTHCOUNTRY VARCHAR2(3) NOT NULL, BIRTHSTATE VARCHAR2(6) NOT NULL, DT_OF_DEATH DATE, ORIG_HIRE_DT DATE, HIGHLY_COMP_EMPL_C VARCHAR2(1) NOT NULL, HIGHLY_COMP_EMPL_P VARCHAR2(1) NOT NULL ) LOGGING PCTFREE 10 PCTUSED 80 INITRANS 1 MAXTRANS 255 TABLESPACE HRLARGE STORAGE ( INITIAL 40960 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 ); CREATE UNIQUE INDEX SYSADM.PS_PERSON ON SYSADM.PS_PERSON (EMPLID) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 40960 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); ALTER TABLE SYSADM.PS_PERSON ADD CONSTRAINT SYS_C00196953 CHECK("EMPLID" IS NOT NULL); 60
  • 61. ALTER TABLE SYSADM.PS_PERSON ADD CONSTRAINT SYS_C00196954 CHECK("PER_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_PERSON ADD CONSTRAINT SYS_C00196955 CHECK("BIRTHPLACE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERSON ADD CONSTRAINT SYS_C00196956 CHECK("BIRTHCOUNTRY" IS NOT NULL); ALTER TABLE SYSADM.PS_PERSON ADD CONSTRAINT SYS_C00196957 CHECK("BIRTHSTATE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERSON ADD CONSTRAINT SYS_C00196958 CHECK("HIGHLY_COMP_EMPL_C" IS NOT NULL); ALTER TABLE SYSADM.PS_PERSON ADD CONSTRAINT SYS_C00196959 CHECK("HIGHLY_COMP_EMPL_P" IS NOT NULL); CREATE OR REPLACE VIEW SYSADM.PS_PERSONAL_DT_FST ( EMPLID, PER_STATUS, PER_TYPE, COUNTRY_NM_FORMAT, NAME, NAME_INITIALS, NAME_PREFIX, NAME_SUFFIX, NAME_ROYAL_PREFIX, NAME_ROYAL_SUFFIX, NAME_TITLE, LAST_NAME_SRCH, FIRST_NAME_SRCH, LAST_NAME, FIRST_NAME, MIDDLE_NAME, SECOND_LAST_NAME, SECOND_LAST_SRCH, NAME_AC, PREF_FIRST_NAME, PARTNER_LAST_NAME, PARTNER_ROY_PREFIX, LAST_NAME_PREF_NLD, ORIG_HIRE_DT, SEX, AGE_STATUS, MAR_STATUS, MAR_STATUS_DT, BIRTHDATE, BIRTHPLACE, BIRTHCOUNTRY, BIRTHSTATE, DT_OF_DEATH, HIGHEST_EDUC_LVL, FT_STUDENT, HIGHLY_COMP_EMPL_P, HIGHLY_COMP_EMPL_C, US_WORK_ELIGIBILTY, MILITARY_STATUS, CITIZEN_PROOF1, CITIZEN_PROOF2, SMOKER, MEDICARE_ENTLD_DT, SMOKER_DT, BILINGUALISM_CODE, 61
  • 62. HEALTH_CARE_NBR, HEALTH_CARE_STATE, GUARDIAN_CHE, MILITARY_STAT_GER, EXPCTD_MILITARY_DT, HR_RESPONSIBLE_ID, ENTRY_DT_FRA, MILIT_SITUATN_FRA, CPAMID, HONSEKI_JPN, MILITARY_STAT_ITA, MILITARY_TYPE_ITA, MILITARY_RANK_ITA, MILITARY_END_ITA, MILIT_SITUATN_ESP, SOC_SEC_AFF_DT, LANG_CD, YEARS_OF_EXP, APPLID, APP_DT, GVT_CRED_MIL_SVCE, GVT_MILITARY_COMP, GVT_MIL_GRADE, GVT_MIL_RESRVE_CAT, GVT_MIL_SEP_RET, GVT_MIL_SVCE_END, GVT_MIL_SVCE_START, GVT_MIL_VERIFY, GVT_PAR_NBR_LAST, GVT_UNIF_SVC_CTR, GVT_VET_PREF_APPT, GVT_VET_PREF_RIF, GVT_CHANGE_FLAG, GVT_DRAFT_STATUS, GVT_YR_ATTAINED, DISABLED_VET, DISABLED, ETHNIC_GROUP, GVT_DISABILITY_CD, GRADE, SAL_ADMIN_PLAN, GVT_CURR_AGCY_EMPL, GVT_CURR_FED_EMPL, GVT_HIGH_PAY_PLAN, GVT_HIGH_GRADE, GVT_PREV_AGCY_EMPL, GVT_PREV_FED_EMPL, GVT_SEP_INCENTIVE, GVT_SEP_INCENT_DT, GVT_TENURE, GVT_PAY_PLAN, BARG_UNIT, ALTER_EMPLID ) AS SELECT PER.EMPLID ,PER.PER_STATUS ,PDE.PER_TYPE ,A.COUNTRY_NM_FORMAT, A.NAME, A.NAME_INITIALS, A.NAME_PREFIX, A.NAME_SUFFIX, A.NAME_ROYAL_PREFIX, A.NAME_ROYAL_SUFFIX, A.NAME_TITLE, A.LAST_NAME_SRCH, A.FIRST_NAME_SRCH, A.LAST_NAME, A.FIRST_NAME, A.MIDDLE_NAME, A.SECOND_LAST_NAME, A.SECOND_LAST_SRCH, A.NAME_AC, A.PREF_FIRST_NAME, A.PARTNER_LAST_NAME, A.PARTNER_ROY_PREFIX, A.LAST_NAME_PREF_NLD ,PER.ORIG_HIRE_DT ,PDE.SEX ,PDE.AGE_STATUS ,PDE.MAR_STATUS ,PDE.MAR_STATUS_DT ,PER.BIRTHDATE ,PER.BIRTHPLACE ,PER.BIRTHCOUNTRY ,PER.BIRTHSTATE ,PER.DT_OF_DEATH ,PDE.HIGHEST_EDUC_LVL ,PDE.FT_STUDENT ,PER.HIGHLY_COMP_EMPL_P ,PER.HIGHLY_COMP_EMPL_C ,PDE.US_WORK_ELIGIBILTY, PDE.MILITARY_STATUS, PDE.CITIZEN_PROOF1, PDE.CITIZEN_PROOF2, PDE.SMOKER, PDE.MEDICARE_ENTLD_DT, PDE.SMOKER_DT ,PDE.BILINGUALISM_CODE, PDE.HEALTH_CARE_NBR, PDE.HEALTH_CARE_STATE ,PDE.GUARDIAN_CHE ,PDE.MILITARY_STAT_GER, PDE.EXPCTD_MILITARY_DT, PDE.HR_RESPONSIBLE_ID 62
  • 63. ,PDE.ENTRY_DT_FRA, PDE.MILIT_SITUATN_FRA, PDE.CPAMID ,PDE.HONSEKI_JPN ,PDE.MILITARY_STAT_ITA, PDE.MILITARY_TYPE_ITA, PDE.MILITARY_RANK_ITA, PDE.MILITARY_END_ITA ,PDE.MILIT_SITUATN_ESP, PDE.SOC_SEC_AFF_DT ,PDE.LANG_CD ,PDE.YEARS_OF_EXP ,PDE.APPLID ,PDE.APP_DT ,PDE.GVT_CRED_MIL_SVCE, PDE.GVT_MILITARY_COMP, PDE.GVT_MIL_GRADE, PDE.GVT_MIL_RESRVE_CAT, PDE.GVT_MIL_SEP_RET, PDE.GVT_MIL_SVCE_END, PDE.GVT_MIL_SVCE_START, PDE.GVT_MIL_VERIFY, PDE.GVT_PAR_NBR_LAST, PDE.GVT_UNIF_SVC_CTR, PDE.GVT_VET_PREF_APPT, PDE.GVT_VET_PREF_RIF, PDE.GVT_CHANGE_FLAG, PDE.GVT_DRAFT_STATUS, PDE.GVT_YR_ATTAINED, PDE.DISABLED_VET, PDE.DISABLED, PDE.ETHNIC_GROUP, PDE.GVT_DISABILITY_CD, PDE.GRADE, PDE.SAL_ADMIN_PLAN, PDE.GVT_CURR_AGCY_EMPL, PDE.GVT_CURR_FED_EMPL, PDE.GVT_HIGH_PAY_PLAN, PDE.GVT_HIGH_GRADE, PDE.GVT_PREV_AGCY_EMPL, PDE.GVT_PREV_FED_EMPL, PDE.GVT_SEP_INCENTIVE, PDE.GVT_SEP_INCENT_DT, PDE.GVT_TENURE, PDE.GVT_PAY_PLAN, PDE.BARG_UNIT ,PDE.ALTER_EMPLID FROM PS_PERSON PER , PS_PERS_DATA_EFFDT PDE , PS_NAMES A WHERE PER.EMPLID = A.EMPLID AND PER.EMPLID = PDE.EMPLID AND PDE.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_PERS_DATA_EFFDT B WHERE B.EMPLID = PDE.EMPLID AND ( B.EFFDT <= TO_DATE(TO_CHAR(SYSDATE,'YYYY- MM-DD'),'YYYY-MM-DD') OR (B.EFFDT > TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM -DD'),'YYYY-MM-DD') AND TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD') < ( SELECT MIN(C.EFFDT) FROM PS_PERS_DATA_EFFDT C WHERE C.EMPLID = B.EMPLID) ) ) ) AND A.NAME_TYPE = 'PRI' AND A.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_NAMES B WHERE B.EMPLID = A.EMPLID AND B.NAME_TYPE = A.NAME_TYPE AND ( B.EFFDT <= TO_DATE(TO_CHAR (SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD') OR (B.EFFDT > TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY- MM-DD') AND TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD') < ( SELECT MIN(C.EFFDT) FROM PS_NAMES C WHERE C.EMPLID = B.EMPLID AND C.NAME_TYPE = B.NAME_TYPE) ) )); CREATE OR REPLACE VIEW SYSADM.PS_PERSON_NAME ( EMPLID, COUNTRY_NM_FORMAT, NAME, NAME_INITIALS, NAME_PREFIX, NAME_SUFFIX, NAME_ROYAL_PREFIX, NAME_ROYAL_SUFFIX, NAME_TITLE, LAST_NAME_SRCH, FIRST_NAME_SRCH, LAST_NAME, FIRST_NAME, MIDDLE_NAME, SECOND_LAST_NAME, SECOND_LAST_SRCH, NAME_AC, PREF_FIRST_NAME, PARTNER_LAST_NAME, PARTNER_ROY_PREFIX, LAST_NAME_PREF_NLD, NAME_TYPE, ASOFDATE ) AS SELECT A.EMPLID ,A.COUNTRY_NM_FORMAT, A.NAME, A.NAME_INITIALS, A.NAME_PREFIX, A.NAME_SUFFIX, A.NAME_ROYAL_PREFIX, A.NAME_ROYAL_SUFFIX, A.NAME_TITLE, A.LAST_NAME_SRCH, A.FIRST_NAME_SRCH, A.LAST_NAME, A.FIRST_NAME, A.MIDDLE_NAME, A.SECOND_LAST_NAME, A.SECOND_LAST_SRCH, A.NAME_AC, A.PREF_FIRST_NAME, A.PARTNER_LAST_NAME, A.PARTNER_ROY_PREFIX, A.LAST_NAME_PREF_NLD ,A.NAME_TYPE ,A.EFFDT FROM PS_NAMES A WHERE A.NAME_TYPE = 'PRI' AND A.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_NAMES B WHERE B.EMPLID = A.EMPLID AND B.NAME_TYPE = A.NAME_TYPE AND ( B.EFFDT <= TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD') OR (B.EFFDT > TO_DATE 63
  • 64. (TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD') AND TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM- DD') < ( SELECT MIN(C.EFFDT) FROM PS_NAMES C WHERE C.EMPLID = B.EMPLID AND C.NAME_TYPE = B.NAME_TYPE) ) )); CREATE TABLE SYSADM.PS_FAST_SCRTY_2 ( SETID VARCHAR2(5) NOT NULL, DEPTID VARCHAR2(10) NOT NULL, ROWSECCLASS VARCHAR2(30) NOT NULL, ACCESS_CD VARCHAR2(1) NOT NULL ) LOGGING PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 TABLESPACE HRLARGE STORAGE ( INITIAL 139264 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 ); CREATE UNIQUE INDEX SYSADM.PS_FAST_SCRTY_2 ON SYSADM.PS_FAST_SCRTY_2 (SETID, DEPTID, ROWSECCLASS) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 196608 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); ALTER TABLE SYSADM.PS_FAST_SCRTY_2 ADD CONSTRAINT SYS_C00204811 CHECK("SETID" IS NOT NULL); ALTER TABLE SYSADM.PS_FAST_SCRTY_2 ADD CONSTRAINT SYS_C00204812 CHECK("DEPTID" IS NOT NULL); ALTER TABLE SYSADM.PS_FAST_SCRTY_2 ADD CONSTRAINT SYS_C00204813 CHECK("ROWSECCLASS" IS NOT NULL); ALTER TABLE SYSADM.PS_FAST_SCRTY_2 ADD CONSTRAINT SYS_C00204814 CHECK("ACCESS_CD" IS NOT NULL); CREATE TABLE SYSADM.PS_PERS_DATA_EFFDT ( EMPLID VARCHAR2(11) NOT NULL, EFFDT DATE NOT NULL, MAR_STATUS VARCHAR2(1) NOT NULL, SMOKER VARCHAR2(1) NOT NULL, PER_TYPE VARCHAR2(1) NOT NULL, MAR_STATUS_DT DATE, SEX VARCHAR2(1) NOT NULL, AGE_STATUS VARCHAR2(1) NOT NULL, HIGHEST_EDUC_LVL VARCHAR2(2) NOT NULL, FT_STUDENT VARCHAR2(1) NOT NULL, LANG_CD VARCHAR2(3) NOT NULL, YEARS_OF_EXP NUMBER(4,1) NOT NULL, APPLID VARCHAR2(11) NOT NULL, 64
  • 65. APP_DT DATE, ALTER_EMPLID VARCHAR2(11) NOT NULL, BILINGUALISM_CODE VARCHAR2(1) NOT NULL, HEALTH_CARE_NBR VARCHAR2(12) NOT NULL, HEALTH_CARE_STATE VARCHAR2(6) NOT NULL, GUARDIAN_CHE VARCHAR2(40) NOT NULL, MILIT_SITUATN_ESP VARCHAR2(3) NOT NULL, SOC_SEC_AFF_DT DATE, GVT_CRED_MIL_SVCE VARCHAR2(4) NOT NULL, GVT_MILITARY_COMP VARCHAR2(1) NOT NULL, GVT_MIL_GRADE VARCHAR2(3) NOT NULL, GVT_MIL_RESRVE_CAT VARCHAR2(1) NOT NULL, GVT_MIL_SEP_RET VARCHAR2(1) NOT NULL, GVT_MIL_SVCE_END DATE, GVT_MIL_SVCE_START DATE, GVT_MIL_VERIFY VARCHAR2(1) NOT NULL, GVT_PAR_NBR_LAST NUMBER NOT NULL, GVT_UNIF_SVC_CTR VARCHAR2(1) NOT NULL, GVT_VET_PREF_APPT VARCHAR2(1) NOT NULL, GVT_VET_PREF_RIF VARCHAR2(1) NOT NULL, GVT_CHANGE_FLAG VARCHAR2(1) NOT NULL, GVT_DRAFT_STATUS VARCHAR2(1) NOT NULL, GVT_YR_ATTAINED DATE, DISABLED_VET VARCHAR2(1) NOT NULL, DISABLED VARCHAR2(1) NOT NULL, ETHNIC_GROUP VARCHAR2(1) NOT NULL, GVT_DISABILITY_CD VARCHAR2(2) NOT NULL, GRADE VARCHAR2(3) NOT NULL, SAL_ADMIN_PLAN VARCHAR2(4) NOT NULL, GVT_CURR_AGCY_EMPL VARCHAR2(1) NOT NULL, GVT_CURR_FED_EMPL VARCHAR2(1) NOT NULL, GVT_HIGH_PAY_PLAN VARCHAR2(2) NOT NULL, GVT_HIGH_GRADE VARCHAR2(3) NOT NULL, GVT_PREV_AGCY_EMPL VARCHAR2(1) NOT NULL, GVT_PREV_FED_EMPL VARCHAR2(1) NOT NULL, GVT_SEP_INCENTIVE VARCHAR2(1) NOT NULL, GVT_SEP_INCENT_DT DATE, GVT_TENURE VARCHAR2(1) NOT NULL, GVT_PAY_PLAN VARCHAR2(2) NOT NULL, BARG_UNIT VARCHAR2(4) NOT NULL, ENTRY_DT_FRA DATE, MILIT_SITUATN_FRA VARCHAR2(3) NOT NULL, CPAMID VARCHAR2(6) NOT NULL, MILITARY_STAT_GER VARCHAR2(1) NOT NULL, EXPCTD_MILITARY_DT DATE, HR_RESPONSIBLE_ID VARCHAR2(11) NOT NULL, MILITARY_STAT_ITA VARCHAR2(1) NOT NULL, MILITARY_TYPE_ITA VARCHAR2(2) NOT NULL, MILITARY_RANK_ITA VARCHAR2(50) NOT NULL, MILITARY_END_ITA DATE, HONSEKI_JPN VARCHAR2(2) NOT NULL, US_WORK_ELIGIBILTY VARCHAR2(1) NOT NULL, MILITARY_STATUS VARCHAR2(1) NOT NULL, CITIZEN_PROOF1 VARCHAR2(10) NOT NULL, CITIZEN_PROOF2 VARCHAR2(10) NOT NULL, MEDICARE_ENTLD_DT DATE, SMOKER_DT DATE, FP_ACTION_2 VARCHAR2(3) NOT NULL, ACTION_REASON VARCHAR2(3) NOT NULL, FP_ACTION_REQ VARCHAR2(1) NOT NULL, FP_SUPDOC_REQ VARCHAR2(1) NOT NULL, LAST_UPDATE_DATE DATE ) LOGGING PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 TABLESPACE HRLARGE STORAGE ( INITIAL 2211840 NEXT 131072 MINEXTENTS 1 65
  • 66. MAXEXTENTS 2147483645 PCTINCREASE 0 ); CREATE UNIQUE INDEX SYSADM.PS_PERS_DATA_EFFDT ON SYSADM.PS_PERS_DATA_EFFDT (EMPLID, EFFDT) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 450560 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208682 CHECK("PER_TYPE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208683 CHECK("SEX" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208684 CHECK("AGE_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208685 CHECK("HIGHEST_EDUC_LVL" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208686 CHECK("FT_STUDENT" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208687 CHECK("LANG_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208688 CHECK("YEARS_OF_EXP" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208689 CHECK("APPLID" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208690 CHECK("ALTER_EMPLID" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208691 CHECK("BILINGUALISM_CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208692 CHECK("HEALTH_CARE_NBR" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208693 CHECK("HEALTH_CARE_STATE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208694 CHECK("GUARDIAN_CHE" IS NOT NULL); 66
  • 67. ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208695 CHECK("MILIT_SITUATN_ESP" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208696 CHECK("GVT_CRED_MIL_SVCE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208697 CHECK("GVT_MILITARY_COMP" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208698 CHECK("GVT_MIL_GRADE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208699 CHECK("GVT_MIL_RESRVE_CAT" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208700 CHECK("GVT_MIL_SEP_RET" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208701 CHECK("GVT_MIL_VERIFY" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208702 CHECK("GVT_PAR_NBR_LAST" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208703 CHECK("GVT_UNIF_SVC_CTR" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208704 CHECK("GVT_VET_PREF_APPT" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208705 CHECK("GVT_VET_PREF_RIF" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208706 CHECK("GVT_CHANGE_FLAG" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208707 CHECK("GVT_DRAFT_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208708 CHECK("DISABLED_VET" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208709 CHECK("DISABLED" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208710 CHECK("ETHNIC_GROUP" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208711 CHECK("GVT_DISABILITY_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208712 67
  • 68. CHECK("GRADE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208713 CHECK("SAL_ADMIN_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208714 CHECK("GVT_CURR_AGCY_EMPL" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208715 CHECK("GVT_CURR_FED_EMPL" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208716 CHECK("GVT_HIGH_PAY_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208717 CHECK("GVT_HIGH_GRADE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208718 CHECK("GVT_PREV_AGCY_EMPL" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208719 CHECK("GVT_PREV_FED_EMPL" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208720 CHECK("GVT_SEP_INCENTIVE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208721 CHECK("GVT_TENURE" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208722 CHECK("GVT_PAY_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208723 CHECK("BARG_UNIT" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208724 CHECK("MILIT_SITUATN_FRA" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208725 CHECK("CPAMID" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208726 CHECK("MILITARY_STAT_GER" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208727 CHECK("HR_RESPONSIBLE_ID" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208728 CHECK("MILITARY_STAT_ITA" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208729 CHECK("MILITARY_TYPE_ITA" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT 68
  • 69. ADD CONSTRAINT SYS_C00208730 CHECK("MILITARY_RANK_ITA" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208731 CHECK("HONSEKI_JPN" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208732 CHECK("US_WORK_ELIGIBILTY" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208733 CHECK("MILITARY_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208734 CHECK("CITIZEN_PROOF1" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208735 CHECK("CITIZEN_PROOF2" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208736 CHECK("FP_ACTION_2" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208737 CHECK("ACTION_REASON" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208738 CHECK("FP_ACTION_REQ" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C00208739 CHECK("FP_SUPDOC_REQ" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C0042288 CHECK("EMPLID" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C0042289 CHECK("EFFDT" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C0042329 CHECK("MAR_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_PERS_DATA_EFFDT ADD CONSTRAINT SYS_C0042330 CHECK("SMOKER" IS NOT NULL); CREATE TABLE SYSADM.PS_NAMES ( EMPLID VARCHAR2(11) NOT NULL, NAME_TYPE VARCHAR2(3) NOT NULL, EFFDT DATE NOT NULL, NAME_PREFIX VARCHAR2(4) NOT NULL, NAME_SUFFIX VARCHAR2(15) NOT NULL, LAST_NAME_SRCH VARCHAR2(30) NOT NULL, FIRST_NAME_SRCH VARCHAR2(30) NOT NULL, FIRST_NAME VARCHAR2(30) NOT NULL, MIDDLE_NAME VARCHAR2(30) NOT NULL, LAST_NAME VARCHAR2(30) NOT NULL, COUNTRY_NM_FORMAT VARCHAR2(3) NOT NULL, NAME VARCHAR2(50) NOT NULL, NAME_INITIALS VARCHAR2(6) NOT NULL, NAME_ROYAL_PREFIX VARCHAR2(15) NOT NULL, NAME_ROYAL_SUFFIX VARCHAR2(15) NOT NULL, 69
  • 70. NAME_TITLE VARCHAR2(30) NOT NULL, SECOND_LAST_NAME VARCHAR2(30) NOT NULL, SECOND_LAST_SRCH VARCHAR2(30) NOT NULL, NAME_AC VARCHAR2(50) NOT NULL, PREF_FIRST_NAME VARCHAR2(30) NOT NULL, PARTNER_LAST_NAME VARCHAR2(30) NOT NULL, PARTNER_ROY_PREFIX VARCHAR2(15) NOT NULL, LAST_NAME_PREF_NLD VARCHAR2(1) NOT NULL ) LOGGING PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 TABLESPACE HRAPP STORAGE ( INITIAL 942080 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 ); CREATE INDEX SYSADM.PS1NAMES ON SYSADM.PS_NAMES (LAST_NAME_SRCH, EMPLID, NAME_TYPE, EFFDT) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 40960 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PS0NAMES ON SYSADM.PS_NAMES (NAME, EMPLID, NAME_TYPE, EFFDT) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 40960 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE UNIQUE INDEX SYSADM.PS_NAMES ON SYSADM.PS_NAMES (EMPLID, NAME_TYPE, EFFDT) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 368640 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 70
  • 71. PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C00208130 CHECK("PARTNER_LAST_NAME" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C00208131 CHECK("PARTNER_ROY_PREFIX" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C00208132 CHECK("LAST_NAME_PREF_NLD" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037024 CHECK("EMPLID" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037025 CHECK("NAME_TYPE" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037026 CHECK("EFFDT" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037027 CHECK("NAME_PREFIX" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037028 CHECK("NAME_SUFFIX" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037029 CHECK("LAST_NAME_SRCH" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037030 CHECK("FIRST_NAME_SRCH" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037031 CHECK("FIRST_NAME" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037032 CHECK("MIDDLE_NAME" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037033 CHECK("LAST_NAME" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037034 CHECK("COUNTRY_NM_FORMAT" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037035 CHECK("NAME" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037036 CHECK("NAME_INITIALS" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037037 71
  • 72. CHECK("NAME_ROYAL_PREFIX" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037038 CHECK("NAME_ROYAL_SUFFIX" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037039 CHECK("NAME_TITLE" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037040 CHECK("SECOND_LAST_NAME" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037041 CHECK("SECOND_LAST_SRCH" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037042 CHECK("NAME_AC" IS NOT NULL); ALTER TABLE SYSADM.PS_NAMES ADD CONSTRAINT SYS_C0037043 CHECK("PREF_FIRST_NAME" IS NOT NULL); CREATE TABLE SYSADM.PS_JOBCODE_TBL ( SETID VARCHAR2(5) NOT NULL, JOBCODE VARCHAR2(6) NOT NULL, EFFDT DATE NOT NULL, DESCR VARCHAR2(30) NOT NULL, GVT_PAY_PLAN VARCHAR2(2) NOT NULL, GVT_OCC_SERIES VARCHAR2(4) NOT NULL, TRN_PROGRAM VARCHAR2(6) NOT NULL, COMPANY VARCHAR2(3) NOT NULL, GVT_FUNC_CLASS VARCHAR2(2) NOT NULL, GVT_POSN_TITLE_CD VARCHAR2(4) NOT NULL, GVT_OFFICIAL_DESCR VARCHAR2(70) NOT NULL, GVT_ORG_TTL_CD VARCHAR2(4) NOT NULL, GVT_ORG_TTL_DESCR VARCHAR2(70) NOT NULL, GVT_PAY_BASIS VARCHAR2(2) NOT NULL, GVT_SUB_AGENCY VARCHAR2(2) NOT NULL, GVT_POI VARCHAR2(4) NOT NULL, GVT_PAREN_TITLE VARCHAR2(1) NOT NULL, GVT_OPM_CERT_NBR VARCHAR2(8) NOT NULL, GVT_POSN_CLASS_STD VARCHAR2(254) NOT NULL, GVT_POSN_SENS_CD VARCHAR2(1) NOT NULL, GVT_IA_ACTIONS VARCHAR2(1) NOT NULL, GVT_EXEC_FIN_DISCL VARCHAR2(1) NOT NULL, GVT_EMP_FIN_INT VARCHAR2(1) NOT NULL, GVT_PATCOB_CD VARCHAR2(1) NOT NULL, GVT_CLS_STANDARD VARCHAR2(15) NOT NULL, GVT_CLASSIFIER_ID VARCHAR2(11) NOT NULL, GVT_DT_CLASSIFIED DATE, BARG_UNIT VARCHAR2(4) NOT NULL, GVT_FUND_SOURCE VARCHAR2(1) NOT NULL, GVT_LEO_POSITION VARCHAR2(1) NOT NULL, GVT_PERF_PLAN VARCHAR2(8) NOT NULL, GVT_TARGET_GRADE VARCHAR2(2) NOT NULL, GVT_PI_UPD_IND VARCHAR2(1) NOT NULL, EFF_STATUS VARCHAR2(1) NOT NULL, DESCRSHORT VARCHAR2(10) NOT NULL, JOB_FUNCTION VARCHAR2(3) NOT NULL, SETID_SALARY VARCHAR2(5) NOT NULL, SAL_ADMIN_PLAN VARCHAR2(4) NOT NULL, GRADE VARCHAR2(3) NOT NULL, STEP NUMBER NOT NULL, MANAGER_LEVEL VARCHAR2(2) NOT NULL, SURVEY_SALARY NUMBER NOT NULL, SURVEY_JOB_CODE VARCHAR2(8) NOT NULL, UNION_CD VARCHAR2(3) NOT NULL, 72
  • 73. RETRO_RATE NUMBER(6,4) NOT NULL, RETRO_PERCENT NUMBER(6,4) NOT NULL, CURRENCY_CD VARCHAR2(3) NOT NULL, STD_HOURS NUMBER(6,2) NOT NULL, STD_HRS_FREQUENCY VARCHAR2(5) NOT NULL, COMP_FREQUENCY VARCHAR2(5) NOT NULL, WORKERS_COMP_CD VARCHAR2(4) NOT NULL, JOB_FAMILY VARCHAR2(6) NOT NULL, JOB_KNOWHOW_POINTS NUMBER NOT NULL, JOB_ACCNTAB_POINTS NUMBER NOT NULL, JOB_PROBSLV_POINTS NUMBER NOT NULL, JOB_POINTS_TOTAL NUMBER NOT NULL, JOB_KNOWHOW_PCT NUMBER(4,1) NOT NULL, JOB_ACCNTAB_PCT NUMBER(4,1) NOT NULL, JOB_PROBSLV_PCT NUMBER(4,1) NOT NULL, REG_TEMP VARCHAR2(1) NOT NULL, DIRECTLY_TIPPED VARCHAR2(1) NOT NULL, MED_CHKUP_REQ VARCHAR2(1) NOT NULL, FLSA_STATUS VARCHAR2(1) NOT NULL, EEO1CODE VARCHAR2(1) NOT NULL, EEO4CODE VARCHAR2(1) NOT NULL, EEO5CODE VARCHAR2(2) NOT NULL, EEO6CODE VARCHAR2(1) NOT NULL, EEO_JOB_GROUP VARCHAR2(4) NOT NULL, US_SOC_CD VARCHAR2(6) NOT NULL, IPEDSSCODE VARCHAR2(1) NOT NULL, CAN_PAYEQ_JOB_CLS VARCHAR2(3) NOT NULL, CAN_NOC_CD VARCHAR2(4) NOT NULL, SEASONAL VARCHAR2(1) NOT NULL, BPS_ACTIVITY_CD VARCHAR2(6) NOT NULL, FUNCTION_CD VARCHAR2(2) NOT NULL, BA_CD VARCHAR2(3) NOT NULL, TECHNICAL VARCHAR2(1) NOT NULL, MED_SURV_REQ VARCHAR2(1) NOT NULL, EMP_CATEGRY_FRA VARCHAR2(3) NOT NULL, ACTIVITY_TYPE_FRA VARCHAR2(3) NOT NULL, INSEE_CD_FRA VARCHAR2(4) NOT NULL, JOB_CTG_FRA_CD VARCHAR2(2) NOT NULL, UK_SOC_CD VARCHAR2(2) NOT NULL, ENCUMBER_INDC VARCHAR2(1) NOT NULL, POSN_MGMT_INDC VARCHAR2(1) NOT NULL, EG_ACADEMIC_RANK VARCHAR2(3) NOT NULL, EG_GROUP VARCHAR2(6) NOT NULL, HP_STATS_DUTIES VARCHAR2(2) NOT NULL, HP_STATS_RPT_FLAG VARCHAR2(1) NOT NULL, ENCUMB_SAL_OPTN VARCHAR2(3) NOT NULL, ENCUMB_SAL_AMT NUMBER(18,3) NOT NULL, INAIL_CODE VARCHAR2(11) NOT NULL, ASCO_CD_AUS VARCHAR2(6) NOT NULL, PKG_TEMPLATE_ID VARCHAR2(10) NOT NULL, PKG_RULE_ID VARCHAR2(10) NOT NULL, FUNCTION_AUS VARCHAR2(1) NOT NULL, ANN_CNTACT_HRS_AUS NUMBER(6,2) NOT NULL, TEACH_WEEKS_AUS NUMBER NOT NULL, CASUAL_TYPE_AUS VARCHAR2(1) NOT NULL, WORK_DAY_HOURS NUMBER(6,2) NOT NULL, FA_PAY_PROGRAM VARCHAR2(3) NOT NULL, ELECTION_GROUP VARCHAR2(5) NOT NULL, LABOR_AGREEMENT VARCHAR2(6) NOT NULL, FP_PROF_CATG VARCHAR2(3) NOT NULL, FP_JOB_FMLY VARCHAR2(4) NOT NULL, FP_OFF_COLAG VARCHAR2(1) NOT NULL, FP_MATRIX_TYP VARCHAR2(3) NOT NULL, FP_MATRIX_CD VARCHAR2(4) NOT NULL, FP_BUSINESS_CD VARCHAR2(4) NOT NULL, FP_JOBCD_ACC VARCHAR2(1) NOT NULL, FP_ATCH_AREA VARCHAR2(4) NOT NULL, FP_JOB_TYP VARCHAR2(2) NOT NULL, FP_AUTO_RATFY VARCHAR2(1) NOT NULL, LAST_UPDATE_DATE DATE, REG_REGION VARCHAR2(5) NOT NULL, 73
  • 74. SAL_RANGE_MIN_RATE NUMBER(18,6) NOT NULL, SAL_RANGE_MID_RATE NUMBER(18,6) NOT NULL, SAL_RANGE_MAX_RATE NUMBER(18,6) NOT NULL, SAL_RANGE_CURRENCY VARCHAR2(3) NOT NULL, SAL_RANGE_FREQ VARCHAR2(5) NOT NULL, JOB_PROFILE_ID VARCHAR2(8) NOT NULL, BEN_DEFN_PGM VARCHAR2(3) NOT NULL, RETIREMENT_SYSTEM VARCHAR2(1) NOT NULL, ERNCD VARCHAR2(3) NOT NULL, DESCRLONG LONG ) LOGGING PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 TABLESPACE HRAPP STORAGE ( INITIAL 163840 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 ); CREATE UNIQUE INDEX SYSADM.PS_JOBCODE_TBL ON SYSADM.PS_JOBCODE_TBL (SETID, JOBCODE, EFFDT) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 81920 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PS0JOBCODE_TBL ON SYSADM.PS_JOBCODE_TBL (DESCR, SETID, JOBCODE, EFFDT) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 163840 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PS1JOBCODE_TBL ON SYSADM.PS_JOBCODE_TBL (GVT_OCC_SERIES, SETID, JOBCODE, EFFDT) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 40960 NEXT 131072 74
  • 75. MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PS2JOBCODE_TBL ON SYSADM.PS_JOBCODE_TBL (GVT_OFFICIAL_DESCR, SETID, JOBCODE, EFFDT) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 40960 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207519 CHECK("SETID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207520 CHECK("JOBCODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207521 CHECK("EFFDT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207522 CHECK("DESCR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207523 CHECK("GVT_PAY_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207524 CHECK("GVT_OCC_SERIES" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207525 CHECK("TRN_PROGRAM" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207526 CHECK("COMPANY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207527 CHECK("GVT_FUNC_CLASS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207528 CHECK("GVT_POSN_TITLE_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207529 CHECK("GVT_OFFICIAL_DESCR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL 75
  • 76. ADD CONSTRAINT SYS_C00207530 CHECK("GVT_ORG_TTL_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207531 CHECK("GVT_ORG_TTL_DESCR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207532 CHECK("GVT_PAY_BASIS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207533 CHECK("GVT_SUB_AGENCY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207534 CHECK("GVT_POI" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207535 CHECK("GVT_PAREN_TITLE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207536 CHECK("GVT_OPM_CERT_NBR" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207537 CHECK("GVT_POSN_CLASS_STD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207538 CHECK("GVT_POSN_SENS_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207539 CHECK("GVT_IA_ACTIONS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207540 CHECK("GVT_EXEC_FIN_DISCL" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207541 CHECK("GVT_EMP_FIN_INT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207542 CHECK("GVT_PATCOB_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207543 CHECK("GVT_CLS_STANDARD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207544 CHECK("GVT_CLASSIFIER_ID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207545 CHECK("BARG_UNIT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207546 CHECK("GVT_FUND_SOURCE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207547 CHECK("GVT_LEO_POSITION" IS NOT NULL); 76
  • 77. ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207548 CHECK("GVT_PERF_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207549 CHECK("GVT_TARGET_GRADE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207550 CHECK("GVT_PI_UPD_IND" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207551 CHECK("EFF_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207552 CHECK("DESCRSHORT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207553 CHECK("JOB_FUNCTION" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207554 CHECK("SETID_SALARY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207555 CHECK("SAL_ADMIN_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207556 CHECK("GRADE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207557 CHECK("STEP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207558 CHECK("MANAGER_LEVEL" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207559 CHECK("SURVEY_SALARY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207560 CHECK("SURVEY_JOB_CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207561 CHECK("UNION_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207562 CHECK("RETRO_RATE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207563 CHECK("RETRO_PERCENT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207564 CHECK("CURRENCY_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207565 CHECK("STD_HOURS" IS NOT NULL); 77
  • 78. ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207566 CHECK("STD_HRS_FREQUENCY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207567 CHECK("COMP_FREQUENCY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207568 CHECK("WORKERS_COMP_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207569 CHECK("JOB_FAMILY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207570 CHECK("JOB_KNOWHOW_POINTS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207571 CHECK("JOB_ACCNTAB_POINTS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207572 CHECK("JOB_PROBSLV_POINTS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207573 CHECK("JOB_POINTS_TOTAL" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207574 CHECK("JOB_KNOWHOW_PCT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207575 CHECK("JOB_ACCNTAB_PCT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207576 CHECK("JOB_PROBSLV_PCT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207577 CHECK("REG_TEMP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207578 CHECK("DIRECTLY_TIPPED" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207579 CHECK("MED_CHKUP_REQ" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207580 CHECK("FLSA_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207581 CHECK("EEO1CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207582 CHECK("EEO4CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207583 78
  • 79. CHECK("EEO5CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207584 CHECK("EEO6CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207585 CHECK("EEO_JOB_GROUP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207586 CHECK("US_SOC_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207587 CHECK("IPEDSSCODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207588 CHECK("CAN_PAYEQ_JOB_CLS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207589 CHECK("CAN_NOC_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207590 CHECK("SEASONAL" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207591 CHECK("BPS_ACTIVITY_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207592 CHECK("FUNCTION_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207593 CHECK("BA_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207594 CHECK("TECHNICAL" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207595 CHECK("MED_SURV_REQ" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207596 CHECK("EMP_CATEGRY_FRA" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207597 CHECK("ACTIVITY_TYPE_FRA" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207598 CHECK("INSEE_CD_FRA" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207599 CHECK("JOB_CTG_FRA_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207600 CHECK("UK_SOC_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL 79
  • 80. ADD CONSTRAINT SYS_C00207601 CHECK("ENCUMBER_INDC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207602 CHECK("POSN_MGMT_INDC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207603 CHECK("EG_ACADEMIC_RANK" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207604 CHECK("EG_GROUP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207605 CHECK("HP_STATS_DUTIES" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207606 CHECK("HP_STATS_RPT_FLAG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207607 CHECK("ENCUMB_SAL_OPTN" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207608 CHECK("ENCUMB_SAL_AMT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207609 CHECK("INAIL_CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207610 CHECK("ASCO_CD_AUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207611 CHECK("PKG_TEMPLATE_ID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207612 CHECK("PKG_RULE_ID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207613 CHECK("FUNCTION_AUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207614 CHECK("ANN_CNTACT_HRS_AUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207615 CHECK("TEACH_WEEKS_AUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207616 CHECK("CASUAL_TYPE_AUS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207617 CHECK("WORK_DAY_HOURS" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207618 CHECK("FA_PAY_PROGRAM" IS NOT NULL); 80
  • 81. ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207619 CHECK("ELECTION_GROUP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207620 CHECK("LABOR_AGREEMENT" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207621 CHECK("FP_PROF_CATG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207622 CHECK("FP_JOB_FMLY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207623 CHECK("FP_OFF_COLAG" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207624 CHECK("FP_MATRIX_TYP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207625 CHECK("FP_MATRIX_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207626 CHECK("FP_BUSINESS_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207627 CHECK("FP_JOBCD_ACC" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207628 CHECK("FP_ATCH_AREA" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207629 CHECK("FP_JOB_TYP" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207630 CHECK("FP_AUTO_RATFY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207631 CHECK("REG_REGION" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207632 CHECK("SAL_RANGE_MIN_RATE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207633 CHECK("SAL_RANGE_MID_RATE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207634 CHECK("SAL_RANGE_MAX_RATE" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207635 CHECK("SAL_RANGE_CURRENCY" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207636 CHECK("SAL_RANGE_FREQ" IS NOT NULL); 81
  • 82. ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207637 CHECK("JOB_PROFILE_ID" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207638 CHECK("BEN_DEFN_PGM" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207639 CHECK("RETIREMENT_SYSTEM" IS NOT NULL); ALTER TABLE SYSADM.PS_JOBCODE_TBL ADD CONSTRAINT SYS_C00207640 CHECK("ERNCD" IS NOT NULL); CREATE TABLE SYSADM.PS_EMPLOYMENT ( EMPLID VARCHAR2(11) NOT NULL, EMPL_RCD NUMBER NOT NULL, BENEFIT_RCD_NBR NUMBER NOT NULL, HOME_HOST_CLASS VARCHAR2(1) NOT NULL, HIRE_DT DATE, REHIRE_DT DATE, CMPNY_SENIORITY_DT DATE, SERVICE_DT DATE, PROF_EXPERIENCE_DT DATE, LAST_VERIFICATN_DT DATE, EXPECTED_RETURN_DT DATE, TERMINATION_DT DATE, LAST_DATE_WORKED DATE, LAST_INCREASE_DT DATE, OWN_5PERCENT_CO VARCHAR2(1) NOT NULL, BUSINESS_TITLE VARCHAR2(30) NOT NULL, REPORTS_TO VARCHAR2(8) NOT NULL, SUPERVISOR_ID VARCHAR2(11) NOT NULL, PROBATION_DT DATE, SECURITY_CLEARANCE VARCHAR2(1) NOT NULL, COUNTRY_CODE VARCHAR2(3) NOT NULL, PHONE VARCHAR2(24) NOT NULL, TIME_RPT_LOC VARCHAR2(6) NOT NULL, JOB_REPORTING VARCHAR2(1) NOT NULL, DED_TAKEN VARCHAR2(1) NOT NULL, DED_SUBSET_ID VARCHAR2(3) NOT NULL, GVT_SCD_RETIRE DATE, GVT_SCD_TSP DATE, GVT_SCD_LEO DATE, GVT_SCD_SEVPAY DATE, GVT_SEVPAY_PRV_WKS NUMBER NOT NULL, GVT_MAND_RET_DT DATE, GVT_WGI_STATUS VARCHAR2(1) NOT NULL, GVT_INTRM_DAYS_WGI NUMBER NOT NULL, GVT_NONPAY_NOA VARCHAR2(3) NOT NULL, GVT_NONPAY_HRS_WGI NUMBER(6,2) NOT NULL, GVT_NONPAY_HRS_SCD NUMBER(6,2) NOT NULL, GVT_NONPAY_HRS_TNR NUMBER(6,2) NOT NULL, GVT_NONPAY_HRS_PRB NUMBER(6,2) NOT NULL, GVT_TEMP_PRO_EXPIR DATE, GVT_TEMP_PSN_EXPIR DATE, GVT_DETAIL_EXPIRES DATE, GVT_SABBATIC_EXPIR DATE, GVT_RTND_GRADE_BEG DATE, GVT_RTND_GRADE_EXP DATE, GVT_NOA_CODE VARCHAR2(3) NOT NULL, GVT_CURR_APT_AUTH1 VARCHAR2(3) NOT NULL, GVT_CURR_APT_AUTH2 VARCHAR2(3) NOT NULL, GVT_APPT_EXPIR_DT DATE, GVT_CNV_BEGIN_DATE DATE, GVT_CAREER_CNV_DUE DATE, GVT_CAREER_COND_DT DATE, 82
  • 83. GVT_APPT_LIMIT_HRS NUMBER NOT NULL, GVT_APPT_LIMIT_DYS NUMBER NOT NULL, GVT_APPT_LIMIT_AMT NUMBER NOT NULL, GVT_SUPV_PROB_DT DATE, GVT_SES_PROB_DT DATE, GVT_SEC_CLR_STATUS VARCHAR2(1) NOT NULL, GVT_CLRNCE_STAT_DT DATE, GVT_ERN_PGM_PERM VARCHAR2(2) NOT NULL, GVT_OCC_SERS_PERM VARCHAR2(4) NOT NULL, GVT_GRADE_PERM VARCHAR2(3) NOT NULL, GVT_COMP_AREA_PERM VARCHAR2(2) NOT NULL, GVT_COMP_LVL_PERM VARCHAR2(3) NOT NULL, GVT_CHANGE_FLAG VARCHAR2(1) NOT NULL, GVT_SPEP VARCHAR2(2) NOT NULL, GVT_WGI_DUE_DATE DATE, GVT_DT_LEI DATE, GVT_FIN_DISCLOSURE VARCHAR2(1) NOT NULL, GVT_FIN_DISCL_DATE DATE, GVT_TENURE VARCHAR2(1) NOT NULL, GVT_DETL_BARG_UNIT VARCHAR2(4) NOT NULL, GVT_DETL_UNION_CD VARCHAR2(3) NOT NULL, NEXT_REVIEW_DT DATE, GVT_WELFARE_WK_CD VARCHAR2(2) NOT NULL, TENURE_ACCR_FLG VARCHAR2(1) NOT NULL, FTE_TENURE NUMBER(3,2) NOT NULL, EG_GROUP VARCHAR2(6) NOT NULL, FTE_FLX_SRVC NUMBER(3,2) NOT NULL, CONTRACT_LENGTH VARCHAR2(1) NOT NULL, APPOINT_END_DT DATE, NEE_PROVIDER_ID VARCHAR2(10) NOT NULL, FA_PAY_PROGRAM VARCHAR2(3) NOT NULL, FA_TYPE VARCHAR2(3) NOT NULL, FA_ELIG_DT DATE, EDUC_LVL_AD_BTD DATE, OFFICIAL_LANG VARCHAR2(3) NOT NULL, RELAT_TO_OWNER_NLD VARCHAR2(1) NOT NULL, INS_DAYS_BRA VARCHAR2(2) NOT NULL, INS_MONTHS_BRA VARCHAR2(2) NOT NULL, INS_YEARS_BRA VARCHAR2(2) NOT NULL ) LOGGING PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 TABLESPACE HRLARGE STORAGE ( INITIAL 2703360 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 ); CREATE UNIQUE INDEX SYSADM.PS_EMPLOYMENT ON SYSADM.PS_EMPLOYMENT (EMPLID, EMPL_RCD) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 368640 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PS0EMPLOYMENT ON SYSADM.PS_EMPLOYMENT (BUSINESS_TITLE, EMPLID, 83
  • 84. EMPL_RCD) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 409600 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PSAEMPLOYMENT ON SYSADM.PS_EMPLOYMENT (EMPLID, BENEFIT_RCD_NBR, EMPL_RCD) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 409600 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C00204531 CHECK("FA_PAY_PROGRAM" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C00204532 CHECK("FA_TYPE" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C00204533 CHECK("OFFICIAL_LANG" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C00204534 CHECK("RELAT_TO_OWNER_NLD" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C00204535 CHECK("INS_DAYS_BRA" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C00204536 CHECK("INS_MONTHS_BRA" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C00204537 CHECK("INS_YEARS_BRA" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074127 CHECK("EMPLID" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074128 CHECK("EMPL_RCD" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074129 84
  • 85. CHECK("BENEFIT_RCD_NBR" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074130 CHECK("HOME_HOST_CLASS" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074131 CHECK("OWN_5PERCENT_CO" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074132 CHECK("BUSINESS_TITLE" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074133 CHECK("REPORTS_TO" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074134 CHECK("SUPERVISOR_ID" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074135 CHECK("SECURITY_CLEARANCE" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074136 CHECK("COUNTRY_CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074137 CHECK("PHONE" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074138 CHECK("TIME_RPT_LOC" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074139 CHECK("JOB_REPORTING" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074140 CHECK("DED_TAKEN" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074141 CHECK("DED_SUBSET_ID" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074142 CHECK("GVT_SEVPAY_PRV_WKS" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074143 CHECK("GVT_WGI_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074144 CHECK("GVT_INTRM_DAYS_WGI" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074145 CHECK("GVT_NONPAY_NOA" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074146 CHECK("GVT_NONPAY_HRS_WGI" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT 85
  • 86. ADD CONSTRAINT SYS_C0074147 CHECK("GVT_NONPAY_HRS_SCD" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074148 CHECK("GVT_NONPAY_HRS_TNR" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074149 CHECK("GVT_NONPAY_HRS_PRB" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074150 CHECK("GVT_NOA_CODE" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074151 CHECK("GVT_CURR_APT_AUTH1" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074152 CHECK("GVT_CURR_APT_AUTH2" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074153 CHECK("GVT_APPT_LIMIT_HRS" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074154 CHECK("GVT_APPT_LIMIT_DYS" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074155 CHECK("GVT_APPT_LIMIT_AMT" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074156 CHECK("GVT_SEC_CLR_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074157 CHECK("GVT_ERN_PGM_PERM" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074158 CHECK("GVT_OCC_SERS_PERM" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074159 CHECK("GVT_GRADE_PERM" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074160 CHECK("GVT_COMP_AREA_PERM" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074161 CHECK("GVT_COMP_LVL_PERM" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074162 CHECK("GVT_CHANGE_FLAG" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074163 CHECK("GVT_SPEP" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074164 CHECK("GVT_FIN_DISCLOSURE" IS NOT NULL); 86
  • 87. ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074165 CHECK("GVT_TENURE" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074166 CHECK("GVT_DETL_BARG_UNIT" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074167 CHECK("GVT_DETL_UNION_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074168 CHECK("GVT_WELFARE_WK_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074169 CHECK("TENURE_ACCR_FLG" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074170 CHECK("FTE_TENURE" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074171 CHECK("EG_GROUP" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074172 CHECK("FTE_FLX_SRVC" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074173 CHECK("CONTRACT_LENGTH" IS NOT NULL); ALTER TABLE SYSADM.PS_EMPLOYMENT ADD CONSTRAINT SYS_C0074174 CHECK("NEE_PROVIDER_ID" IS NOT NULL); CREATE TABLE SYSADM.PS_SAL_GRADE_TBL ( SETID VARCHAR2(5) NOT NULL, SAL_ADMIN_PLAN VARCHAR2(4) NOT NULL, GRADE VARCHAR2(3) NOT NULL, EFFDT DATE NOT NULL, EFF_STATUS VARCHAR2(1) NOT NULL, DESCR VARCHAR2(30) NOT NULL, DESCRSHORT VARCHAR2(10) NOT NULL, SALARY_MATRIX_CD VARCHAR2(5) NOT NULL, CURRENCY_CD VARCHAR2(3) NOT NULL, MIN_RT_HOURLY NUMBER(18,6) NOT NULL, BOCES_QURT_RT_HOUR NUMBER(14,2), MID_RT_HOURLY NUMBER(18,6) NOT NULL, MAX_RT_HOURLY NUMBER(18,6) NOT NULL, BOCES_QURT_RT_DAIL NUMBER(14,2), MIN_RT_MONTHLY NUMBER(18,3) NOT NULL, BOCES_QURT_RT_MONT NUMBER(17,2), MID_RT_MONTHLY NUMBER(18,3) NOT NULL, MAX_RT_MONTHLY NUMBER(18,3) NOT NULL, MIN_RT_ANNUAL NUMBER(18,3) NOT NULL, BOCES_QURT_RT_ANUL NUMBER(17,2), MID_RT_ANNUAL NUMBER(18,3) NOT NULL, MAX_RT_ANNUAL NUMBER(18,3) NOT NULL, STEP_INCREM_TYPE VARCHAR2(1) NOT NULL, STEP_INCREM_ACCUM VARCHAR2(3) NOT NULL, MIN_RT_DAILY NUMBER(18,3) NOT NULL, MID_RT_DAILY NUMBER(18,3) NOT NULL, MAX_RT_DAILY NUMBER(18,3) NOT NULL, LABOR_AGREEMENT VARCHAR2(6) NOT NULL, EMPL_CTG VARCHAR2(6) NOT NULL, EMPL_CTG_L1 VARCHAR2(6) NOT NULL, 87
  • 88. EMPL_CTG_L2 VARCHAR2(6) NOT NULL, GVT_MAX_RT_BIWK NUMBER(9,2) NOT NULL, GVT_MID_RT_BIWK NUMBER(9,2) NOT NULL, GVT_MIN_RT_BIWK NUMBER(9,2) NOT NULL, GRADE_TITLE_JPN VARCHAR2(60) NOT NULL, MIN_YRS_GRADE NUMBER NOT NULL, MAX_YRS_GRADE NUMBER NOT NULL, MIN_GRD_AGE NUMBER NOT NULL, REVIEW_COUNT NUMBER NOT NULL, ELIGIBILITY_POINTS NUMBER(4,1) NOT NULL, REG_REGION VARCHAR2(5) NOT NULL, JOB_PROFILE_ID VARCHAR2(8) NOT NULL ) LOGGING PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 TABLESPACE HRAPP STORAGE ( INITIAL 163840 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 ); CREATE UNIQUE INDEX SYSADM.PS_SAL_GRADE_TBL ON SYSADM.PS_SAL_GRADE_TBL (SETID, SAL_ADMIN_PLAN, GRADE, EFFDT) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 81920 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); CREATE INDEX SYSADM.PS0SAL_GRADE_TBL ON SYSADM.PS_SAL_GRADE_TBL (DESCR, SETID, SAL_ADMIN_PLAN, GRADE, EFFDT) LOGGING PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE PSINDEX STORAGE ( INITIAL 204800 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C00209872 CHECK("GRADE_TITLE_JPN" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C00209873 CHECK("MIN_YRS_GRADE" IS NOT NULL); 88
  • 89. ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C00209874 CHECK("MAX_YRS_GRADE" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C00209875 CHECK("MIN_GRD_AGE" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C00209876 CHECK("REVIEW_COUNT" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C00209877 CHECK("ELIGIBILITY_POINTS" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C00209878 CHECK("REG_REGION" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C00209879 CHECK("JOB_PROFILE_ID" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050378 CHECK("SETID" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050379 CHECK("SAL_ADMIN_PLAN" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050380 CHECK("GRADE" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050381 CHECK("EFFDT" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050382 CHECK("EFF_STATUS" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050383 CHECK("DESCR" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050384 CHECK("DESCRSHORT" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050385 CHECK("SALARY_MATRIX_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050387 CHECK("CURRENCY_CD" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050388 CHECK("MIN_RT_HOURLY" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050389 CHECK("MID_RT_HOURLY" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050390 CHECK("MAX_RT_HOURLY" IS NOT NULL); 89
  • 90. ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050391 CHECK("MIN_RT_MONTHLY" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050392 CHECK("MID_RT_MONTHLY" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050393 CHECK("MAX_RT_MONTHLY" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050394 CHECK("MIN_RT_ANNUAL" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050395 CHECK("MID_RT_ANNUAL" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050396 CHECK("MAX_RT_ANNUAL" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050397 CHECK("STEP_INCREM_TYPE" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050398 CHECK("STEP_INCREM_ACCUM" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050399 CHECK("MIN_RT_DAILY" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050400 CHECK("MID_RT_DAILY" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050401 CHECK("MAX_RT_DAILY" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050402 CHECK("LABOR_AGREEMENT" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050403 CHECK("EMPL_CTG" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050404 CHECK("EMPL_CTG_L1" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050405 CHECK("EMPL_CTG_L2" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050406 CHECK("GVT_MAX_RT_BIWK" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050407 CHECK("GVT_MID_RT_BIWK" IS NOT NULL); ALTER TABLE SYSADM.PS_SAL_GRADE_TBL ADD CONSTRAINT SYS_C0050408 90
  • 91. CHECK("GVT_MIN_RT_BIWK" IS NOT NULL); CREATE OR REPLACE VIEW SYSADM.PS_PERSONAL_DATA ( EMPLID, NAME ) AS SELECT A.EMPLID , A.NAME FROM PS_NAMES A WHERE A.NAME_TYPE = 'PRI' AND A.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_NAMES B WHERE B.EMPLID = A.EMPLID AND B.NAME_TYPE = A.NAME_TYPE AND ( B.EFFDT <= TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM- DD'),'YYYY-MM-DD') OR (B.EFFDT > TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD') AND TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD') < ( SELECT MIN(C.EFFDT) FROM PS_NAMES C WHERE C.EMPLID = B.EMPLID AND C.NAME_TYPE = B.NAME_TYPE) ) )); SQL Server Database: CREATE VIEW PS_B_FAST_EMP_QRY ( EMPLID, EMPL_RCD, ROWSECCLASS, ACCESS_CD, NAME, LAST_NAME_SRCH, NAME_AC, PER_STATUS ) AS SELECT A.EMPLID ,JOB.EMPL_RCD ,SEC.ROWSECCLASS ,SEC.ACCESS_CD ,B.NAME ,B.LAST_NAME_SRCH ,B.NAME_AC ,A.PER_STATUS FROM PS_PERSON A ,PS_PERSON_NAME B ,PS_JOB JOB ,PS_FAST_SCRTY_2 SEC WHERE A.EMPLID = B.EMPLID AND B.EMPLID = JOB.EMPLID AND JOB.EFFDT= ( SELECT MAX(JOB2.EFFDT) FROM PS_JOB JOB2 WHERE JOB.EMPLID=JOB2.EMPLID AND JOB.EMPL_RCD=JOB2.EMPL_RCD AND JOB2.EFFDT<('2005-12-01')) AND JOB.EFFSEQ= ( SELECT MAX(JOB3.EFFSEQ) FROM PS_JOB JOB3 WHERE JOB.EMPLID=JOB3.EMPLID AND JOB.EMPL_RCD=JOB3.EMPL_RCD AND JOB.EFFDT=JOB3.EFFDT ) AND JOB.DEPTID=SEC.DEPTID AND JOB.SETID_DEPT=SEC.SETID CREATE VIEW PS_PERSON_NAME ( EMPLID, COUNTRY_NM_FORMAT, NAME, NAME_INITIALS, NAME_PREFIX, NAME_SUFFIX, NAME_ROYAL_PREFIX, NAME_ROYAL_SUFFIX, NAME_TITLE, LAST_NAME_SRCH, FIRST_NAME_SRCH, LAST_NAME, FIRST_NAME, MIDDLE_NAME, SECOND_LAST_NAME, SECOND_LAST_SRCH, NAME_AC, PREF_FIRST_NAME, PARTNER_LAST_NAME, PARTNER_ROY_PREFIX, LAST_NAME_PREF_NLD, NAME_TYPE, 91
  • 92. ASOFDATE ) AS SELECT A.EMPLID ,A.COUNTRY_NM_FORMAT, A.NAME, A.NAME_INITIALS, A.NAME_PREFIX, A.NAME_SUFFIX, A.NAME_ROYAL_PREFIX, A.NAME_ROYAL_SUFFIX, A.NAME_TITLE, A.LAST_NAME_SRCH, A.FIRST_NAME_SRCH, A.LAST_NAME, A.FIRST_NAME, A.MIDDLE_NAME, A.SECOND_LAST_NAME, A.SECOND_LAST_SRCH, A.NAME_AC, A.PREF_FIRST_NAME, A.PARTNER_LAST_NAME, A.PARTNER_ROY_PREFIX, A.LAST_NAME_PREF_NLD ,A.NAME_TYPE ,A.EFFDT FROM PS_NAMES A WHERE A.NAME_TYPE = 'PRI' AND A.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_NAMES B WHERE B.EMPLID = A.EMPLID AND B.NAME_TYPE = A.NAME_TYPE AND ( B.EFFDT <= '2005-12-02' OR (B.EFFDT > '2005-12-02' AND '2005-12-02' < ( SELECT MIN(C.EFFDT) FROM PS_NAMES C WHERE C.EMPLID = B.EMPLID AND C.NAME_TYPE = B.NAME_TYPE) ) )) ---------- CREATE VIEW PS_PERSONAL_DT_FST ( EMPLID, PER_STATUS, PER_TYPE, COUNTRY_NM_FORMAT, NAME, NAME_INITIALS, NAME_PREFIX, NAME_SUFFIX, NAME_ROYAL_PREFIX, NAME_ROYAL_SUFFIX, NAME_TITLE, LAST_NAME_SRCH, FIRST_NAME_SRCH, LAST_NAME, FIRST_NAME, MIDDLE_NAME, SECOND_LAST_NAME, SECOND_LAST_SRCH, NAME_AC, PREF_FIRST_NAME, PARTNER_LAST_NAME, PARTNER_ROY_PREFIX, LAST_NAME_PREF_NLD, ORIG_HIRE_DT, SEX, AGE_STATUS, MAR_STATUS, MAR_STATUS_DT, BIRTHDATE, BIRTHPLACE, BIRTHCOUNTRY, BIRTHSTATE, DT_OF_DEATH, HIGHEST_EDUC_LVL, FT_STUDENT, HIGHLY_COMP_EMPL_P, HIGHLY_COMP_EMPL_C, US_WORK_ELIGIBILTY, MILITARY_STATUS, CITIZEN_PROOF1, CITIZEN_PROOF2, SMOKER, MEDICARE_ENTLD_DT, SMOKER_DT, BILINGUALISM_CODE, HEALTH_CARE_NBR, HEALTH_CARE_STATE, GUARDIAN_CHE, MILITARY_STAT_GER, EXPCTD_MILITARY_DT, HR_RESPONSIBLE_ID, ENTRY_DT_FRA, MILIT_SITUATN_FRA, CPAMID, HONSEKI_JPN, MILITARY_STAT_ITA, MILITARY_TYPE_ITA, MILITARY_RANK_ITA, 92
  • 93. MILITARY_END_ITA, MILIT_SITUATN_ESP, SOC_SEC_AFF_DT, LANG_CD, YEARS_OF_EXP, APPLID, APP_DT, GVT_CRED_MIL_SVCE, GVT_MILITARY_COMP, GVT_MIL_GRADE, GVT_MIL_RESRVE_CAT, GVT_MIL_SEP_RET, GVT_MIL_SVCE_END, GVT_MIL_SVCE_START, GVT_MIL_VERIFY, GVT_PAR_NBR_LAST, GVT_UNIF_SVC_CTR, GVT_VET_PREF_APPT, GVT_VET_PREF_RIF, GVT_CHANGE_FLAG, GVT_DRAFT_STATUS, GVT_YR_ATTAINED, DISABLED_VET, DISABLED, ETHNIC_GROUP, GVT_DISABILITY_CD, GRADE, SAL_ADMIN_PLAN, GVT_CURR_AGCY_EMPL, GVT_CURR_FED_EMPL, GVT_HIGH_PAY_PLAN, GVT_HIGH_GRADE, GVT_PREV_AGCY_EMPL, GVT_PREV_FED_EMPL, GVT_SEP_INCENTIVE, GVT_SEP_INCENT_DT, GVT_TENURE, GVT_PAY_PLAN, BARG_UNIT, ALTER_EMPLID ) AS SELECT PER.EMPLID ,PER.PER_STATUS ,PDE.PER_TYPE ,A.COUNTRY_NM_FORMAT, A.NAME, A.NAME_INITIALS, A.NAME_PREFIX, A.NAME_SUFFIX, A.NAME_ROYAL_PREFIX, A.NAME_ROYAL_SUFFIX, A.NAME_TITLE, A.LAST_NAME_SRCH, A.FIRST_NAME_SRCH, A.LAST_NAME, A.FIRST_NAME, A.MIDDLE_NAME, A.SECOND_LAST_NAME, A.SECOND_LAST_SRCH, A.NAME_AC, A.PREF_FIRST_NAME, A.PARTNER_LAST_NAME, A.PARTNER_ROY_PREFIX, A.LAST_NAME_PREF_NLD ,PER.ORIG_HIRE_DT ,PDE.SEX ,PDE.AGE_STATUS ,PDE.MAR_STATUS ,PDE.MAR_STATUS_DT ,PER.BIRTHDATE ,PER.BIRTHPLACE ,PER.BIRTHCOUNTRY ,PER.BIRTHSTATE ,PER.DT_OF_DEATH ,PDE.HIGHEST_EDUC_LVL ,PDE.FT_STUDENT ,PER.HIGHLY_COMP_EMPL_P ,PER.HIGHLY_COMP_EMPL_C ,PDE.US_WORK_ELIGIBILTY, PDE.MILITARY_STATUS, PDE.CITIZEN_PROOF1, PDE.CITIZEN_PROOF2, PDE.SMOKER, PDE.MEDICARE_ENTLD_DT, PDE.SMOKER_DT ,PDE.BILINGUALISM_CODE, PDE.HEALTH_CARE_NBR, PDE.HEALTH_CARE_STATE ,PDE.GUARDIAN_CHE ,PDE.MILITARY_STAT_GER, PDE.EXPCTD_MILITARY_DT, PDE.HR_RESPONSIBLE_ID ,PDE.ENTRY_DT_FRA, PDE.MILIT_SITUATN_FRA, PDE.CPAMID ,PDE.HONSEKI_JPN ,PDE.MILITARY_STAT_ITA, PDE.MILITARY_TYPE_ITA, PDE.MILITARY_RANK_ITA, PDE.MILITARY_END_ITA ,PDE.MILIT_SITUATN_ESP, PDE.SOC_SEC_AFF_DT ,PDE.LANG_CD ,PDE.YEARS_OF_EXP ,PDE.APPLID ,PDE.APP_DT ,PDE.GVT_CRED_MIL_SVCE, PDE.GVT_MILITARY_COMP, PDE.GVT_MIL_GRADE, PDE.GVT_MIL_RESRVE_CAT, PDE.GVT_MIL_SEP_RET, PDE.GVT_MIL_SVCE_END, PDE.GVT_MIL_SVCE_START, PDE.GVT_MIL_VERIFY, PDE.GVT_PAR_NBR_LAST, PDE.GVT_UNIF_SVC_CTR, PDE.GVT_VET_PREF_APPT, PDE.GVT_VET_PREF_RIF, PDE.GVT_CHANGE_FLAG, PDE.GVT_DRAFT_STATUS, PDE.GVT_YR_ATTAINED, PDE.DISABLED_VET, PDE.DISABLED, PDE.ETHNIC_GROUP, PDE.GVT_DISABILITY_CD, PDE.GRADE, PDE.SAL_ADMIN_PLAN, PDE.GVT_CURR_AGCY_EMPL, PDE.GVT_CURR_FED_EMPL, PDE.GVT_HIGH_PAY_PLAN, PDE.GVT_HIGH_GRADE, PDE.GVT_PREV_AGCY_EMPL, PDE.GVT_PREV_FED_EMPL, PDE.GVT_SEP_INCENTIVE, PDE.GVT_SEP_INCENT_DT, PDE.GVT_TENURE, PDE.GVT_PAY_PLAN, PDE.BARG_UNIT ,PDE.ALTER_EMPLID FROM PS_PERSON PER , PS_PERS_DATA_EFFDT PDE , PS_NAMES A WHERE PER.EMPLID = A.EMPLID AND PER.EMPLID = PDE.EMPLID AND PDE.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_PERS_DATA_EFFDT B WHERE B.EMPLID = PDE.EMPLID AND ( B.EFFDT <= '2005-12-02' OR (B.EFFDT > '2005-12-02' AND '2005-12-02' < ( SELECT MIN(C.EFFDT) FROM PS_PERS_DATA_EFFDT C WHERE C.EMPLID = B.EMPLID) ) ) ) AND A.NAME_TYPE = 'PRI' AND A.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_NAMES B WHERE B.EMPLID = A.EMPLID AND B.NAME_TYPE = A.NAME_TYPE AND ( B.EFFDT <= '2005-12-02' OR (B.EFFDT > '2005-12-02' AND '2005-12-02' < ( SELECT MIN(C.EFFDT) FROM PS_NAMES C WHERE C.EMPLID = B.EMPLID AND C.NAME_TYPE = B.NAME_TYPE) ) )) --------------- 93
  • 94. CREATE VIEW PS_B_FAST_PERS_QRY ( EMPLID, ROWSECCLASS, ACCESS_CD ) AS SELECT DISTINCT A.EMPLID ,SEC.ROWSECCLASS ,SEC.ACCESS_CD FROM PS_PERSONAL_DT_FST A ,PS_JOB JOB ,PS_FAST_SCRTY_2 SEC WHERE A.EMPLID = JOB.EMPLID AND JOB.EFFDT= ( SELECT MAX(JOB2.EFFDT) FROM PS_JOB JOB2 WHERE JOB.EMPLID=JOB2.EMPLID AND JOB.EMPL_RCD=JOB2.EMPL_RCD AND JOB2.EFFDT<='2005-12-02') AND JOB.EFFSEQ= ( SELECT MAX(JOB3.EFFSEQ) FROM PS_JOB JOB3 WHERE JOB.EMPLID=JOB3.EMPLID AND JOB.EMPL_RCD=JOB3.EMPL_RCD AND JOB.EFFDT=JOB3.EFFDT ) AND JOB.DEPTID=SEC.DEPTID AND JOB.SETID_DEPT=SEC.SETID CREATE VIEW PS_PERSONAL_DTA_VW ( EMPLID, NAME ) AS SELECT EMPLID , NAME FROM PS_PERSON_NAME ---------------- CREATE VIEW PS_PERSONAL_DATA ( EMPLID, NAME ) AS SELECT A.EMPLID , A.NAME FROM PS_NAMES A WHERE A.NAME_TYPE = 'PRI' AND A.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_NAMES B WHERE B.EMPLID = A.EMPLID AND B.NAME_TYPE = A.NAME_TYPE AND ( B.EFFDT <= '2005-12-02' OR (B.EFFDT > '2005-12-02' AND '2005-12-02' < ( SELECT MIN(C.EFFDT) FROM PS_NAMES C WHERE C.EMPLID = B.EMPLID AND C.NAME_TYPE = B.NAME_TYPE) ) )) -------------- CREATE UNIQUE INDEX PS_JOB ON PS_JOB (EMPLID, EMPL_RCD, EFFDT, EFFSEQ) CREATE UNIQUE INDEX PS_PERSON ON PS_PERSON (EMPLID) CREATE UNIQUE INDEX PS_FAST_SCRTY_2 ON PS_FAST_SCRTY_2 (SETID, DEPTID, ROWSECCLASS) CREATE UNIQUE INDEX PS_PERS_DATA_EFFDT ON PS_PERS_DATA_EFFDT (EMPLID, EFFDT) CREATE UNIQUE INDEX PS_NAMES ON PS_NAMES (EMPLID, NAME_TYPE, EFFDT) CREATE UNIQUE INDEX PS_JOBCODE_TBL ON PS_JOBCODE_TBL (SETID, JOBCODE, EFFDT) CREATE UNIQUE INDEX PS_EMPLOYMENT ON PS_EMPLOYMENT (EMPLID, EMPL_RCD) 94
  • 95. CREATE UNIQUE INDEX PS_SAL_GRADE_TBL ON PS_SAL_GRADE_TBL (SETID, SAL_ADMIN_PLAN, GRADE, EFFDT) -------------------- select SETID, JOBCODE, EFFDT, DESCR, GVT_PAY_PLAN, GVT_OCC_SERIES, TRN_PROGRAM, COMPANY, GVT_FUNC_CLASS, GVT_POSN_TITLE_CD, GVT_OFFICIAL_DESCR, GVT_ORG_TTL_CD, GVT_ORG_TTL_DESCR, GVT_PAY_BASIS, GVT_SUB_AGENCY, GVT_POI, GVT_PAREN_TITLE, GVT_OPM_CERT_NBR, GVT_POSN_CLASS_STD, GVT_POSN_SENS_CD, GVT_IA_ACTIONS, GVT_EXEC_FIN_DISCL, GVT_EMP_FIN_INT, GVT_PATCOB_CD, GVT_CLS_STANDARD, GVT_CLASSIFIER_ID, GVT_DT_CLASSIFIED, BARG_UNIT, GVT_FUND_SOURCE, GVT_LEO_POSITION, GVT_PERF_PLAN, GVT_TARGET_GRADE, GVT_PI_UPD_IND, EFF_STATUS, DESCRSHORT, JOB_FUNCTION, SETID_SALARY, SAL_ADMIN_PLAN, GRADE, STEP, MANAGER_LEVEL, SURVEY_SALARY, SURVEY_JOB_CODE, UNION_CD, RETRO_RATE, RETRO_PERCENT, CURRENCY_CD, STD_HOURS, STD_HRS_FREQUENCY, COMP_FREQUENCY, WORKERS_COMP_CD, JOB_FAMILY, JOB_KNOWHOW_POINTS, JOB_ACCNTAB_POINTS, JOB_PROBSLV_POINTS, JOB_POINTS_TOTAL, JOB_KNOWHOW_PCT, JOB_ACCNTAB_PCT, JOB_PROBSLV_PCT, REG_TEMP, DIRECTLY_TIPPED, MED_CHKUP_REQ, 95
  • 96. FLSA_STATUS, EEO1CODE, EEO4CODE, EEO5CODE, EEO6CODE, EEO_JOB_GROUP, US_SOC_CD, IPEDSSCODE, CAN_PAYEQ_JOB_CLS, CAN_NOC_CD, SEASONAL, BPS_ACTIVITY_CD, FUNCTION_CD, BA_CD, TECHNICAL, MED_SURV_REQ, EMP_CATEGRY_FRA, ACTIVITY_TYPE_FRA, INSEE_CD_FRA, JOB_CTG_FRA_CD, UK_SOC_CD, ENCUMBER_INDC, POSN_MGMT_INDC, EG_ACADEMIC_RANK, EG_GROUP, HP_STATS_DUTIES, HP_STATS_RPT_FLAG, ENCUMB_SAL_OPTN, ENCUMB_SAL_AMT, INAIL_CODE, ASCO_CD_AUS, PKG_TEMPLATE_ID, PKG_RULE_ID, FUNCTION_AUS, ANN_CNTACT_HRS_AUS, TEACH_WEEKS_AUS, CASUAL_TYPE_AUS, WORK_DAY_HOURS, FA_PAY_PROGRAM, ELECTION_GROUP, LABOR_AGREEMENT, FP_PROF_CATG, FP_JOB_FMLY, FP_OFF_COLAG, FP_MATRIX_TYP, FP_MATRIX_CD, FP_BUSINESS_CD, FP_JOBCD_ACC, FP_ATCH_AREA, FP_JOB_TYP, FP_AUTO_RATFY, LAST_UPDATE_DATE, REG_REGION, SAL_RANGE_MIN_RATE, SAL_RANGE_MID_RATE, SAL_RANGE_MAX_RATE, SAL_RANGE_CURRENCY, SAL_RANGE_FREQ, JOB_PROFILE_ID, BEN_DEFN_PGM, RETIREMENT_SYSTEM, ERNCD from ps_jobcode_tbl ------------- --CASE 2 SELECT DISTINCT B.NAME, A.EMPLID, A.EMPL_RCD, A.EFFDT, A.EMPL_STATUS FROM PS_JOB A, PS_B_FAST_EMP_QRY A1, PS_PERSONAL_DTA_VW B, PS_B_FAST_PERS_QRY B1 WHERE A.EMPLID = A1.EMPLID AND A.EMPL_RCD = A1.EMPL_RCD 96
  • 97. AND A1.ROWSECCLASS = 'CPHR7030' AND B.EMPLID = B1.EMPLID AND B1.ROWSECCLASS = 'CPHR7030' AND ( A.EFFDT = (SELECT MAX(A_ED.EFFDT) FROM PS_JOB A_ED WHERE A.EMPLID = A_ED.EMPLID AND A.EMPL_RCD = A_ED.EMPL_RCD AND A_ED.EFFDT <= '2005-12-02') AND A.EFFSEQ = (SELECT MAX(A_ES.EFFSEQ) FROM PS_JOB A_ES WHERE A.EMPLID = A_ES.EMPLID AND A.EMPL_RCD = A_ES.EMPL_RCD AND A.EFFDT = A_ES.EFFDT) AND A.EMPLID = B.EMPLID ) ---CASE 3 -1 SELECT a.emplid FROM ps_job a, ps_b_fast_emp_qry a1, ps_jobcode_tbl b, ps_personal_data c, ps_sal_grade_tbl d, ps_employment e WHERE a.emplid = a1.emplid AND a.empl_rcd = a1.empl_rcd AND a1.rowsecclass = 'PPALL' AND e.emplid = a1.emplid AND e.empl_rcd = a1.empl_rcd AND a.effdt = (SELECT max(a_ed.effdt) FROM ps_job a_ed WHERE a.emplid = a_ed.emplid AND a.empl_rcd = a_ed.empl_rcd AND a_ed.effdt <= '2005-12-02') AND a.effseq =(SELECT max(a_es.effseq) FROM ps_job a_es WHERE a.emplid = a_es.emplid AND a.empl_rcd = a_es.empl_rcd AND a.effdt = a_es.effdt) AND a.setid_jobcode = b.setid AND b.jobcode = a.jobcode AND b.effdt = (SELECT max(b_ed.effdt) FROM ps_jobcode_tbl b_ed WHERE b.setid = b_ed.setid AND b.jobcode = b_ed.jobcode AND b_ed.effdt <= a.effdt) AND a.emplid = c.emplid AND d.effdt = (SELECT max(d_ed.effdt) FROM ps_sal_grade_tbl d_ed WHERE d.setid = d_ed.setid AND d.sal_admin_plan = d_ed.sal_admin_plan AND d.grade = d_ed.grade AND d_ed.effdt <= '2005-12-02') AND a.setid_salary = d.setid AND a.sal_admin_plan = d.sal_admin_plan AND a.grade = d.grade AND a.emplid = e.emplid AND a.empl_rcd = e.empl_rcd -2 SELECT a.emplid FROM ps_job a, ps_b_fast_emp_qry a1, ps_jobcode_tbl b, ps_personal_data c, ps_sal_grade_tbl d, ps_employment e WHERE a1.emplid = a.emplid AND a1.empl_rcd = a.empl_rcd AND 'PPALL' = a1.rowsecclass 97
  • 98. AND a1.emplid = e.emplid AND a1.empl_rcd = e.empl_rcd AND b.setid = a.setid_jobcode AND a.jobcode = b.jobcode AND c.emplid = a.emplid AND d.setid = a.setid_salary AND d.sal_admin_plan = a.sal_admin_plan AND d.grade = a.grade AND e.emplid = a.emplid AND e.empl_rcd = a.empl_rcd AND c.emplid = a1.emplid AND e.emplid = c.emplid AND b.effdt = (SELECT max(b_ed.effdt) FROM ps_jobcode_tbl b_ed WHERE b_ed.setid = b.setid AND b_ed.jobcode = b.jobcode AND a.effdt >= b_ed.effdt) AND d.effdt = (SELECT max(d_ed.effdt) FROM ps_sal_grade_tbl d_ed WHERE d_ed.setid = d.setid AND d_ed.sal_admin_plan = d.sal_admin_plan AND d_ed.grade = d.grade AND d_ed.effdt <= '2005-12-02') AND a.effdt =(SELECT max(a_ed.effdt) FROM ps_job a_ed WHERE a_ed.emplid = a1.emplid AND a_ed.empl_rcd = a.empl_rcd AND a_ed.effdt <= '2005-12-02') AND a.effseq =(SELECT max(a_es.effseq) FROM ps_job a_es WHERE a_es.emplid = a1.emplid AND a_es.empl_rcd = a.empl_rcd AND a_es.effdt = a.effdt) 98