Just speaking to a colleague of mine. He was walking with a hop in his step, on the way to the coffee machine.
I asked him \"what\'s with the \'swarmy\' walk?\", he said
It's all about indexes. And avoiding stupid things that make them useless.
Splitting one ridiculously long stored procedure, which did a great deal of "if it's after 5 pm, return this bit of sql" and which took in excess of 20 seconds to run, into a set of stored procedures that were called by one controlling sp, and got the times down to subsecond responses.
Back in the day, I worked on a CICS/DB2 system, written in COBOL. A lot of our queries were doing full table scans (and slow) even though we had all the proper indexes and WHERE
clauses.
It turned out (and I may have this backwards, it's been 15 years) that the problem was that we were using PIC S9(n) COMP
in WORKING STORAGE
for the query parameters, but DB2 wanted PIC S9(n) COMP-3
. By using the wrong data type, DB2 had to do a full table scan in order to convert the values in the database to the value we were passing in. We changed our variable definitions and the queries were able to use the indexes now, which dramatically improved our performance.