DB2メモ

自分用DB2メモ。

runstatsのオプション

  • with distribution:表の拡張統計情報(最大最小からの分布状況を含む)を取得
  • for indexes all:索引の基本統計情報を取得
  • and indexes all:表及び索引の基本統計情報を取得
  • for detailed indexes all:索引の拡張統計情報を取得
  • and detailed indexes all:表の基本統計情報、索引の拡張統計情報を取得

統計情報量が増えてもよいなら以下の文でおk
runstats on table テーブル名 with distribution and detailed indexes all

エラー(SQL2312N)が出たら、エラーメッセージに書かれてある推奨値どおりに統計ヒープ・サイズ(stat_heap_sz)を増やすべし。

                                                                                                                                                  • -

OracleでいうところのROWNUMにあたるもの
row_number() over()

M件目からN件目を取得
select 列名 from (select row_number(), 列名 over (order by 並び順用列名) as rownum from テーブル名) where rownum between M and N