Categories
Rants SQL

Respect SQL!

I am by no means an SQL guru – there are many people far more skilled in SQL than I am. But I like to think I write well structured and clean SQL that is maintainable and performs well. Sadly, all to often I find poorly thought out SQL written in hard to read styles and with little respect for the language and it’s power.

SQL is not easy to write well but it is easy to write. Unfortunately, many developers think it is easy and place minimal emphasis on improving their skills beyond what they first learned. In the PeopleSoft market in particular, I have met many developers who are extremely skilled in (say) PeopleCode but all too often their SQL is poorly constructed. I’d describe it as “baby SQL”.

I’ll write a longer article with some tips and style guides for SQL at some point, but the message here is:

Respect SQL, Learn it, Embrace it’s strengths and it will reward you.

Categories
Administration Humour Oracle Peoplesoft PeopleTools Performance Tuning

A Conversation with a PeopleSoft “Developer” – Part 2

Another amusing conversation and somewhat shocking “discovery”.

More poor performing SQL – obviously missing any sort of suitable index (on Oracle).

Me (to developer): Could you add a suitable composite (multi-column) index to table PS_xxxx please for columns C,B and A – there seems to be frequent access using these three columns that would be vastly improved by adding an index.

Developer: OK.

After a few days I notice new “alternate search key” indexes in the DEV environment. One for each of the columns A, B and C.

Me: Did you add that index?

Developer: Yes, but in the testing I did it wasn’t very much faster.

Categories
Hints and Tips Peoplesoft PeopleTools PUM

psadmin.io

psadmin.io – well worth a visit. Great podcasts, discussions on DPK, the latest PeopleTools features and how to use them as well as more mundane PeopleSoft admin topics.

Recommended.

Categories
Humour Peoplesoft Performance

A Conversation with a PeopleSoft “Developer” – Part 1

A bit of amusement, but unfortunately based on actual conversations I have had with developers over the years.

This one started with me noticing some heavy logical I/O at the database level across various views. These originated from various user actions – search records on pages, “submit” buttons on approval pages and even scheduled queries.

A bit of investigation into each case always brought me to a single locally developed “workflow” table. It had the usual structure for a workflow/worklist table – had all the workflow key columns, followed by the “data” key columns. Every column in the table was flagged as a key column. It was instantly obvious that the developer did not understand the importance of indexes and possibly quite a few other things. Here’s the conversation:

Me: So, this worklist table PS_xxx_WL – you created that right?

Developer: Yes.

Me: And you developed all the approval pages, the PeopleCode and the search records that use this table?

Developer: Yes (starting to look a bit nervous).

Categories
Tuning Windows

TrustedInstaller.exe – Memory and CPU Hog!

What an obscene memory and CPU hog this can be. I’ve seen it grow to 3.2 Gb of RAM on one of my servers.

As it is used for Windows Updates, I stop the related Windows Services and mark them as manual to avoid this issue.

The services to stop/set to manual are:

“Windows Installer Modules Installer”
“Windows Update”

Sure, I have to manually update but I want that on my servers.

Categories
Java Languages Peoplesoft PeopleTools Tuning Weblogic

Weblogic Java VM Memory Parameters

When increasing the Java VM memory parameters for a PeopleSoft system under Weblogic (either in setEnv.cmd or manually by editing the cmdline registry entry if that’s your “thing”), be very careful not to increase the -XX:MaxPermSize memory allocation too much.

In fact I would leave it at 128MB or perhaps 256MB. Whatever you do, don’t update all three parameters in step, especially on a 32-bit Java, as you will hit Out of Memory errors on Weblogic startup way earlier than you expect. The MaxPermSize memory is allocated outside of the heap so the total memory you potentially need is more than you expect.

Categories
Hints and Tips SQL SQL Server

Another SQL Tip – A “DATES” Table

A common requirement is to generate a list of the dates between two dates e.g. on a source row we have a FROM and TO date but we need to expand that into a row for each date. One way to do that on SQL Server is via a CTE:
 

---
--- A generated list of dates from 01-01-2013 until 25-01-2054
--- This would be a useful utility view/table in any PS system
--- Table is preferred - CLUSTERED INDEX ON PROCESS_DT provides
--- Important statistics on distribution AND allows for a CLUSTERED INDEX SEEK
--- in execution plan.
---
 
