---
title: "db2单表优化的命令"
author: "loveseaside"
date: "2010-08-16T09:04:08Z"
tags: ["DB2"]
categories: ["数据库"]
slug: "db2"
draft: false
lastmod: "2010-08-16T09:04:26Z"
id: 738089
url: "https://loveseaside.iteye.com/blog/738089"
---

**reorg   和runstats   都是单个表优化**

 

      reorg   table   &lt;tablename&gt;   通过重构行来消除“碎片”数据并压缩信息，对表进行重组。  
      runstats   on   table   &lt;tbschema&gt;.&lt;tbname&gt;   收集表   &lt;tbname&gt;   的统计信息。

 

 **reorgchk** 

         reorgchk   on   table   all   确定是否需要对表进行重组，对于对所有表自动执行   runstats   很有用。

    举例：reorg   和runstats  单表优化，初始化的命令：  
           runstats on table tablename;  
           reorg table tablename;