Db2 User Group | November 2026

My All-Time Db2 Top Ten Lists

What do Db2 performance, application development, database administration, and David Letterman have in common? Top Ten lists, of course!

Join Db2 expert Craig S. Mullins for an entertaining and informative countdown through some of his all-time favorite Db2 Top Ten lists. Drawing on decades of hands-on experience, technical writing, and conference presentations, Craig shares practical insights, useful tips, and lessons learned across a wide range of Db2 topics.

This greatest-hits collection brings together updated audience favorites, insights adapted from Craig’s published articles, and brand-new lists making their debut. Whether you’re a developer, DBA, or longtime Db2 professional, you’ll walk away with valuable takeaways—and perhaps a few laughs along the way.

Recognized as Best User Presentation at the 2025 IDUG Db2 Tech Conference, this session combines technical expertise with a refreshing approach to learning about Db2.

Read the Transcription
[00:00:09] – Amanda Hendley
Welcome. My name is Amanda Hendley. You are here for the Virtual User Group. Today we’re talking Db2 with Craig Mullins. Thank you for joining us, Craig. Before we get started, why don’t we see if our chat works? If you want to drop your location and job title in chat, I’d love to see where everyone is from or based out of or where you’re working from today. I am north of Atlanta, Georgia, where we woke up today to 37 degrees Fahrenheit. Not, not my favorite thing. Craig, what about you this morning? What was your— Was it cold?

[00:00:53] – Craig Mullins
It was 40. So yes, cold.

[00:00:58] – Amanda Hendley
Yeah. Yeah. We were just talking about warm vacations over the holidays, and I’m very jealous of Craig’s plans. San Antonio, Texas. Awesome. Working remotely from Central Florida. Way to make us jealous, Mark. Way to make us jealous. You probably got 20 degrees on us. Well, thank you all for joining. Again, this is the Virtual Mainframe User Group, and we’re talking Db2. And my partner for today’s session is Data Kinetics. So I wanna thank them for their sponsorship of this series. And we’re always looking for partners and sponsors and speakers. So if any of those checkboxes for you, you can reach out to me at ahendley@planetmainframe.com. And in particular, if you have any sessions you’d like us a feature I’m working on our calendar for next year. I’d love to find out, you know, what’s going through your mind. What would you like to talk about next year for the user group series? And then, Craig, most people will drop questions into chat. How does that feel for you today?

[00:02:08] – Craig Mullins
Yeah, that’s fine. I probably won’t see them while I’m presenting, but We can take a look at them after I get through.

[00:02:20] – Amanda Hendley
Okay, I think that’s great. So you can drop them along the way or you can hold them till the end and we’ll make sure we get those questions answered for you. And I wanted to also do a shout out. So this month is Db2 Month over at Planet Mainframe and we’re publishing some content from Db2 and just featuring and some recent pieces that we’ve published. And then there’s also some Db2 trivia. So you can check that out at Planet Mainframe this month. We also have launched our 2027 Arcati Mainframe User Survey. So this is the basis for our Arcati report that we publish every February. So we’re looking for people to respond to the report. I will drop the survey link in chat today so that you can grab that, take the survey later after our call today. If you take it, you get a chance to make an early nomination for the Influential Mainframers. So would love to get your feedback. Really, it’s— this report is all about the users, so we wanna hear from you. And now I’m gonna stop my screen share so that Craig can pull his up. And if you haven’t met Craig Mullins, he is a president and principal consultant at Mullins Consulting and publisher and editor of the Database Site.

[00:03:49] – Amanda Hendley
He writes for journals and websites and is a frequent speaker. I just happened to see Craig a couple weeks ago here in Atlanta as he was speaking at IDUG. And he is a Gold Consultant and IBM Champion. So turning it over to you.

[00:04:11] – Craig Mullins
So this presentation is one that I gave at iDUG last year, not this year, last year in Atlanta. And it is, it was actually voted the top user presentation of the conference. So proud of that. But this is a variation of a presentation that I’ve been giving for a number of years wherein I deliver a lot of different lists on various different topics, giving me the opportunity to talk about lots of different Db2 things without really worrying about tying them together slide to slide. So just my way of having a Db2 potpourri. A little bit about me. I’m president and principal consultant of Mullins Consulting. Amanda gave my overview there, my website, mullinsconsulting.com. Some information on my books you can find at the website. Enough of that. So this is kind of what I envision things would be like if David Letterman were a DBA. We can discuss and different array of Db2-related things in each of these top 10 lists. You know, it’s basically a slide per list. So it’ll include updates to ones I’ve presented before, new ones, adaptations from articles I’ve written. So, you know, sort of where I stand today with the top 10 lists.

[00:05:48] – Craig Mullins
And I always like to start with this one, which is The top 10 SQL codes to memorize. First of all, not a big fan of memorizing much of anything because it’s much more important to memorize or know where to find the answer than it is to memorize all the arcane syntax and details. But just by virtue of you doing your job, there are certain things that are going to stick in your head and you’ll know or memorize, like, you know, number 1, a zero return code of +100, you know, it’s success or no more rows. Probably the next one is the 904. Everyone knows that resource unavailable. You got to dig down a little further to figure out, okay, just what resource are we talking about? And then you have to figure out why it’s unavailable. Another thing to mention, I’m not going to go over every last item on each list. So that’s an opportunity for you if I skip over something, you know, put a question in the chat. for me to, you know, go back and we can talk about it after the presentation if you’d like. A couple here that I do wanna mention, -101, that’s the least helpful SQL code of all time.

[00:07:02] – Craig Mullins
SQL statement too complex. Well, gee, thanks. Basically what happens when Db2 throws this code is that your statement is exceeding a system limit, maybe for length or complexity. So you have to, you know, do a little bit of digging. Yeah, why is this, is this really too long? Does it exceed a system limit? And, you know, maybe you’ve got too many parameter markers, or maybe this statement is too complex for parallelism, you know, multiple access paths required for each of the parallel opportunities there. So those are things to look at if you get the 101. Another one that can be a little bit difficult to debug Is the -104. Generally what that means is you’ve put some extraneous characters in your SQL statement, maybe an extra comma or period or parenthesis. What you need to do here is examine the complete query and you kind of look for those subtle syntax errors. And, you know, it can be time-consuming, especially you’ve got those multiple page queries. A couple others, you know, the deadlocker timeout. 911 is a deadlocker timeout with a rollback, whereas the 913 is without a rollback. You’ve got a SQL code here which tells you which of the ones it is.

