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
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.