---
title: "DB2 Ideas When to Perform RUNSTATS"
description: "In DB2, you need to know Rusnstats utility when it has to run. Ideas that are given in this post help you to make a decision."
url: https://srinimf.com/2021/01/10/db2-5-bold-ideas-when-to-execute-runstats/
date: 2021-01-10
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2021/01/pexels-photo-3764008.jpeg?fit=1880%2C1253&ssl=1
categories: ["Categories", "DB2"]
tags: ["RUNSTATS Utility"]
type: post
lang: en
---

# DB2 Ideas When to Perform RUNSTATS

When to perform RUNSTATS in DB2 is the prime question in SQL interviews. Here are ideas and examples for you to tell correct answer in your next interview.

Related[DB2 Optimizer Vs RUNSTATS: Top Differences](https://srinimf.com/2020/11/15/db2-optimizer-versas-runstats/)

> You may also like [Array vs](https://srinimf.com/2021/07/23/scala-vs-java-the-real-difference-in-array/) List in Python.

Related[3 DB2 Optimizer Interview Questions](https://srinimf.com/2015/05/08/db2-optimizer-interview-questions/)

This is a question for developers while working on projects and when they give interviews. Runstats is a utility that collects statistics and sends these to the optimizer for the right decision.

## When to Run Runstats in DB2

You need to run this utility during the below scenarios.

1. When a table is loaded
2. When an index is created
3. When a tablespace is reorganized
4. When there have been extensive updates, deletions, or insertions in a tablespace
5. After the recovery of a tablespace to a prior point in time

## How Optimizer Decision Affects When You Not Collect Statistics

1. The optimizer may not take the right decision for multi-joint tables query
2. The optimizer may choose the wrong choice of index, which in turn affects performance
3. When a column designed to have default values, you need to run the RUNSTATS utility for frequency value statistics help in better decision

### [How to](https://srinimf.com/2023/06/05/how-to-print-sum-of-prime-numbers-in-python/) Know When to Execute Runstats

- You need to refer to SYSIBM.SYSCOLDIST catalog table about the running of Runstats utility is needed or not. The IBM Data Studio tool will also show those statistics.

- DB2 gets the [frequency value of statistics](https://www.statisticshowto.com/how-to-make-a-frequency-chart-and-determine-frequency/#:~:text=A%20frequency%20is%20the%20number,magnitude%20along%20with%20their%20frequencies.) when Runstats utility is executed.

Keep Reading

[![30 SQL Practice Queries with Solutions — Run Them Live](https://i0.wp.com/srinimf.com/wp-content/uploads/2026/10/pexels-photo-5530473.jpeg?resize=800%2C600&ssl=1)](https://srinimf.com/2026/10/01/30-sql-practice-queries-with-solutions-run-them-live/)

## [30 SQL Practice Queries with Solutions — Run Them Live](https://srinimf.com/2026/10/01/30-sql-practice-queries-with-solutions-run-them-live/)

Practice 30 SQL queries with solutions, from SELECT and JOINs to subqueries and window functions. Run SQL queries live in an interactive SQL Playground.

[![Srini&apos;s avatar](https://secure.gravatar.com/avatar/f10b4bafeeb96dce9806c5a3c6cde6ea1e2c014ef273120a4bf2c6d5f975f01c?s=48&r=g)](https://srinimf.com/author/moonrobot/)
by [Srini](https://srinimf.com/author/moonrobot/)
October 1, 2026October 11, 2026

[![Supercharge Your Database Skills: Try Our New Interactive SQL Plugin!](https://i0.wp.com/srinimf.com/wp-content/uploads/2026/09/pexels-photo-1181469.jpeg?resize=1200%2C900&ssl=1)](https://srinimf.com/2026/09/30/supercharge-your-database-skills-try-our-new-interactive-sql-plugin/)

## [Supercharge Your Database Skills: Try Our New Interactive SQL Plugin!](https://srinimf.com/2026/09/30/supercharge-your-database-skills-try-our-new-interactive-sql-plugin/)

Struggling with database queries? Explore our new interactive SQL plugin to write, test, and master SQL directly in your browser. Try the live demo now!

[![Srini&apos;s avatar](https://secure.gravatar.com/avatar/f10b4bafeeb96dce9806c5a3c6cde6ea1e2c014ef273120a4bf2c6d5f975f01c?s=48&r=g)](https://srinimf.com/author/moonrobot/)
by [Srini](https://srinimf.com/author/moonrobot/)
September 30, 2026October 10, 2026

[![How to Count Spark Stages by Sight and Optimize Shuffles](https://i0.wp.com/srinimf.com/wp-content/uploads/2026/09/pexels-photo-14314638.jpeg?resize=1200%2C900&ssl=1)](https://srinimf.com/2026/09/27/how-to-count-spark-stages-by-sight-and-optimize-shuffles/)

## [How to Count Spark Stages by Sight and Optimize Shuffles](https://srinimf.com/2026/09/27/how-to-count-spark-stages-by-sight-and-optimize-shuffles/)

Want to predict execution stages before running a job? Learn how to count Spark stages by sight with code breakdowns, shuffle rules, and optimization traps.

[![Srini&apos;s avatar](https://secure.gravatar.com/avatar/f10b4bafeeb96dce9806c5a3c6cde6ea1e2c014ef273120a4bf2c6d5f975f01c?s=48&r=g)](https://srinimf.com/author/moonrobot/)
by [Srini](https://srinimf.com/author/moonrobot/)
September 27, 2026October 11, 2026

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2021%2F01%2F10%2Fdb2-5-bold-ideas-when-to-execute-runstats%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2021%2F01%2Fpexels-photo-3764008.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=DB2%20Ideas%20When%20to%20Perform%20RUNSTATS)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2021/01/10/db2-5-bold-ideas-when-to-execute-runstats/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2021/01/10/db2-5-bold-ideas-when-to-execute-runstats/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2021/01/10/db2-5-bold-ideas-when-to-execute-runstats/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2021/01/10/db2-5-bold-ideas-when-to-execute-runstats/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20DB2%20Ideas%20When%20to%20Perform%20RUNSTATS&body=https%3A%2F%2Fsrinimf.com%2F2021%2F01%2F10%2Fdb2-5-bold-ideas-when-to-execute-runstats%2F&share=email)
-

### Like this:

Like Loading…