[00:08:38] – Craig Mullins
You look in SQL error D3 for whether it’s a deadlock or whether it’s a timeout. You know, auth failure, you know, more than one row in a singleton select. You know, there’s, there’s an awful lot of these that we get and probably will memorize. They can differ from site to site. You know, another one that I see in some sites is a -501. Not on this slide, but I was just at a site where they were throwing thousands of these a day and they weren’t going to fix them because it’s fetching from or closing a closed cursor. So it was code issues. They were aware of it and it just happened. Okay, let’s move on. The top 10 Db2 12 features. These are the things that I think bubble up from the bottom as the most interesting or most useful features of Db2 12. We’ve all been using it for a while now. You know, at the top is, you know, continuous delivery. That’s changed the way in which we manage updates to Db2 code. Instead of waiting many, many years and then getting a monstrous new version, things are delivered via function levels. So continuously delivered over the lifespan of a version.

[00:10:17] – Craig Mullins
Some of the features other than continuous delivery, we get global variables. These are there for continuous delivery, these new global variables, so we can determine, you know, what is the version release function level, catalog level. By using these global variables, we can fetch this to understand what version, function level, etc. of Db2 is running. A lot of times you’re not going to want to really use those in your application programs, but maybe in your REXEXECs and your Db2-type DBA stuff you’re interested in that. Number 3, piecewise delete. This is one that I’ve had an opportunity to recommend at some sites where it’s like, You use the fetch first n rows only on a delete statement. Why would you do that? Maybe you’re doing a mass delete and it’s deleting millions of rows and you wind up exceeding your lock limits. So you get lock escalation. If you do the piecewise delete, fetch first 1,000 rows and then commit, and then go back and continue the delete until you’ve deleted everything. That piecewise delete can help you avoid getting those lock escalation and locking problems. Relative page numbering at number 4 is another big one. This is increasing the size of our tablespaces up to a terabyte per partition with a maximum size of up to 4 petabytes.

[00:12:08] – Craig Mullins
And why do I say this is a big one? Well, this is going to be the future for all universal tablespaces moving forward after we get to vNext. The old type of non-RPN tablespaces are going to be deprecated and we’ll have to be moving forward with relative page numbering. FTBs, important for improving index performance, keeping more the top levels of an index in memory. We get number 10. Let’s talk about number 10 a little. At function level 508, we get ALTER TABLESPACE MOVE TABLE, and that makes it easier to convert your old segmented and classic partitioned tablespaces by, you know, moving the table from one tablespace to another. Of course, the interesting thing there is that function level 5.04 deprecated segmented and classic partition tablespaces. So they got deprecated before the solution of altering and moving the table was implemented. Unless you use AppleCompat to go back to 5.04, you couldn’t drop and recreate a segmented or classic partition table in version 12 before 5.0.8. Okay. Version 13, which is the current version, which is where we all should be. Top of the list is SQL Data Insights that brings these AI functions. Into Db2.

[00:14:07] – Craig Mullins
The basic SQL Data Insights comes free with Db2 13. IBM has since introduced SQL Data Insights Pro, which is a paid extension of that. Interestingly enough, the future is kind of going to be SQL Data Insights Pro. I’m not sure how IBM is going to necessarily handle the old free implementations are going to make you pay for the new one or not. And that’s kind of an outstanding issue. But SQL Data Insights, great functionality, AI built into Db2 for your application programs to use. Another big one is the utility history. This gives you the capability of tracking all of the utilities that run. You know, it used to be That the only thing you really got was in Syscopy where you’d see the image copies that you’ve been taking. And there was some other stuff in there as well. But now the utility tables in the catalog show us all the utility executions, the IBM utilities. And also there’s an option for your third-party vendors, your Broadcoms, your BMCs, your Infotels. to be adding their utilities in there as well. So tracking it in the catalog, you know, really great stuff. 4 and 5, let’s talk about them for a minute, which is application-level control over locking.

[00:15:45] – Craig Mullins
And this is interesting but scary, in my opinion, as a DBA with application-specific lock timeout control. Before I move on, the other thing that you’ll notice is on a lot of these slides, I’ve got links to actual articles I’ve written on the entire topic. So, you know, I’ll make the slides available and Amanda can send them out to everybody. You don’t have to be jotting these URLs down, but I talk about it briefly. The articles that are referenced here talk about it in a little bit more depth. Okay, so this application-specific lock timeout control. You can set your current lock timeout at the application level, so that would override the DSN ZPARM parameters that control user-level locking. There’s also an application-specific deadlock detection parameter, so you can override the IRLM settings for your deadlock resolution. Both of those are, you know, if you’ve got Let’s say misbehaving programs that are, you know, locking an awful lot more than most of your other applications, you might consider setting these parameters. In my opinion, this should really only be as a last resort type of option. You’re much better off figuring out, okay, why am I taking so many locks that I want to change the lock timeout control?

[00:17:23] – Craig Mullins
Maybe You’d be better off adjusting the application’s behavior. And we’ll talk a little bit more about some of these things in ensuing top 10 lists about locks. We’ve got profile support added for number 4 and 5. We’ve improved FTBs where, you know, they’re with larger key lengths. They’ve doubled the key length for FTBs. So more and more functionality being added to FTBs that were introduced in version 12. The auto bind phase in, there’s the depth level statement package parameter. When the package with that would get invalidated, it gets rebound in the background so the user doesn’t have to wait for the bind to complete. And statements that were not invalidated continued to be executed. So we’re doing statement-level reintroduction of access paths for packages, only the ones that were the reason why things got invalidated. So it’s a nice way to phase in these statements while keeping the other stuff still running. Maybe you’ve got a section that does the bulk of the work and what got invalidated was a small statement over here that rarely gets run. Well, the program can continue to run until you fix the reason for the invalidation. Okay, sorry, inserting multiple rows using multiple values.

