データセグメントが作成されるタイミング

(8.0.27)

drop table tab1;
create table tab1(col1 int);

select
  table_name
  ,table_rows
  ,avg_row_length
  ,data_length
  ,index_length
from information_schema.tables
where table_schema = database()
and table_name = 'tab1'
;

テーブル作成時、16kBのサイズがある

 

(19c)


show parameter deferred_segment_creation

-- 1. deferred_segment_creation = TRUE (デフォルト値)の場合

drop table tab1 purge;
create table tab1(col1 int);

select bytes from user_segments where segment_name = 'TAB1';

テーブル作成時、サイズは0
データ1件投入により64kBを使用する


-- 2. deferred_segment_creation = FALSE の場合

alter session set deferred_segment_creation = FALSE;

drop table tab1 purge;
create table tab1(col1 int);

select bytes from user_segments where segment_name = 'TAB1';

テーブル作成時、64kBのサイズがある

(14)

drop table tab1;
create table tab1(col1 int);

select pg_relation_size('tab1');


テーブル作成時、サイズは0
データ1件投入により8kBを使用する

 

(2019)


drop table tab1;
create table tab1(col1 int);

exec sp_spaceused 'dbo.tab1';
go


テーブル作成時、サイズは0
データ1件投入によりデータ8kB,インデックス8kBを使用する