WITH [PROCESS_DATES] AS (
 
SELECT TOP 15000 CAST(DATEADD(DAY,ROW_NUMBER() OVER ( ORDER BY RECNAME),CONVERT(DATE, '2012-12-31')) AS DATE) AS PROCESS_DT,
DATEPART(weekday,DATEADD(DAY,ROW_NUMBER() OVER ( ORDER BY RECNAME),CONVERT(DATE, '2012-12-31'))) AS PROCESS_DT_WEEKDAY
FROM PSRECFIELDDB --- ANY TABLE WITH A NUMBER OF ROWS >= THE TOP VALUE ABOVE WILL DO
 
)

That works fine, but as the comments above indicate, if you are going to do this it is better to generate the list of values into an table, Apart from anything else, why incur the CPU time recalculating this list every time it is accessed – better as a one-off table populate. Note the use of a table known to have more that 15000 rows – this could be any table – even sys.all_objects provided it has enough rows. But if you are generating rows as a one-off you could cartesian (star join) tables to themselves to get enough rows. The 15000 is arbitrary – you could go further ahead.

Categories
Hints and Tips SQL SQL Server

A SQL Tip .. In-Line UNION for previous “n” Months

Here’s an interesting requirement:

“A list of Business Units with the period (YYYYMM) and the monthname (e.g. October) against each one for the prior 3 months”.

A simple problem, but here’s my solution:

SELECT SETCNTRLVALUE AS [BUSINESS_UNIT] , 
CONVERT(VARCHAR(6),PREVIOUS_MONTHS.MYDATE,112) AS [YYYYMM],
DATENAME(MONTH,PREVIOUS_MONTHS.MYDATE) AS [MONTH_NAME]
FROM PS_SET_CNTRL_TBL S,
( SELECT DATEADD(MONTH,-1,GETDATE()) AS [MYDATE]
UNION ALL
SELECT DATEADD(MONTH,-2,GETDATE()) 
UNION ALL
SELECT DATEADD(MONTH,-3,GETDATE()) 
) PREVIOUS_MONTHS
ORDER BY 1,2

Of course, the in-line inner UNION ALL could be created as a view if it was going to be reused, but it suffices for this example. Key points to note:

  1. The use of UNION ALL to eliminate the SORT you get with UNION – we know the values are unique but the optimizer doesn’t (it probably should though)!
  2. Perform the bare functions on the date value (CONVERT,DATENAME) in the outer loop rather than create multiple columns in the in-line SQL.
  3. Yes this is a cartesian product but that is perfectly acceptable when you know your data.
  4. This example is for the prior 3 months with reference to GETDATE() – extending to prior “n” months and a different reference date is trivial. But be careful what table you use to get the reference date). Typically you might want the “n” prior months before (say) the MAX() date on some transactional table – if so make sure you have an index to make finding that value as quick as possible.
  5. This is SQL server syntax – on Oracle you would have to SELECT from DUAL etc.

Enjoy.

 

 

 

Categories
PeopleTools Performance Monitor

PPM Log Viewer in PeopleTools 8.55

In answer to my own question about whether you can search App Server logs using a RegEx, the answer is yes:

PPM_Logviewer

Nice. Note this is done via JMX and uses a Remote Administration user/password configuration within the application and process scheduler configuration files. The default values for the  user and password are “admin” and “password”. You probably want to change that! They are set in the [PSTOOLS] section of the psappsrv.cfg configuration file:

RemoteAdminSettings855

The JMX user administration settings to use the log viewer are a little unwieldy in my view as it needs setting once per agent identifier even though the settings are at the [PSTOOLS] level in the configuration files. One per domain would have sufficed I think, but then I suppose a lot of people don’t even change that from “TESTSERV”.

This functionality still lacks the searching across application servers I would like – which is why I will continue using nxlog on Windows to ship logs to an ELK stack. For now anyway.

There’s no doubt this is useful though just perhaps a little immature at this point.

 

Categories
Peoplesoft PeopleTools

PeopleTools 8.55 to 8.55.01

This is a fairly large patch – I count 475 bugs in the README. Applying the patch through Change Assistant proved problem free. Some manual DataMover steps are required.