[00:19:09] – Craig Mullins
Quick slide showing this one. Not going to spend a lot of time on this. It’s just that you can have one insert statement with multiple values clauses. In the past, before this came about in version 13, you’d have to issue 3 separate insert statements, one for each of these values. Now you can have multiple values clause, making that insert statement a lot more functional in terms of how it’s coded. Okay, talked about version 12 and version 13. Let’s talk now about the history of Db2. Now, you know, I, I’ve worked with Db2 since version 1, so I’ve got to see all these things get introduced over time. And, and the, the things that I call most significant here are my opinion only. Your mileage may vary, but you’re probably not going to be wildly different if you’ve worked for Db2 quite as long as I have. And at the top is packages. For those of you who haven’t worked with a Db2 without packages, used to have to bind everything into a plan. So you’d wind up with this uber plan for CICS, for example, where every program got bound into this large plan. So instead of having multiple packages in the CICS plan, you’d have multiple a DBRM is bound directly into it.

[00:20:37] – Craig Mullins
And whenever you had to make a change, the uber plan went— was out, right? So you’d have a CICS outage. As of version 2.3, not an issue. Data sharing, next big thing from in terms of availability. Data sharing was a significant functionality gain for Db2 when it was introduced in version 4, and it makes Db2 one of the most highly available systems out there on the planet. You know, Db2 for z/OS running on z with parallel Sysplex and data sharing. RI came about in version 2.3 as well. And, you know, before that, there was no referential integrity at all. You had to put it into your application program. Some people still do that. We’ll talk about that in a few slides too. Again, not going to talk about all these, but I do want to talk about number 10 on this list, date and time data types. This came about in version 1.3, and prior to that, there were no date and time data types. Unfortunately, I still see people writing systems or maintaining systems that put dates and times into character columns. You know, they have character 6, character 8 columns, and they shove a date into it.

[00:22:03] – Craig Mullins
I invariably get people who send me questions that say, I’ve got the date, it looks like this, I need to manipulate it to make sure this is a valid date or to do some date and time arithmetic on it. What should I do? And I’ve got this boilerplate that says, yeah, you shouldn’t have done that. You should use date and time data types and then give them some help. But the basic piece of guidance here is if it’s a date, if it’s a time, use date and time data types. Timestamps, times, dates, they’re your friends. Db2 will only allow valid datetime and timestamps. If you use those data types, you won’t have to do the checking yourself. Top 10 common SQL mistakes. People still sometimes assume that if the results come back in the order they want, then they don’t need to use an ORDER BY. And that generally happens when Db2 uses an index that forces the order to be what the requester wanted in the first place. Of course, that doesn’t mean it’s always going to come back in that order. If the access path changes, if it’s static and gets rebound, or if it’s dynamic, it could change whenever.

[00:23:30] – Craig Mullins
If the order is important, you must code an ORDER BY to verify and make sure that the results come in the order you want. Forgetting a null indicator, another issue. If it could be null, that is, that the column is nullable, then you need to code a null indicator in your program, or you could get the negative SQL code telling you that The result’s null, but you don’t have an indicator. The other thing is certain functions can return a null. You know, maybe you’re saying select sum of salary for employees in department 10, but there are no employees in department 10. A lot of people assume that the sum of that is 0, but the sum of that is null. So you need a null indicator on some of those functions like that as well. Let’s see, if you’ve got a multi-row result set, you got to code a cursor. Sometimes people recompile and don’t rebind. Selecting from a closed or an open cursor, I kind of mentioned that earlier. There are some people who kind of think, well, that’s just the way it’s coded. I’m not going to fix it, but I see that frequently.

[00:24:54] – Craig Mullins
Asking for more data than you need. This is sometimes referred to as the SELECT asterisk problem, and I’ve got a slide here giving an example of what I mean. What’s wrong with this SQL? At first blush, you look at it and it’s like, well, you know, no, I don’t see anything really wrong with it. I’m requesting employee information. I want only people with job code A in the MIS department, but From a performance perspective, why are we selecting job code when we’re saying where job code equals A? We know these are always going to be A. Likewise, why am I selecting department? I know they’re all going to be MIS. So what’s wrong with this is it’s going to work. It’s not that there’s a syntax problem. The problem is that I’m asking for more data than I need. I know A, I know MIS. Every column that you request for Db2 to return is going to add a little bit of overhead to it. And if you run this once, okay, no big deal. It’s not that much overhead. You run it 1,000 times, you run it 100,000 times, you run it a million times, and that adds up.

[00:26:15] – Craig Mullins
So everything you can shave off can save yourself some performance. This one, overall tips to ensure efficient Db2 performance. It’s here mostly to point you to this article on my Db2 blog, my top 10 Db2 performance posts. This article, this particular post points to 10 other posts on this blog, each one covering one of these blue boxes. And each of these blue boxes are my high-level guidance in terms of what you should do to make sure that Db2 is efficient as it can be. You know, starting with your execution plans, look at the queries, look at the access paths, making sure you’re designing your database appropriately, making sure that you’re building indexes effectively. And I’ve got a slide on, you know, what you should do to do this coming up. So I’m not going to spend much time here. But, you know, memory and workload optimization, what metrics you should be looking at, your configuration parameters, your zPARMs, optimizing I/O, and then things like your regular maintenance and housekeeping and staying up to date. You know, all these 10 things together taken as a whole can be used to make sure that we’re optimizing and making Db2 as efficient as it can be.

[00:27:54] – Craig Mullins
Some general rules of thumb. These are observations that I’ve come up with over time that you really should embrace in terms of managing, programming, using Db2. And at the top of the list is almost never say always or never. And even that little rule of thumb doesn’t say always or never. It’s almost never say always or never. There are very few things that are always this or never that. You can almost always think of a— loophole or a caveat in terms of, you know, here’s a general Db2 guideline that we implement in our shop. Well, if someone comes to you as a DBA, or if you’re a developer and you think you have something that goes around one of those guidelines, you know, sit down, discuss it. There may be a valid reason for going against a rule that Is written. So, you know, another way of saying it is don’t write the rule in stone. You know, don’t panic. Saying remain calm, don’t rush the solutions. You know, so, you know, for example, oh, I’ve seen this problem before. All I have to do is add an index like before. And, and well, that might not be exactly the same situation.

