[专家问答]阿里数据库专家曾文旌为你解决数据库那些事
问个问题 pg一个数据块是8k,那一个数据块能存多少行数据,是不是要根据一张表的各字段的字节数来算,8k/各字段字节数的和,问这个问题向想知道怎么做容量规划 谢谢
postgres=# create table test01(id int primary key,note text);CREATE TABLETime: 184.321 mspostgres=# insert into test01 select generate_series(1,100000),'testcontent';INSERT 0 100000Time: 996.752 ms
postgres=# d+ test01
Table 'public.test01'
Column | Type | Modifiers | Storage | Stats target | Descrip
id | integer | not null | plain | | note | text | | extended | | Indexes:
'test01_pkey' PRIMARY KEY, btree (id)
postgres=# dt+ test01
List of relations
Schema
Name
Type
Owner
Size
Description
public
test01
table
postgres
4360 kB
(1 row)
postgres=# select 4360/1024;
?column?
4
(1 row)
Time: 0.457 ms
integer 占4字节text 变长,但这里测试 每行都是11个字符,每行占4+11=15字节
postgres=# select (4+4+11)*100000/1024/1024;
?column?
1
(1 row)
我计算得出表大小是1MB,但实际上是4MB,不知道那里算错了?
slony-I做主从 在设置订阅者的时候包这个错,但日志中并没发现明显的错误,这个要怎么排除呢?postgres@slave09:~$ slonik_subscribe_set 1 2 | slonik waiting for events (2,5000000001) only at (2,0) to be confirmed on node 1waiting for events (2,5000000001) only at (2,0) to be confirmed on node 1
赞6
踩0