DB2 is most common database in mainframe community. Developing DB2 applications is a challenging task.
There are many performance related things you may encounter while working on DB2 applications. Else, it is expensive for the projects, since it takes more CPU time.
I am just quoting Craig Mullen’s DB2 expert tips:
- Assuming an ORDER BY is not necessary for ordered results – if you want your results always to be returned in a specific order, you must include the ORDER BY clause. If you fail to do so, a future rebind can change the access path and also possibly change the order of your results set.
- Forgetting the NULL indicator – when your query can return a null, but sure to include a null indicator or you will get a -305 SQLCODE (22002 SQLSTATE). And be sure to check the null indicator to see if the data is null or not!
Read full article from here.