[00:29:22] – Craig Mullins
Take the time, learn what it is that you’re doing. You know, nowhere to look greater than memorizing. We talked about that. It depends. You know, it depends is true, but not always helpful. I’ll talk more about that in a little bit of a few slides away. Tuning. Tuning is iterative. It’s like it should be, you know, make a change, test, see if it made any difference. If it didn’t, back it out, make another change, test. So we’re constantly looping through things. What you don’t want to be doing is You make 3, 4, 5, 6 changes and then test because some of them may have helped, some of them may have hurt. So it’s make a change, test, see if it helped, make another change, test, see if it helps. It’s iterative. You know, remember the 80/20 rule? 80% of the problems caused by 20% of the people, or, you know, it’s 80% of the benefit comes from 20% of the administration or changes that you’re doing. You don’t want to be boiling the ocean is another way of saying that. All tuning, all tuning optimizes at least one of those 3 things: CPU, I/O, and concurrency.

[00:30:42] – Craig Mullins
You want to be decreasing CPU, decreasing I/O, and increasing concurrency. If we’re making a change and it’s not doing one of those 3 things, okay, it’s a change, but It’s not really going to impact your performance from an optimization perspective. Know the difference between importance and frequency. And again, we’ll discuss this more on the next slide. The— there are nuances you need to keep in mind and be careful of standards. That goes back up to the issue where it’s almost never say always or never and always be learning. That is the most important thing from a Db2 perspective, whether you’re a Db2 DBA or a programmer. There’s always new things to learn. Okay. From a DBA perspective, what are the most important tasks that a DBA does? And here’s where I want to talk about making sure you don’t confuse frequency with importance. There are probably things on this list that are much more frequent in terms of the things that you do, you know, in terms of, you know, maybe it’s managing performance or troubleshooting issues. But at the top are the things that impact accuracy, data integrity, making sure that it’s the right data.

[00:32:15] – Craig Mullins
Making sure that we’ve done things to keep the data correct. I mean, anybody can provide quick access to the wrong data or to no data, right? So the integrity of the data and the accuracy of it should be the number one most important thing DBAs do. Next is availability. The system needs to be up. Db2 needs to be available. You need to be able to have access to that data. I’d much rather have slow availability than spending all my time tuning, but then the system is down. And even though things would work fast if they were up, they aren’t up. Again, backup and recovery, same type of a thing. We want to have our data backed up and recoverable so that if we run into issues, we can make the data available again and that the data that is available is accurate. You know, and then we get into, you know, your typical DBA type things of performance and change management and maintaining the DBMS and troubleshooting. And the one I skipped over, security and data protection. Yes, that’s an important thing for DBAs to get involved with. More and more, that’s not necessarily a task given to the DBAs.

[00:33:37] – Craig Mullins
It’s more of a task given to a security group. And some organizations even offload security outside of Db2 into an ACF2 or a RACF type of a product. And then that’s perfectly fine in this day and age. Okay, let’s move on to the next list. We talked about the most important DBA things. What about the most important development tactics? And when I say development tactics, I mean from a Db2 perspective. And number one is coding relationally, relationally. And that means unlearning the flat file mentality. You have to understand how relational database systems work and write your SQL appropriately. So unlearn those past practices like master file processing. Now, this is where, you know, we open up one file, we read a record, we use that to drive a read to another file. Yes, for flat files, that’s the way you do things. Unfortunately, people come from that background and they say, okay, let’s open up a cursor, do a fetch, use that to drive another cursor. You shouldn’t be doing that. You should be coding joins instead. Code relationally, unlearn the flat file mentality. Minimize data accesses, the number of passes through the same data, minimize the number of calls across the network.

[00:35:06] – Craig Mullins
The fewer times you access the same data, the more efficient things are going to be. You know, put, put your work in the SQL, not into the program. That’s sort of a corollary to coding relationally. You want to let SQL do the work. Let Db2 optimize the access. Generally is going to work out better than trying to optimize things yourself by breaking them apart and saying, oh, I can code it better. In Java or COBOL or whatever language you’re using. And minimize the amount of coding you do by taking advantage of Db2 features like functions. And we talked about dates and times, and you don’t have to code date routines or call date routines that make sure that it’s a valid date. We’re going to talk about indexes a little bit more coming up. Sequential versus random access, you know, understand the difference between the two. Sequential accesses multiple rows one after the other, whereas random gets in, gets a value, gets out. And there’s different ways of optimizing your programs and optimizing your SQL and optimizing the Db2 system. That’s more of a DBA-type job. for both of those types of processing. Always check your SQL code, code for concurrency, understand Db2 locking, know what that means in terms of making a change to a program.

[00:36:41] – Craig Mullins
Db2 has to— a piece of data, Db2 has to lock it to make sure no one else is making a change to the same piece of data at the same time. Which brings us to number 10, and that’s avoid bachelor programming syndrome. What’s that? It’s fear of committing. Concurrency issues like lock escalation and lock timeouts are, are frequently caused by bachelor programming syndrome, not coding commits. We should, after so many inserts, updates, deletes, issue a commit, free up the locks, and, and move on. You need to plan and implement a commit strategy for all of your application programs, or you’re going to be experiencing timeouts and lock escalations. A lot of times organizations have a standard whereby they have it parameter-driven, so it will read the commit duration. So after 1,000 updates, after 100 updates, after 10 updates, you could modify it, and you don’t have to rebind because we’re changing the parameter when we run the batch program. So, you know, there are also products that help you to control that as well. But, you know, avoid bachelor programming syndrome. Oops. That is a very important thing to keep in mind. And there’s an article I wrote on this as well, which don’t— no, I don’t have the link up here, but it is in the notes.

[00:38:29] – Craig Mullins
So you can find that. Okay, most common Db2 problems in my humble opinion. And number 1 is and always shall be PEBCAC, problem exists between chair and keyboard, user error. You know, we’re doing things the wrong way. We didn’t look up the right syntax. Something we’ve done is causing the problem, whether it’s poorly coded SQL, improper indexing, runstats not up to date, bachelor programming syndrome, which we just talked about, bad programming design. Maybe we need a reorg. All these things are potentially causing issues and they’re user errors. Improperly defined buffer pools may be causing us a problem as well. From a programmer perspective, copied code syndrome. That’s where, well, I copied this from another program and it works there. Why isn’t it working here? Where maybe you don’t understand everything that you copied. Maybe there’s a different reason for it to be coded that way in the other program. Anytime you copy code, and I’m not saying don’t do it, I’m saying when you copy code, make sure you understand every last thing that piece of code is doing before you insert it into your application, or it’s going to potentially cause a problem. Okay.

