ページ数確認

(8.0.22)
https://gihyo.jp/dev/serial/01/mysql-road-construction-news/0056

drop table tab1;
create table tab1(col1 int,col2 varchar(8000));

insert into tab1 values(1,rpad('x',8000,'x') );

select col1,col2,char_length(col2),length(col2) from tab1;

analyze table tab1;

select database_name,table_name,clustered_index_size,sum_of_other_index_sizes
from mysql.innodb_table_stats
where database_name = 'test'
and table_name = 'tab1'
;

 

(19c)

drop table tab1 purge;
create table tab1(col1 int,col2 varchar2(4000));

insert into tab1 values(1,rpad('x',4000,'x') );
commit;

select col1,col2,length(col2),lengthb(col2) from tab1;

select * from dba_segments
where owner = 'TEST'
and segment_name = 'TAB1'
;

 

(13)
https://kaigai.hatenablog.com/entry/20090623/1245760737


drop table tab1;
create table tab1(col1 int,col2 varchar(2000));

insert into tab1 values(1,rpad('x',2000,'x') );

select col1,col2,char_length(col2),octet_length(col2) from tab1;

analyze tab1;

select * from pg_class
where relname = 'tab1'
and relnamespace = (select oid from pg_namespace where nspname = 'public')
;

※TOAST管理のコードは、テーブル内に格納される値がTOAST_TUPLE_THRESHOLDバイト(通常2キロバイト)を超える時にのみ実行されます。

 

(2019)

drop table tab1;
create table tab1(col1 int,col2 varchar(8000));

insert into tab1 values(1,replicate('x',8000) );

select col1,col2,len(col2),datalength(col2) from tab1;

select * from sys.dm_db_partition_stats
where object_id = object_id('dbo.tab1')
;