[00:39:47] – Craig Mullins
I mentioned indexing several times and said I’d talk about it later, and here’s where I do that. These are the top 10 steps to proper indexing, and it’s all based on this article here. It’s a DBA Corner column that I write for Database Trends and Application. At the top is indexed by workload, not by object. And many people make the mistake of, you know, they just guess at some indexes that they’re creating when they’re creating tables. You know, no idea how the table is going to be accessed. But, you know, a lot of times these guesses are just wrong, at least some of them. You know what I’m talking about? You know, create a table, create 3 indexes, create another table, create these 4 indexes, and you’re doing it without having any guide to what SQL is being written. But indexes need to be built to optimize access of your queries and to properly create an optimal set of indexes. You’re really going to need to have the list of the SQL statements that are going to be used and run. You need an estimate of the frequency for each of those statements, you know, how often it’s going to be executed.

[00:40:59] – Craig Mullins
Maybe you got— this one’s running once, this one’s running 1,000 times. We’re going to really favor that one that’s running 1,000 times because it’s probably going to be more impactful to index that. And importance, you need to know how important things are. You know, this one is run by the CEO, so it’s very important. Whereas this one is, you know, just run for an analysis or analytics. If you’re doing it really any other way, you’re just simply doing it wrong. You know, then there’s additional considerations to keep in mind. You can index to avoid sorting. Look at your group bys and order bys. You have to index for uniqueness. The only way to make a value or set of values unique is with an index. This is for primary key and unique constraints. You can create indexes for foreign keys, not required, but a good idea from a performance perspective. You consider adding columns for index-only access. I got an example of that coming up in a second, but I want to touch on 9 and 10. Don’t arbitrarily limit the number of indexes. In the old days, there used to be these Db2 standards that would say no more than 3 indexes per table or no more than 5 indexes per table.

[00:42:21] – Craig Mullins
The best index guidance right now should be index till it hurts. Just keep creating indexes that are optimizing access until such time as maybe you see problems with your modifications, because every index is going to be built hopefully to optimize selects, but it will degrade potentially your updates and definitely your deletes and your inserts, because deletes and inserts are also going to be made to the index as well as to the data updates. Might be if it’s the same columns. Do you have any unused indexes? That’s available out in the real-time stats column, last used. We have that available these days. Use it. If the index isn’t being used, hasn’t been used for years, drop it. Okay. Index-only example real quick. Here’s a select statement. It’s accessing department name by department number D01. One index exists, if it’s on department number, it’s probably going to use that index because they have to go to the department table to get the department name because only department number is in the index. You could encourage index-only access by adding department name to that index. So department number, department name. I’m not saying always do this. This is something you can keep in mind to optimize particularly thorny access issues.

[00:43:53] – Craig Mullins
Okay, some of the things I commonly find invariably when I go into a new site, and it might just be the sites that I get called into because usually I get called in for performance issues, I’ll find lock escalation and locking issues. These are things that generally are going to be fixed with issuing commits and writing programs more impactfully, understanding concurrency issues. I see RID failures quite a bit, and sometimes that requires rebinding. We haven’t run runstats appropriately, outdated runstats, getting RID failures. Updating runstats, rebinding sometimes can get rid of those RID failures. Outdated zparm values. Sometimes values are just moved from release to release without really reviewing the changes or lack of changes that really need to be made. And yeah, there’s a lot of zparms and it can get confusing. So, you know, what is your sort pool size? Have you changed it anytime recently? What about outbuf? The default value for the outbuf increased from 4,000K to 102,000K in Db2 13, and the maximum is 400,000K. So, you know, one of the things that I always tell people is, you know, look at that value. If you haven’t moved it up from 4,000, move it up to at least the default.

[00:45:32] – Craig Mullins
And if you don’t have real storage issues, All the way up to 400,000, this can improve write efficiency and reduce the wait for log write I/O time. You know, these are things that looking at your ZPARM values, it makes a lot of sense. And other things, you know, working in the past, unaware of new features that dovetails into the ZPARM thing. We’ve talked about declarative RI. Fear of change is just another issue that some organizations have. I think they, you know, we move from version to version, we’re going to make as few changes as possible. We don’t really want to get in and monkey around with things. And, you know, that’s understandable. But understanding why the changes are recommended makes a lot of sense as you move from version to version. So, you know, understand it. If you can avoid the change and then things are still going to work fine, great. But if not, don’t be afraid of that change. It can help sometimes significantly. What are some of the physical database design mistakes that I see? You know, relying on the defaults. And I’m not talking about create table column not null with default.

[00:46:51] – Craig Mullins
That’s fine. You know, that’s a different type of a default issue. I’m talking about not coding all the parameters and just letting it default to whatever the default chosen by IBM is. And you’re much better off, even if you want to use that default value, explicitly code the parameter and that value. That makes it much easier for people in the future to see, all right, that value was actually chosen and wasn’t a default. Even if it was a default, we specifically chose it. Understanding increases if you need to go in and actually figure out what this parameter is asking me to choose and making a choice instead of just letting it, you know, fly. Not basing the physical on a logical model. Every physical database design should start off with a logical model. And move to physical. However, over-relying on a logical model is a problem too. That’s what I call the dread disease of Erwinitis. That’s where, you know, whatever design tool says, we just press a button and let it go. But, you know, there are things that are not in the logical model, things that you need to add or modify, like, you know, clustering choice and storage requirements and free space and You know, these aren’t logical issues, they’re physical issues.

[00:48:23] – Craig Mullins
And we need to make those decisions and not just let them default. Clustering choice. You know, clustering is generally best for data that’s accessed frequently together. But, you know, frequently people just say, okay, primary key index is going to be the clustering index. And, you know, maybe that’s fine if you’re going to access multiple rows in order by the primary key. But that’s, that’s not necessarily all that common. It’s common for a primary key to be accessed randomly. You get in, get the value, get out. Maybe it’s better to cluster by names or products that’s frequently accessed sequentially. Remember earlier I said understand the difference between random and sequential. The foreign key is probably in general without a lot of additional hunting around for how it’s today is being used, favor the foreign key over the primary key because it’s usually on the end of one-to-many relationship. In that one-to-many, you’re accessing multiple, grouping them together, grab them all at once instead of going through multiple places in the table to get them is going to be more efficient. Failure to share data. Okay, I’m not talking about data sharing, I’m talking about sharing data.

[00:49:43] – Craig Mullins
So one of the biggest CPU consumption issues these days is moving data and copying it all over the place. You know, how many different tables and files do you have for product information? You know, you get a new system, make a new copy, even if the data already exists. You know, database management systems in general, not just Db2, were really built to optimize sharing data among multiple systems. So, you know, do that. misunderstandings. At the top is, you know, there’s a problem with Db2. DBAs are used to hearing this. People come running into their office, there’s a problem with Db2. And, you know, they rarely come in saying the more accurate thing is there’s a problem with this crappy code I wrote. It’s usually not a problem with Db2. It’s usually a problem with the way that you’re accessing it. How about number 3? Db2 is a database. No, it isn’t. Db2 is a database management system, and it’s used to create databases. Same with Oracle, same with SQL Server. They’re not databases, they’re database management systems. Let’s see. There’s a lingering perception that running Db2 is prohibitively expensive. And, you know, it can be costly, but, you know, compared against what you replace it with, always remember that Db2 for z/OS is providing unparalleled scalability, reliability, and efficiency per transaction.

[00:51:23] – Craig Mullins
So even though it’s expensive, it is probably less expensive than the alternate. Let’s move on here. The top 10 most underutilized features of Db2. Table expressions, case statements, profile tables. You know, some of these aren’t even that new. They just are things that people don’t necessarily understand and embrace all the new features that come in with the new version of Db2 and they do things the old ways. You know, common and nested table expressions can be very powerful. It’s basically select from a select. You know, recursive SQL has been there for a while now. IDAA, not really a Db2 feature, it’s an add-on product, but it is incredibly efficient for analytical type queries. And if you’re doing a lot of analytical processing, you’d be shocked at how effective and efficient IDAA, the Db2 Analytics Accelerator, can be. You know, number 10, EXPLAIN by developers. DBAs use EXPLAIN for optimizing performance. We really need to get it normalized for developers using EXPLAIN and understanding that so they can optimize as they develop instead of waiting till things get moved over and the DBA is looking. At the explains. On the other hand, the most overutilized features of Db2, all 10 with UR.

[00:53:06] – Craig Mullins
This is one of my pet peeves. And again, here’s an article explaining everything about why. But to summarize that, UR or dirty read, when you do that, transactions can select all the change data even if it hasn’t been committed yet. Why do people put this on their code? Well, if it doesn’t have to wait for a lock and it just reads the data, whatever state it happens to be in, it’s going to execute faster potentially than if it had to wait for locks to be taken and wait for resources to be freed. But— and this is fine in test, it might be fine for an analytical query, it’s not fine for production work. And a lot of times I see production programs WITH UR, and it’s like, how is this not causing all kinds of data issues for the organization? And the answer is, it is. It’s just not something that they’re aware of. When you’re using WITH UR, it can cause duplicate rows to be returned even where none exist, or it can cause no rows to be returned when one or more actually exist. So when you’re doing this, You know, if my bank was doing banking with WITH UR, I immediately would have to find a new bank because you can’t trust the data when WITH UR is used to access data in programs from Db2 in production.

[00:54:41] – Craig Mullins
So use caution before putting WITH UR and don’t put it on everything like a lot of organizations do. Myths that with UR is probably one of the biggest myths. Say it’s going to improve performance and not cause problems. But, you know, there’s a lot of other myths. Again, got an article about it. Locking problems are a database issue. No, they’re not. They’re an application issue. Generally, you’re not issuing commits or you’re accessing data in different patterns and different programs. We talked about primary key for clustering. Black boxes. Talk a little bit about a black box. What a black box is, is where someone says, we don’t want to write SQL in our programs. Instead, we want to have a black box that runs all the SQL. And everyone calls the black box instead of writing SQL. Well, what we do with that is build suboptimal performance right into the system by design. Number one, all the calls to the black box are superfluous. We wouldn’t be doing that if we built SQL right into our applications. All the code in the black box getting to the right piece of SQL is superfluous, wasted CPU overhead.

[00:55:58] – Craig Mullins
On top of that, we’re going to take shortcuts. What do I mean? All right, say we’ve got 3 different teams. They all want customer information. This team wants 3 columns. This team wants 10 columns. This team wants all 25 columns. Everything else about the query is the same. This team who’s writing the black box, a lot of times they’ll take shortcuts and they’ll say, all right, why write 3 queries? Write 1 returning all 25 columns. Give these guys the 3 they want, these guys the 10 they want, and these guys all 25. What you just did was avoid coding efficient SQL like I talked about before. You’re asking for too much data, more columns than you need. If you only need 3 and you’re bringing back 25, that’s 22 additional columns adding overhead to the system. So avoid black boxes. Generally not a good idea. Outdated standards. Any standard that uses the word always or never, we talked about that. Limiting indexes, we talked about that one too. Arcane table naming standards. I’ve seen standards where it’s like You know, the table shall start with the T and then it will have an application identifier, maybe XR and then a number.

[00:57:14] – Craig Mullins
No. Who knows what’s in TXR0031? I know what’s in product. I know what’s in customer. Name the tables appropriately. Avoiding row-level locking, not a good idea. Row-level locking in some cases makes an awful lot of sense. Any standard that says avoid this, always that, These are generally bad standards. Top 10 steps to being a successful DBA. Again, got an article out there. You know, these are, you know, write things down, keep everything. There’s going to come a time when you need it. Automate as much as you can. Share your knowledge, but focus your efforts. Don’t panic. I actually had a button that said don’t panic when I was a DBA many years ago. And when I left, I bequeathed it to the DBA who came after me. And I talked to him a year or so ago and he still has that button. Good on him. You know, measure twice, cut once. Make sure you know what you’re doing before you do it. Understand the business, not just the technology. Why are we doing this? Why is the business needing to do this? Don’t be a hermit. Get out. Be known. The curmudgeon in the corner is no longer the way to be a DBA.

[00:58:26] – Craig Mullins
And then use all the resources at your disposal, you know, people, places, and things. Before you visit the DBA as a developer, make sure you’re not wasting the DBA’s time. Try to figure it out yourself first, please. You know, research the issue. You know, RTFM, which stands for read the friendly manual. Make sure that you know what it is you’re asking about and maybe solve the problem before you even get to the DBA. You know, always say please and thank you. Some things to avoid. Don’t say IBM said it should work this way. IBM is a company and it does not talk. So you can say, maybe Anthony Chiabattoni at IBM, as part of his health check, told me to do this. You know, what do you think of this issue? That’s fine. But not, well, IBM said I should do it this way. That isn’t helpful to a DBA. Programmers make excuses too. Again, something wrong with Db2. We talked about that one, copying code. Never say, well, it worked yesterday. Today is another day. And don’t tell me nothing’s changed when something has changed. Can do it better in COBOL or Java or whatever than in SQL.

[00:59:48] – Craig Mullins
No, you generally can’t. Or it works that way in Oracle or Postgres or MySQL. It doesn’t matter. We’re using Db2. The other one that is always fun is, isn’t there something you can do to make it work better? You know, a lot of times this is, you know, the things you hear when you tell people they got to issue commits in their programs. Wasn’t there something you can do? No. If the DBA is telling you to do something, generally There’s not an easy fix that they could take care of. Of course, DBAs make excuses. You know, the it depends that, you know, we talked about. It may depend. But if your DBA tells you, you come to them with a problem and say it depends, and they turn around, just slap them in the head. I mean, that’s not an answer. It depends. Okay, it depends on what? Tell me what it depends on. Then it’s fine. Are standards relying on standards or because I’m the DBA, that’s why? It all boils down to making sure that you’re an effective communicator and communicating what it is that you’re trying to do. This one slide is adapted from my IDUG 2022 presentation, which was called Things Your DBAs Hear that make them crazy.

[01:01:15] – Craig Mullins
These are things you should never just say to your DBA. You know, number one, hello. This is from my experience at sites where I, you know, helped out DBA teams and they have Slack and the developers have access to the DBAs to ask them questions over Slack. The most irritating thing in the world is just Just a note from someone that says hello, and you know they have a question and they want to make an answer to you and your time is short. Get to the point. You can say hello and then tell you what you want, but don’t just say hello. Again, something wrong with Db2. How about, is there locking going on in the system? I can tell you the answer to that. It’s always yes. There’s always locking going on in the system. Tell me what the issue is. What is your problem and why are you asking that? Do you know where the backups are stored? That’s something that’ll make the hair on the back of your neck go up. You know, why are you asking me that? You know, are you busy? Yes, I’m always busy. What do you want?

[01:02:19] – Craig Mullins
You know, these things that you don’t want to do to annoy that DBA. And number 10, beating around the bush. I got an example here of this. Okay, well, this query is been running quickly every day since we built it, and it’s been around for a while now. And but when I run it today, it runs for a long time and then it times out. What did you do? Oh, what did I do? Okay, calm down. Well, did, did you change anything about the query at all recently? No, I don’t think so. What about the data? Is there more of it? Well, it could be. Wait a minute. Well, we recommended— I mean, I’m sorry, we commented out one of the WHERE clauses. But the query is exactly the same other than that. Okay, well, which WHERE clause? Oh, the one for products. Okay, so, so you’re running the query for every product in the company? Yeah. Could that make this query run slower? You mean accessing 6 million products instead of one? Don’t beat around the bush. That’s an actual paraphrased conversation I actually had at a site a couple of years ago. Rules of the road for DBAs.

[01:03:38] – Craig Mullins
This is taken from a zJournal article I wrote several years ago. Kind of talked about some of these already, you know, writing things down and keeping everything and automating, you know, keeping up to date. Very important. Let’s move on. This is kind of a duplicate of one we talked about already. The database management commandments, another article adaptation. And these are the 10 things as a DBA you need to do to make sure— and as a developer, you need to make sure you’re doing to keep your database running effectively. You’re designing databases from a logical model. We’re always documenting. Data integrity is always the most important thing. We must ensure security, encrypting personal and sensitive information, implement security in the database and between the DBMS and the operating system. We want to maintain the recoverability of our databases, making sure we have the right backups and that we’ve tested the backups. We want to make sure that we have a workflow process for database change that’s effective and doesn’t bring things down. We should always make sure we’re thinking about the performance of transactions and data availability as we design our databases. We make sure that we work with the application developers to ensure we’re writing code effectively to access databases, including things like putting commits in and making sure that we have understood the regulations that impact our organization And that we’re building databases and applications in compliance with them.

[01:05:24] – Craig Mullins
The biggest trends in the industry these days: AI, cloud. Obviously, those are probably the two biggest. But you know, number three, cloud repatriation. What we’re seeing is some of the stuff that went to the cloud coming back, and the the days of cloud. Exuberance are over. And this is where people said everything is going to move to the cloud. Well, as soon as I hear the word everything, my BS radar goes off. Everything was never going to move to the cloud. Almost never say always or never. There I’m saying never. So some of the things that we moved that shouldn’t have are coming back. We’ve got multiple types of DBMSs, NoSQL, vector databases to support AI. So this polyglot persistence where we don’t have just one DBMS, we’ve got more, usually multiple relational, maybe several NoSQL, also a vector database. Big data, still a thing even though we don’t call it that. Basically, we call it analytics these days. More and more done in-memory, more and more done DevOps where we’re making change quicker, integrating it into the development process instead of, you know, the old waterfall methodology. And, you know, the DBA role is changing.

[01:06:51] – Craig Mullins
It’s being more strategic instead of heads down and understanding all the bits and bytes. Still need to do that, but need more strategy and business knowledge as well. Changes impacting Db2 change management. This one slide is again adapted from an earlier Db2 presentation I made on managing change in Db2 for z/OS. More and more DevOps and treating database objects like application code is happening. It was again one of these irrational exuberance things where we thought— well, not all of us, but some people thought that database objects could be treated like application code. They can’t for many reasons, but more frequent changes are being migrated to production, and that’s due to this agile DevOps embrace that people are instituting in their organizations. Let’s see, compliance pressure is still a big issue, making sure that we’re in compliance with regulations. More and more unstructured data being added and online schema change where we’re being able to make more changes without bringing the system down. And these are all good things to keep in mind. What are the top 10 types of Db2 tools? Again, this is only my opinion, but I start with change management, and I put that at number one instead of a performance monitor.

[01:08:37] – Craig Mullins
And sometimes I’m asking why. Well, have you ever tried to make a change of any substance to a production database without having a change management tool? You know, it’s a lot of effort. You know, you got to unload data, drop it, recreate it, reload it, rebind, and it’s very error-prone. Whereas if you’ve got a change management tool that says, I know for this type of change, here’s all the steps I need to make, and it creates the scripts and automates it for you, that to me is the most important type of tool to have. Then visibility, just in order to allow people to look at the catalog without having to write a lot of SQL, both developers and DBAs, very time-consuming. Very time-saving. And then you’ve got your performance issues and your automation tools, but lots of good Db2 tools. And every last one of these are things that can be useful and can help shave time off your development and administration type efforts. This application restart control, that’s an example of a commit type of a product where you can embed that into your applications and control when things are committed. Okay, getting near the end here, and thank you for sticking with me through this.

[01:10:02] – Craig Mullins
But, you know, the, the top 10 books for Db2 professionals— come on, what do you think I’m going to say? Used to just be one, the Db2 Developer’s Guide, but I’ve got this newer book for application developers talking about how to build performance into your applications from the very beginning. So, you know, these are my top Db2 books out there. And if you’ve got those books, your office doesn’t really have to look like this. Always like ending on an amusing slide. So that’s the top 10 list. I want to thank you for your time. And here’s my contact information. If you’ve got any questions you don’t want to ask now, uh, you know, feel free to send me a, uh, an email. More than happy to, uh, take any of your questions. And you can go to my website, find information, uh, about my consulting practices, me, how to get in touch with me, all of my books. And, uh, real quickly wanted to mention that my most recent book was just published this July called The Cost of Good Enough Data. And it’s a theme that we’ve kind of discussed today, which is the gradual acceptance of shortcuts in data, database, and system design.

[01:11:31] – Craig Mullins
And we talk about some of the new technologies and why, you know, that’s happening. And it’s not saying you shouldn’t use the new technologies, but talking about the importance of time-tested practices for data quality and design and governance. And you— we kind of want to abandon that, put it in, we’ll fix it later. And really, because later sometimes never comes, and we wind up with good enough instead of great the way it should be. Okay, so that’s my time.

[01:12:10] – Amanda Hendley
Uh, thank you, Craig.

[01:12:12] – Craig Mullins
Any— yeah, you’re welcome. Any questions out there?

[01:12:16] – Amanda Hendley
Yeah, anyone that has any questions, you’re welcome to drop those in chat. I, I love the COVID of your recent book. It, um, makes me think of the, uh, the probably the turmoil and gloom that most That a lot of people are feeling with these recent issues. You

[01:12:37] – Craig Mullins
know, yeah, yeah, it should, there should be a plane coming out of the sky and maybe one of these boxes should be labeled Outlook based on what just happened last week.

[01:12:48] – Amanda Hendley
I don’t, I don’t know many people that minded that Outlook was down. I heard that Teams was still up and a lot of people were a little Salty that Teams was still running, but Outlook was down.

[01:13:03] – Craig Mullins
Yeah. Yeah, yeah, I’m, I’m consulting at another shop right now, and it basically drove everything to a halt because of Outlook being down at that shop. So I think that happened to a lot of people, and they kind of kicked back, had a coffee, and enjoyed the day for a change.

[01:13:27] – Amanda Hendley
Did you ever watch The Office?

[01:13:30] – Craig Mullins
Oh yeah, yeah.

[01:13:31] – Amanda Hendley
So they, uh, someone used AI to create a short scene of The Office going, it’s finally our time, paper is back.

[01:13:42] – Craig Mullins
I loved it. I saw that, I saw that. Yeah, that Office Space is another good movie to watch.

[01:13:51] – Amanda Hendley
Oh my gosh, yes.

[01:13:53] – Craig Mullins
Yeah, I’ve often wanted to take a baseball bat to a printer.

[01:13:58] – Amanda Hendley
Yes, I have yet to do that, but I have just unilaterally thrown away printers. Just, yeah, when I, when I had a $40 printer that said I needed to take it to a repair shop, I was like, I don’t think they fix $40 printers.

[01:14:17] – Craig Mullins
Like, yeah, the ink costs more than the printer.

[01:14:20] – Amanda Hendley
Right, right. Oh, well, that’s— so we’re very thankful though that email is back up at least. We’ve got to get our last little bit of work in. I think I, I read somewhere like we’ve got 2 more weeks of the rest of the year to get our work done, like this week and then like the week after the Thanksgiving holiday here in the US, and then everything else will shut down. So, well, Craig, again, thank you so much. If there are any questions, you can put them in chat or Would I’m happy to pass along anything? Couple of people reached out to me and they asked about the recording, and we’ll get that posted with a recap as soon as possible. And if you’re interested on our YouTube channel, you can just search like virtual user groups, mainframe virtual user groups, or planet mainframe virtual user groups. You can find all of our past session recordings there available on YouTube, and then we also post them on planetmainframe.com. So. So check those out there. And with that, again, Craig, thank you so much for a fun session. Always— Thank you for having me. Top 10 list.

[01:15:33] – Amanda Hendley
So that was fun.

[01:15:36] – Craig Mullins
Happy to be here. Happy to present. Thank you, Amanda.

[01:15:39] – Amanda Hendley
All right. Thank you. Y’all have a great rest of the day.

Virtual Db2 Sponsor

Planet Mainframe
Craig Mullins

Craig Mullins

President
Mullins Consulting Inc.

Upcoming Db2 Session

Get the latest Virtual User Group Updates

This field is for validation purposes and should be left unchanged.
Select the Groups you'd like to Join(Required)